Python Data Science Missing Links (Time & Date)
Python Data Science Missing Links (Time & Date)
Date&Time
We can create timestamp using pd.Timestamp
We can create period by using pd.Period
We can convert to to time stamp by using pd.to_datetime()
We can create date range using pd.date_range()
We can set week day name by using .weekday_name
We can groupby date using .resample(‘M’/’Y’/’D’/’T’)
import pandas as pd
import numpy as np
yearfirst=False
Weekday_nam df.index.weekday_name
e
.loc for Date df.loc['2016':,]
DataFrame It will print everything from 2016 to end and rows
df['2016-12':]
It will print everything from 2016-12 to last
Groupby in df.resample('Y').sum()
Date It will groupby the year