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

Make pandas 2.0 fix with the assignment #90

Merged
merged 3 commits into from
Apr 21, 2024
Merged
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
8 changes: 5 additions & 3 deletions open_alaqs/core/modules/MovementSourceModule.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ def _default_emissions(*args):

# Add default gate and flight emissions
empty_series = pd.Series(index=df.index, dtype=object)
# TODO OPENGIS.ch: the type of the `GateEmissions` column would be an `Emission` instance, but later we set it to
# `{distance_time:float, distance_space:float, emissions: list[Emissions]}`
df.loc[:, "GateEmissions"] = empty_series.apply(_default_emissions)
df.loc[:, "FlightEmissions"] = empty_series.apply(_default_emissions)

Expand Down Expand Up @@ -280,13 +282,13 @@ def process(
for name, group in df[relevant_movements].groupby(gate_columns):

# Calculate the gate emissions
gemissions = self.FetchGateEmissions(
gate_emissions = self.FetchGateEmissions(
group, calc_method, source_names, runway_names
)

# Update the gate emissions
for ix in group.index:
df.loc[ix, "GateEmissions"] = gemissions
df.at[ix, "GateEmissions"] = gate_emissions

"""
Calculate Flight Emissions
Expand All @@ -306,7 +308,7 @@ def process(

# Update the flight emissions
for ix in group.index:
df.loc[ix, "FlightEmissions"] = flight_emissions
df.at[ix, "FlightEmissions"] = flight_emissions

"""
Calculate Taxiing Emissions
Expand Down
Loading