Copyright 2019 - Matt Harrison
@__mharrison__
| """ | |
| This is a module docstring. It must be at the TOP | |
| of the file. | |
| This is the markov module. You can create | |
| a markov chain like this: | |
| >>> m = Markov('ab') | |
| >>> m.predict('a') | |
| 'b' |
| %%javascript | |
| var selectedCell = 0; | |
| var viewOutput = false; | |
| Jupyter.keyboard_manager.command_shortcuts.add_shortcut('ctrl-l', function (event) { | |
| function getOutputScrollValue(cell) { | |
| var percent = 0; | |
| var ct = cell.output_area.element.offset().top; | |
| var sme = Jupyter.notebook.scroll_manager.element; |
| import argparse | |
| import sys | |
| import black | |
| from blib2to3.pgen2.tokenize import TokenError | |
| TEST_DATA = """ | |
| Normal |
| mush_df = pd.read_csv('../data/agaricus-lepiota.data.txt', | |
| names='class,cap_shape,cap_surface,cap_color,bruises,' | |
| 'odor,g_attachment,g_spacing,g_size,g_color,s_shape,' | |
| 's_root,s_surface_a,s_surface_b,s_color_a,s_color_b,' | |
| 'v_type,v_color,ring_num,ring_type,spore_color,pop,hab'.split(',')) | |
| mush_df = pd.get_dummies(mush_df, columns=mush_df.columns).drop(['class_e'],axis=1) |
| cols = 'class,cap_shape,cap_surface,cap_color,bruises,'\ | |
| 'odor,g_attachment,g_spacing,g_size,g_color,s_shape,'\ | |
| 's_root,s_surface_a,s_surface_b,s_color_a,s_color_b,'\ | |
| 'v_type,v_color,ring_num,ring_type,spore_color,pop,hab'.split(',') | |
| mush_df = pd.get_dummies(pd.read_csv('../data/agaricus-lepiota.data.txt', names=cols)) | |
| mush_df |
| # Data transformation from previous notebook | |
| # col names in tao-all2.col from website | |
| names = '''obs | |
| year | |
| month | |
| day | |
| date | |
| latitude | |
| longitude | |
| zon.winds |
| # Data transformation from previous notebook | |
| # col names in tao-all2.col from website | |
| names = '''obs | |
| year | |
| month | |
| day | |
| date | |
| latitude | |
| longitude | |
| zon.winds |
| %%time | |
| cols = ['obs', 'year', 'month', 'day', 'date', 'latitude', 'longitude', | |
| 'zon.winds', 'mer.winds', 'humidity', 'air temp.', 's.s.temp.'] | |
| nino = pd.read_csv('data/tao-all2.dat.gz', sep=' ', names=cols, header=None, | |
| na_values='.', parse_dates=[[1,2,3]]) | |
| cols = [c.strip().rstrip('.').replace(' ', '_').replace('.', '_') | |
| for c in nino.columns] | |
| nino.columns = cols | |
| nino.date = pd.to_datetime(nino.date, format='%y%m%d') | |
| nino['zon_winds_mph'] = nino.zon_winds * 2.237 |
| ===================== | |
| Pytest Introduction | |
| ===================== | |
| .. export PS1="$ " | |
| Copyright 2018 - Matt Harrison | |
| @__mharrison__ |