In [4]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib # only need to get matplotlib version
import sys # only need to get python version
In [5]:
print("Python version: " + sys.version)
print("Matplotlib version: " + matplotlib.__version__)
print("Numpy version: " + np.__version__)
print("Pandas version: " + pd.__version__)
In [2]:
%matplotlib inline
In [44]:
# this limit maximum numbers of rows displayed on screen
pd.set_option("display.max_rows", 15)
In [11]:
s = pd.Series([1,3,5,np.nan,6,8])
In [24]:
alias = ['B', 'C', 'D', 'W', 'M', 'BM', 'MS', 'BMS', 'Q', 'BQ', 'QS', 'BQS', 'A', 'BA', 'AS', 'BAS', 'H', 'T', 'S', 'L', 'U']
In [28]:
description = ['business day frequency', 'custom business day frequency (experimental)', 'calendar day frequency',
'weekly frequency', 'month end frequency', 'business month end frequency', 'month start frequency',
'business month start frequency', 'quarter end frequency', 'business quarter end frequency',
'quarter start frequency', 'business quarter start frequency', 'year end frequency',
'business year end frequency', 'year start frequency', 'business year start frequency',
'hourly frequency', 'minutely frequency', 'secondly frequency', 'milliseconds', 'microseconds']
In [29]:
cheatsheet = pd.Series(description, index = alias)
In [30]:
print(cheatsheet)
In [17]:
s
Out[17]:
In [38]:
dates = pd.date_range('1950-01', '2013-03', freq='D')
In [21]:
pd.date_range??
In [40]:
t = pd.Series(np.ones(dates.shape[0])*5, index=dates)
In [41]:
t_utc = t.tz_localize('UTC')
In [42]:
t_utc
Out[42]:
In [43]:
t.resample('M', how='mean')
Out[43]:
In [30]:
t.resample('M', how='count')
Out[30]:
In [31]:
t.resample('M', how='sum')
Out[31]:
In [ ]: