Created
September 6, 2020 13:07
-
-
Save giswqs/1f163dd08a94728adf3b8a91bb8be262 to your computer and use it in GitHub Desktop.
pandas alive
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
{ | |
"cells": [ | |
{ | |
"metadata": { | |
"trusted": true | |
}, | |
"cell_type": "code", | |
"source": "import pandas_alive", | |
"execution_count": 1, | |
"outputs": [] | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "Download sample data from https://github.com/JackMcKew/pandas_alive/blob/main/data/covid19.csv" | |
}, | |
{ | |
"metadata": { | |
"trusted": true | |
}, | |
"cell_type": "code", | |
"source": "covid_df = pandas_alive.load_dataset()", | |
"execution_count": 2, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true | |
}, | |
"cell_type": "code", | |
"source": "covid_df.plot_animated(filename='covid.mp4')", | |
"execution_count": 3, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"text": "Generating BarChartRace, plotting ['Belgium', 'Brazil', 'Canada', 'China', 'France', 'Germany', 'India', 'Indonesia', 'Iran', 'Ireland', 'Italy', 'Mexico', 'Netherlands', 'Portugal', 'Spain', 'Sweden', 'Switzerland', 'Turkey', 'USA', 'United Kingdom']\n", | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "stream", | |
"text": "/home/qiusheng/.conda/envs/geemap/lib/python3.8/site-packages/pandas_alive/charts.py:221: UserWarning: FixedFormatter should only be used together with FixedLocator\n ax.set_yticklabels(self.df.columns)\n/home/qiusheng/.conda/envs/geemap/lib/python3.8/site-packages/pandas_alive/charts.py:222: UserWarning: FixedFormatter should only be used together with FixedLocator\n ax.set_xticklabels([max_val] * len(ax.get_xticks()))\n/home/qiusheng/.conda/envs/geemap/lib/python3.8/site-packages/pandas_alive/charts.py:68: UserWarning: Plotting too many bars may result in undesirable output, use `n_visible=5 to limit number of bars\n warnings.warn(\n", | |
"name": "stderr" | |
}, | |
{ | |
"output_type": "execute_result", | |
"execution_count": 3, | |
"data": { | |
"text/plain": "BarChartRace(df= Belgium Brazil Canada China France Germany India \\\ndate \n2020-02-26 00:00:00 NaN NaN NaN 2717.0 2.0 NaN NaN \n2020-02-26 02:24:00 NaN NaN NaN 2719.9 2.0 NaN NaN \n2020-02-26 04:48:00 NaN NaN NaN 2722.8 2.0 NaN NaN \n2020-02-26 07:12:00 NaN NaN NaN 2725.7 2.0 NaN NaN \n2020-02-26 09:36:00 NaN NaN NaN 2728.6 2.0 NaN NaN \n... ... ... ... ... ... ... ... \n2020-04-21 14:24:00 6156.4 2840.0 2008.2 4636.0 21155.4 5180.6 666.6 \n2020-04-21 16:48:00 6182.8 2856.5 2024.9 4636.0 21209.8 5205.2 670.2 \n2020-04-21 19:12:00 6209.2 2873.0 2041.6 4636.0 21264.2 5229.8 673.8 \n2020-04-21 21:36:00 6235.6 2889.5 2058.3 4636.0 21318.6 5254.4 677.4 \n2020-04-22 00:00:00 6262.0 2906.0 2075.0 4636.0 21373.0 5279.0 681.0 \n\n Indonesia Iran Ireland Italy Mexico Netherlands \\\ndate \n2020-02-26 00:00:00 NaN 19.0 NaN 12.0 NaN NaN \n2020-02-26 02:24:00 NaN 19.7 NaN 12.5 NaN NaN \n2020-02-26 04:48:00 NaN 20.4 NaN 13.0 NaN NaN \n2020-02-26 07:12:00 NaN 21.1 NaN 13.5 NaN NaN \n2020-02-26 09:36:00 NaN 21.8 NaN 14.0 NaN NaN \n... ... ... ... ... ... ... \n2020-04-21 14:24:00 627.4 5353.4 753.4 24910.2 799.0 4012.4 \n2020-04-21 16:48:00 629.3 5362.8 757.3 24953.9 813.5 4026.3 \n2020-04-21 19:12:00 631.2 5372.2 761.2 24997.6 828.0 4040.2 \n2020-04-21 21:36:00 633.1 5381.6 765.1 25041.3 842.5 4054.1 \n2020-04-22 00:00:00 635.0 5391.0 769.0 25085.0 857.0 4068.0 \n\n Portugal Spain Sweden Switzerland Turkey USA \\\ndate \n2020-02-26 00:00:00 NaN NaN NaN NaN NaN NaN \n2020-02-26 02:24:00 NaN NaN NaN NaN NaN NaN \n2020-02-26 04:48:00 NaN NaN NaN NaN NaN NaN \n2020-02-26 07:12:00 NaN NaN NaN NaN NaN NaN \n2020-02-26 09:36:00 NaN NaN NaN NaN NaN NaN \n... ... ... ... ... ... ... \n2020-04-21 14:24:00 775.8 21543.0 1868.2 1496.6 2329.2 45755.6 \n2020-04-21 16:48:00 778.1 21586.5 1885.4 1499.7 2340.9 45973.7 \n2020-04-21 19:12:00 780.4 21630.0 1902.6 1502.8 2352.6 46191.8 \n2020-04-21 21:36:00 782.7 21673.5 1919.8 1505.9 2364.3 46409.9 \n2020-04-22 00:00:00 785.0 21717.0 1937.0 1509.0 2376.0 46628.0 \n\n United Kingdom \ndate \n2020-02-26 00:00:00 NaN \n2020-02-26 02:24:00 NaN \n2020-02-26 04:48:00 NaN \n2020-02-26 07:12:00 NaN \n2020-02-26 09:36:00 NaN \n... ... \n2020-04-21 14:24:00 17841.8 \n2020-04-21 16:48:00 17919.1 \n2020-04-21 19:12:00 17996.4 \n2020-04-21 21:36:00 18073.7 \n2020-04-22 00:00:00 18151.0 \n\n[561 rows x 20 columns], interpolate_period=True, steps_per_period=10, period_length=500, period_fmt='%d/%m/%Y', figsize=array([7.18229167, 3.5 ]), title=None, fig=<Figure size 1034x504 with 1 Axes>, cmap='dark24', tick_label_size=7, period_label=True, period_summary_func=None, fixed_max=False, dpi=144, writer=None, enable_progress_bar=False, kwargs={}, orientation='h', sort='desc', label_bars=True, bar_label_size=7, n_visible=20, fixed_order=False, perpendicular_bar_func=None)" | |
}, | |
"metadata": {} | |
} | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"name": "python3", | |
"display_name": "Python 3", | |
"language": "python" | |
}, | |
"hide_input": false, | |
"varInspector": { | |
"window_display": false, | |
"cols": { | |
"lenName": 16, | |
"lenType": 16, | |
"lenVar": 40 | |
}, | |
"kernels_config": { | |
"python": { | |
"library": "var_list.py", | |
"delete_cmd_prefix": "del ", | |
"delete_cmd_postfix": "", | |
"varRefreshCmd": "print(var_dic_list())" | |
}, | |
"r": { | |
"library": "var_list.r", | |
"delete_cmd_prefix": "rm(", | |
"delete_cmd_postfix": ") ", | |
"varRefreshCmd": "cat(var_dic_list()) " | |
} | |
}, | |
"types_to_exclude": [ | |
"module", | |
"function", | |
"builtin_function_or_method", | |
"instance", | |
"_Feature" | |
] | |
}, | |
"toc": { | |
"nav_menu": {}, | |
"number_sections": true, | |
"sideBar": true, | |
"skip_h1_title": true, | |
"base_numbering": 1, | |
"title_cell": "Table of Contents", | |
"title_sidebar": "Table of Contents", | |
"toc_cell": false, | |
"toc_position": {}, | |
"toc_section_display": true, | |
"toc_window_display": true | |
}, | |
"language_info": { | |
"name": "python", | |
"version": "3.8.2", | |
"mimetype": "text/x-python", | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"pygments_lexer": "ipython3", | |
"nbconvert_exporter": "python", | |
"file_extension": ".py" | |
}, | |
"gist": { | |
"id": "", | |
"data": { | |
"description": "pandas alive", | |
"public": true | |
} | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 4 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment