Skip to content

Instantly share code, notes, and snippets.

@g1039
Last active February 14, 2018 12:34
Show Gist options
  • Save g1039/6141d1edf4c6c5b76fb43cb2cfb6ad96 to your computer and use it in GitHub Desktop.
Save g1039/6141d1edf4c6c5b76fb43cb2cfb6ad96 to your computer and use it in GitHub Desktop.
Learning Pandas
import pandas as pd
# Create empty dataframe
df = pd.DataFrame()
d = pd.date_range('2/1/2016', periods=5)
counter = []
for x, y in enumerate(d, 1):
counter.append(x)
# View dataframe
df["Date"] = d
df["Counter"] = counter
df.index += 1 # start index at 1, not 0
print(df)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment