Skip to content

Commit

Permalink
Avoid used of chained assignment in preparation for pandas v3
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-evs committed Aug 15, 2024
1 parent dad3656 commit d171781
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions navani/echem.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,9 +494,9 @@ def neware_reader(filename: Union[str, Path], expected_capacity_unit: str = "mAh

df["Current"] = 1000 * df["Current(mA)"]
df["state"] = pd.Categorical(values=["unknown"] * len(df["Status"]), categories=["R", 1, 0, "unknown"])
df["state"][df["Status"] == "Rest"] = "R"
df["state"][df["Status"] == "CC_Chg"] = 1
df["state"][df["Status"] == "CC_DChg"] = 0
df.loc[df["Status"] == "Rest", "state"] = "R"
df.loc[df["Status"] == "CC_Chg", "state"] = 1
df.loc[df["Status"] == "CC_DChg", "state"] = 0
df["half cycle"] = df["Cycle"]
df['cycle change'] = False
not_rest_idx = df[df['state'] != 'R'].index
Expand Down

0 comments on commit d171781

Please sign in to comment.