Skip to content

Commit

Permalink
Merge pull request #455 from ua-snap/fix-deprecated-pandas-call
Browse files Browse the repository at this point in the history
Newer pandas requires date_range function call to create DatetimeIndex
  • Loading branch information
tobeycarman authored Feb 19, 2021
2 parents f2e5567 + 21289f0 commit 0d8dd00
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions scripts/input_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,21 +326,21 @@ def climate_ts_plot(args):
htcV = hds.variables['time']
ptcV = pds.variables['time']

hidx = pd.DatetimeIndex(
hidx = pd.DatetimeIndex(pd.date_range(
start=nc.num2date(htcV[0], htcV.units, htcV.calendar).strftime(),
end=nc.num2date(htcV[-1], htcV.units, htcV.calendar).strftime(),
freq='MS' # <-- month starts
freq='MS') # <-- month starts)
)
pidx = pd.DatetimeIndex(
pidx = pd.DatetimeIndex(pd.date_range(
start=nc.num2date(ptcV[0], ptcV.units, ptcV.calendar).strftime(),
end=nc.num2date(ptcV[-1], ptcV.units, ptcV.calendar).strftime(),
freq='MS' # <-- month starts
freq='MS') # <-- month starts
)

full_index = pd.DatetimeIndex(
full_index = pd.DatetimeIndex(pd.date_range(
start=nc.num2date(htcV[0], htcV.units, htcV.calendar).strftime(),
end=nc.num2date(ptcV[-1], ptcV.units, ptcV.calendar).strftime(),
freq='MS' # <-- month starts
freq='MS') # <-- month starts
)

df = pd.DataFrame({}, index=full_index)
Expand Down

0 comments on commit 0d8dd00

Please sign in to comment.