I was going through the Periods in pandas and couldnt find any particular use for it and i dont think it is any different from the date, for instance
To get the datetime, I use
datetime(2012,1,1)
To get a range of dates, I use
pd.date_range('1/1/2000', periods=10)
My question is, why would one use Period? According to the definition
Periods represent timespans, like days, months, quarters, or years.
p = pd.Period(2007, freq='A-DEC')
In this case, the Period object represents the full timespan from January 1, 2007, to December 31, 2007, inclusive. But if i go by definition, i should be able to groupby using the Period as i holds a range of timespan, but when i try to groupby, i am getting error
_period=pd.Period('2000',freq='M')
x = pd.date_range('1/1/2000', periods=14)
_result=pd.Series(range(len(x)),index=x)
_result.groupby(_period)
can anyone please help me understand when should i use Period and what and all problems can i solve using it