Playing Around with Pandas, Matplotlib, Seaborn, Plotly, and Cufflinks Functions.
idxmin() and idxmax()
Pandas allows to get index of min and max using idxmin() and idxmax() respectively..std()
Examples:
- dataframe.idxmin()
- dataframe.idxmax()
std()
Pandas allows to calculate standard deviation for each column with .std()Examples:
- dataframe.std()
.plot()
.plot() directly shows line graph.iplot()
Similar to plot() but for interactive graphs
.xs()
.xs() is called cross section. Used to get a sub column data. It has following arguments:- key - for column name or row name
- axis - 1 if column, default is 0 for row
- level - if there is several levels to columns or rows
Example:
- dataframe.xs(key='Column_name', axis=1, level='Super_column_name')
Plot Moving Average
dataframe['Column name'].rolling(window=30).mean().plot(label='30 day moving average')
dataframe['Column name'].plot(label='30 day moving average')
Plot Candle Chart of a Stock
df_stock = stock[['Open', 'High','Low', 'Close']].ix['2015-01-01':'2016-01-01']
df_stock.iplot(kind='candle')
Comments
Post a Comment