Skip to content

Commit

Permalink
Newer pandas requires date_range function call to create DatetimeIndex
Browse files Browse the repository at this point in the history
  • Loading branch information
tobeycarman committed Jan 13, 2021
1 parent 211477d commit 21289f0
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 21289f0

Please sign in to comment.