Skip to content

Instantly share code, notes, and snippets.

@pierrelouisbescond
Last active September 11, 2022 08:55
Show Gist options
  • Save pierrelouisbescond/6634a5af3be3b726ff747192459541b6 to your computer and use it in GitHub Desktop.
Save pierrelouisbescond/6634a5af3be3b726ff747192459541b6 to your computer and use it in GitHub Desktop.
import pandas as pd
import numpy as np
import math
# We create the DataFrame as a date range between 6/1/2020 (US format) and 6/2/2020 -1
df = pd.DataFrame(index=pd.date_range(start='6/1/2020', end='6/2/2020', freq='min')[:-1])
# We create an integer array from 0 to 1439 (= 24 hours x 60 minutes)
df["x"]=np.linspace(0, 24 * 60 - 1, 24 * 60, dtype=int)
df
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment