Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolves 2 pandas warnings #418

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions carsus/io/chianti_/chianti_.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,9 @@ def read_levels(self):
levels = pd.DataFrame(levels_dict)

# Replace empty labels with NaN
levels.loc[:, "label"] = levels["label"].replace(
r'\s+', np.nan, regex=True)
with pd.option_context('future.no_silent_downcasting', True):
levels.loc[:, "label"] = levels["label"].replace(
r'\s+', np.nan, regex=True).infer_objects(copy=False)

# Extract configuration and term from the "pretty" column
levels[["term", "configuration"]] = levels["pretty"].str.rsplit(
Expand Down
4 changes: 2 additions & 2 deletions carsus/io/nist/weightscomp.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ def load(self, input_data):

def _prepare_atomic_weights(self, atomic):
grouped = atomic.groupby([AW_TYPE_COL])
interval_gr = grouped.get_group(INTERVAL).copy()
stable_mass_num_gr = grouped.get_group(STABLE_MASS_NUM).copy()
interval_gr = grouped.get_group((INTERVAL,)).copy()
stable_mass_num_gr = grouped.get_group((STABLE_MASS_NUM,)).copy()

def atomic_weight_interval_to_nom_val_and_std(row):
nom_val, std_dev = to_nom_val_and_std_dev(
Expand Down