henrychan28 / Transport

0 stars 0 forks source link

Websites #1

Open henrychan28 opened 6 years ago

henrychan28 commented 6 years ago

https://codesachin.wordpress.com/2016/06/09/the-magic-behind-attribute-access-in-python/ https://www.pythoncentral.io/how-metaclasses-work-technically-in-python-2-and-3/ https://blog.ionelmc.ro/2015/02/09/understanding-python-metaclasses/ http://mikegrouchy.com/blog/2012/05/be-pythonic-__init__py.html

henrychan28 commented 6 years ago

https://engineering.upside.com/a-beginners-guide-to-optimizing-pandas-code-for-speed-c09ef2c6a4d6 https://towardsdatascience.com/how-i-learned-to-love-parallelized-applies-with-python-pandas-dask-and-numba-f06b0b367138 http://jakevdp.github.io/blog/2015/02/24/optimizing-python-with-numpy-and-numba/ http://yaoyao.codes/python/2017/09/25/pandas-accessing-the-index-of-a-row-in-an-apply-function http://numba.pydata.org/numba-doc/latest/user/overview.html https://dask.pydata.org/en/latest/dataframe.html https://stackoverflow.com/questions/45610292/how-to-make-numba-jit-use-all-cpu-cores-parallelize-numba-jit https://stackoverflow.com/questions/26187759/parallelize-apply-after-pandas-groupby https://roman-kh.github.io/numba-2/ https://www.linkedin.com/pulse/making-python-pandas-parallel-saurabh-sarkar-ph-d-/

henrychan28 commented 6 years ago

import plotly as py import plotly.graph_objs as go import pandas as pd import json

plotly.offline.init_notebook_mode(connected=True) data = [go.Heatmap(z=[[11, 0, 0, 0, 12], [0, 3, 0, 0, 0], [1,0,0,2,4]], x=['SHH', 'SHZ', 'HKG', 'ASX', 'KSC'], y=['Bin Structure', 'Value Check', 'Completeness'], colorscale=[[0.0, 'rgb(0, 196, 3)'],[1e-10, 'rgb(150, 2, 2)'], [1.0, 'rgb(216, 2, 2)']], showscale = False)]

layout = go.Layout( title='VCM Validation', xaxis = {'title':'Exchange'}, autosize=True, height=300, width=600, margin=go.Margin( l=100, r=50, b=100, t=100, ) ) fig = go.Figure(data=data, layout=layout)

py.offline.iplot(fig)

data = [go.Heatmap(z=[[11, 0, 0, 0, 12], [0, 3, 0, 0, 0]], x=['SHH', 'SHZ', 'HKG', 'ASX', 'KSC'], y=['Bin Structure', 'Value Check'], colorscale=[[0.0, 'rgb(0, 196, 3)'],[1e-10, 'rgb(150, 2, 2)'], [1.0, 'rgb(216, 2, 2)']], showscale = False)]

layout = go.Layout( title='Market Data Validation', xaxis = {'title':'Exchange'}, autosize=True, height=300, width=600, margin=go.Margin( l=100, r=50, b=100, t=100, ) ) fig = go.Figure(data=data, layout=layout)

py.offline.iplot(fig)

df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/2014_usa_states.csv')

trace = [go.Table( header=dict(values=list(df.columns), fill = dict(color='#C2D4FF'), align = ['left'] 5), cells=dict(values=[df.Rank, df.State, df.Postal, df.Population], fill = dict(color='#F5F8FF'), align = ['left'] 5))]

layout = go.Layout( title='Market Data Validation', xaxis = {'title':'Exchange'}, autosize=True, height=800, width=600, margin=go.Margin( l=100, r=50, b=100, t=100, ) )

updatemenus = list([ dict(buttons=list([
dict(label = 'None', method = 'relayout', args = ['shapes', []]), dict(label = 'Cluster 0', method = 'relayout', args = ['shapes', 0]), dict(label = 'Cluster 1', method = 'relayout', args = ['shapes', 0]), dict(label = 'Cluster 2', method = 'relayout', args = ['shapes', 0]), dict(label = 'All', method = 'relayout', args = ['shapes', 0]) ]), direction = 'down', pad = {'r': 10, 't': 10}, showactive = True, x = 0.1, xanchor = 'left', y = button_layer_1_height, yanchor = 'top' ) , dict(buttons=list([
dict(label = '2', method = 'relayout', args = ['shapes', []]), dict(label = '3 0', method = 'relayout', args = ['shapes', 0]), dict(label = 'Cluster 1', method = 'relayout', args = ['shapes', 0]), dict(label = 'Cluster 2', method = 'relayout', args = ['shapes', 0]), dict(label = 'All', method = 'relayout', args = ['shapes', 0]) ]) )]) layout['updatemenus']= updatemenus

fig = go.Figure(data = trace, layout = layout) py.offline.iplot(fig, filename = 'pandas_table')

henrychan28 commented 6 years ago

https://stats200.stanford.edu/lectures.html