Q: Pandas: Group by year and plot density I have a data frame that contains some time based data:
>>> temp.groupby(pd.TimeGrouper('AS'))['INC_RANK'].mean()
date
2001-01-01    0.567128
2002-01-01    0.581349
2003-01-01    0.556646
2004-01-01    0.549128
2005-01-01         NaN
2006-01-01    0.536796
2007-01-01    0.513109
2008-01-01    0.525859
2009-01-01    0.530433
2010-01-01    0.499250
2011-01-01    0.488159
2012-01-01    0.493405
2013-01-01    0.530207
Freq: AS-JAN, Name: INC_RANK, dtype: float64

And now I would like to plot the density for each year. The following command used to work for other data frames, but it is not here:
>>> temp.groupby(pd.TimeGrouper('AS'))['INC_RANK'].plot(kind='density')
ValueError: ordinal must be >= 1

Here's how that column looks like:
>>> temp['INC_RANK'].head()
date
2001-01-01    0.516016
2001-01-01    0.636038
2001-01-01    0.959501
2001-01-01         NaN
2001-01-01    0.433824
Name: INC_RANK, dtype: float64


A: I think it is due to the nan in your data, as density can not be estimated for nans. However, since you want to visualize density, it should not be a big issue to simply just drop the missing values, assuming the missing/unobserved cells should follow the same distribution as the observed/non-missing cells. Therefore, df.dropna().groupby(pd.TimeGrouper('AS'))['INC_RANK'].plot(kind='density') should suffice. 
On the other hand, if the missing values are not 'unobserved', but rather are the values out of the measuring range (say data from a temperature sensor, which reads 0~50F, but sometimes, 100F temperate is encountered. Sensor sends out a error code and recorded as missing value), then dropna() probably is not a good idea.
