In [ ]:
import pandas as pd
from pandas import Series, DataFrame, Panel
pd.__version__
In [ ]:
import numpy as np
In [ ]:
ts1 = ['a','b','c','d','e','f']
ts2 = ["u", "v", "w","x","y","z"]
index = [ 1, 2, 3, 4, 5, 6]
In [ ]:
d = {'col1': ts1, 'col2': ts2}
d
In [ ]:
df = DataFrame(data=d, index=index)
df
Matrix: 10 rows, 5 columns
In [ ]:
np.random.randn(10, 5)
In [ ]:
df2 = DataFrame(np.random.randn(10, 5))
df2
Named Columns data frame
In [ ]:
df3 = DataFrame(np.random.randn(10, 5),
columns=['a', 'b', 'c', 'd', 'e'])
df3
Transpose matrix
In [ ]:
df3.T
In [ ]:
df3.T[0]
Get a random row or rows
In [ ]:
df3.sample(n=3)
In [ ]:
df3.boxplot()
In [ ]:
df3.plot.kde()
In [ ]:
ts = pd.Series(np.random.randn(1000), index=pd.date_range('1/1/2000', periods=1000))
ts.head()
In [ ]:
ts.describe()
In [ ]:
ts_sum = ts.resample("1w").ohlc()
ts_sum.describe()
In [ ]:
ts_sum.count()
In [ ]:
f