Skip to content

Commit

Permalink
Fix typo, add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexHls committed Oct 12, 2023
1 parent 4dc6fe4 commit fcb2f74
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tardis/plasma/properties/atomic.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ def calculate(self, atomic_data):
],
names=["source_level_idx", "destination_level_idx"],
)

level_idxs2line_idx = pd.Series(
np.arange(len(index)), index=index, name="lines_idx"
)
Expand All @@ -478,7 +479,14 @@ def calculate(self, atomic_data):
"This will raise an error in the future instead. "
"See https://github.com/tardis-sn/carsus/issues/384"
)
level_idxs2line_idx = level_idxs2line_idx.drop_duplicates()
# This is necessary since pd.DataFrame.drop_duplicates()
# does not remove duplicates if the data is different
# and only the index is duplicated. See the example given
# in the pandas documentation:
# https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.drop_duplicates.html
level_idxs2line_idx = level_idxs2line_idx[
~level_idxs2line_idx.index.duplicated()
]

return level_idxs2line_idx

Expand Down

0 comments on commit fcb2f74

Please sign in to comment.