-
Update the version in the setup.py file.
-
Run:
python3 setup.py sdist bdist_wheel. -
Run the following:
python setup.py sdist upload -r pypi.
Notice that this last command is deprecated. Use twine instead.
| import pandas as pd | |
| import matplotlib.pylab as plt | |
| import matplotlib.dates as mdates | |
| hours = mdates.HourLocator(interval = 1) | |
| h_d_fmt = mdates.DateFormatter('%d-%m %H:%M:%S') | |
| DATA_PATH = "/path/to/your/data" | |
| TMS_COL = "timestamp_column" | |
| COL_TO_PLOT = "column_to_plot" |
Update the version in the setup.py file.
Run:
python3 setup.py sdist bdist_wheel.
Run the following:
python setup.py sdist upload -r pypi.
Notice that this last command is deprecated. Use twine instead.
| # -*- coding: utf-8 -*- | |
| from functools import wraps | |
| import numpy as np | |
| from shapely import wkb | |
| def vectorize(**vectorize_kwargs): | |
| """ A (numpy) vectorizing decorator |
| # Inspired from here: https://stackoverflow.com/questions/17095101/outputting-difference-in-two-pandas-dataframes-side-by-side-highlighting-the-d | |
| def _show_dfs_difference(df1, df2): | |
| ne_stacked = (df1 != df2).stack() | |
| difference_locations = np.where(df1 != df2) | |
| changed = ne_stacked[ne_stacked] | |
| changed_from = df1.values[difference_locations] | |
| changed_to = df2.values[difference_locations] | |
| return pd.DataFrame({'from': changed_from, 'to': changed_to}, index=changed.index) |
| from shapely import wkb | |
| import numpy as np | |
| from functools import wraps | |
| def vectorize(**vectorize_kwargs): | |
| """ A (numpy) vectorizing decorator | |
| """ | |
| def _vectorize(func): | |
| @wraps(func) | |
| def wrapper(*args, **kwargs): |
| import pandas as pd | |
| import itertools | |
| import numpy as np | |
| # From here: https://pandas.pydata.org/pandas-docs/stable/cookbook.html#creating-example-data | |
| def expand_grid(data_dict): | |
| rows = itertools.product(*data_dict.values()) | |
| return pd.DataFrame.from_records(rows, columns=data_dict.keys()) |
| import geopandas as gpd | |
| import numpy as np | |
| # Set a seed for reproducibility | |
| np.random.seed(0) | |
| input_path = 'input/path/to/geojson' | |
| output_path = 'output/path/to/geojson' | |
| choices = [1, 2, 3] |
| import pandas as pd | |
| df = pd.DataFrame({'t': [1, 2, 3, 4, 5, 6], 'sid': [1, 1, 1, 2, 2, 2], 'time': [1, 2, 2, 2, 1, 1]}) | |
| hist_df = df.groupby(['sid', 'time']).t.value_counts(bins=[1, 2, 3, 10]).reset_index(name='counts') |
| import elo | |
| import pandas as pd | |
| from slacker import Slacker | |
| from tabulate import tabulate | |
| import emoji | |
| slack = Slacker('SLACK_API_KEY') # API key | |
| test = False | |
| game = True | |
| K_FACTOR = 40 |
| # Inspired from here: https://bokeh.pydata.org/en/latest/docs/user_guide/geo.html | |
| from bokeh.tile_providers import CARTODBPOSITRON | |
| from bokeh.io import output_file, show | |
| from bokeh.plotting import figure | |
| bound = 20000000 # meters | |
| fig = figure(tools='pan, wheel_zoom', x_range=(-bound, bound), y_range=(-bound, bound)) | |
| fig.axis.visible = False | |
| fig.add_tile(CARTODBPOSITRON) | |
| show(fig) |