Skip to content

Commit

Permalink
remain df index
Browse files Browse the repository at this point in the history
  • Loading branch information
junzis committed Feb 19, 2024
1 parent f33c5a8 commit 871e98a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions fastmeteo/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ def sync_local(self, start: np.datetime64, stop: np.datetime64):

def interpolate(self, flight: pd.DataFrame) -> pd.DataFrame:
times = pd.to_datetime(flight.timestamp)
index = flight.index

flight = flight.reset_index(drop=True).assign(
longitude_360=lambda d: d.longitude % 360
)
Expand Down Expand Up @@ -132,7 +134,10 @@ def interpolate(self, flight: pd.DataFrame) -> pd.DataFrame:
ds.coords, method="linear", assume_sorted=False
).to_dataframe()[self.features]

flight_new = pd.concat([flight, new_params], axis=1).drop(
columns="longitude_360"
flight_new = (
pd.concat([flight, new_params], axis=1)
.drop(columns="longitude_360")
.set_index(index)
)

return flight_new

0 comments on commit 871e98a

Please sign in to comment.