Skip to content

Instantly share code, notes, and snippets.

@JulianWgs
Created March 10, 2020 10:28
Show Gist options
  • Save JulianWgs/d895269b5c3600428e36f06dec44ff02 to your computer and use it in GitHub Desktop.
Save JulianWgs/d895269b5c3600428e36f06dec44ff02 to your computer and use it in GitHub Desktop.
Create index on hour range in pandas (date_range)
# index are integers
# when the index is already a time delete unit arg
pd.date_range(
start=pd.to_datetime(df.columns.min(), unit="h"),
end=pd.to_datetime(df.columns.max(), unit="h"),
freq="1H"
).time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment