This is an example tutorial to use my module bhishan for the plotly extension for pandas.
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
%load_ext autoreload
%load_ext watermark
%autoreload 2
%watermark -a "Bhishan Poudel" -d -v -m
%watermark -iv
Bhishan Poudel 2021-07-11 CPython 3.7.7 IPython 7.22.0 compiler : Clang 4.0.1 (tags/RELEASE_401/final) system : Darwin release : 19.6.0 machine : x86_64 processor : i386 CPU cores : 4 interpreter: 64bit seaborn 0.11.0 pandas 1.2.4 numpy 1.19.5
# my local library
import sys
sys.path.append("/Users/poudel/Dropbox/a00_Bhishan_Modules/")
sys.path.append("/Users/poudel/Dropbox/a00_Bhishan_Modules/bhishan")
from bhishan import bp
ts = pd.date_range(start='1/1/2018',
end='2/1/2019',freq='H')
target = np.random.choice([0,1],size=len(ts))
df_ts = pd.DataFrame({'date': ts, 'target': target})
df_ts.head()
date | target | |
---|---|---|
0 | 2018-01-01 00:00:00 | 0 |
1 | 2018-01-01 01:00:00 | 1 |
2 | 2018-01-01 02:00:00 | 1 |
3 | 2018-01-01 03:00:00 | 0 |
4 | 2018-01-01 04:00:00 | 1 |
df_ts.bp.plot_date_cat('date','target')
ts_small = pd.date_range(start='1/1/2018',
end='2/1/2018',freq='H')
target = np.random.choice([0,1,2],size=len(ts_small))
df_ts_small = pd.DataFrame({'date': ts_small, 'target': target})
df_ts_small.bp.plot_daily_cat('date','target')