This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas | |
| import io | |
| import gzip | |
| import boto3 | |
| csv_buffer = io.StringIO() | |
| my_df.to_csv(csv_buffer, index=False) | |
| csv_buffer.seek(0) | |
| gz_buffer = io.BytesIO() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| pd.options.display.max_columns = 40 | |
| pd.options.display.max_rows = 999 | |
| #details here: https://pandas.pydata.org/pandas-docs/stable/options.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ax.annotate(my_text, xy=(arrow_x,arrow_y), xytext=(text_x,text_y), | |
| arrowprops=dict(facecolor='gray', shrink=0.05)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| # my empirical distribution (it could be a numpy array) | |
| mydistr = [...] | |
| # calculate histogram weights | |
| weights = np.ones_like(distr)/float(len(distr)) | |
| # custom binning (just an example with 0.1) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import calendar | |
| import pandas as pd | |
| [...] | |
| df["day_of_the_week"] = pd.Categorical(df["day_of_the_week"], list(calendar.day_abbr)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| hm = hv.HeatMap(((x_names, y_names, od_pivot))) | |
| hm = hm.opts(plot={"xrotation": 90}) | |
| #Other axis options | |
| # 'logy': True | |
| # 'yaxis': None | |
| # 'xrotation': 90} | |
| # 'xticks': 3 | |
| # 'xticks': [0, 100, 300, 500] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import holoviews as hv | |
| import numpy as np | |
| hv.extension('bokeh') | |
| hv.DynamicMap(lambda i: hv.Curve(np.arange(i)), kdims=['i']).redim.range(i=((10, 20))).opts(norm=dict(framewise=True)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| %%opts Histogram [invert_axes=True] | |
| # note that this is different from invert_xaxis, which reverses an axes | |
| # invert_axes, instead, will swap X and Y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| points = points << hv.Spikes(points['y']) << hv.Spikes(points['x']) |