-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jonescy
committed
Nov 18, 2020
0 parents
commit bf17528
Showing
35 changed files
with
17,150 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/pydata-book-2nd-edition/datasets/* filter=lfs diff=lfs merge=lfs -text |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# created by virtualenv automatically | ||
/.vscode/ | ||
/.idea/ | ||
/__pycache__/* |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Jupyter | ||
1)web版本的ipython | ||
2)编程,写文档,记笔记,数据展示 | ||
3).ipynb JSON文档格式 | ||
4)为什么使用要使用Jupyter NoteBook? | ||
交互式画图 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 9, | ||
"metadata": { | ||
"collapsed": true | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"import pandas as pd\n", | ||
"import numpy as np\n", | ||
"import matplotlib.pyplot as plt\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 42, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": " Country_code Country WHO_region New_cases \\\nDate_reported \n2020-02-24 AF Afghanistan EMRO 5 \n2020-02-25 AF Afghanistan EMRO 0 \n2020-02-26 AF Afghanistan EMRO 0 \n2020-02-27 AF Afghanistan EMRO 0 \n2020-02-28 AF Afghanistan EMRO 0 \n\n Cumulative_cases New_deaths Cumulative_deaths \nDate_reported \n2020-02-24 5 0 0 \n2020-02-25 5 0 0 \n2020-02-26 5 0 0 \n2020-02-27 5 0 0 \n2020-02-28 5 0 0 ", | ||
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>Country_code</th>\n <th>Country</th>\n <th>WHO_region</th>\n <th>New_cases</th>\n <th>Cumulative_cases</th>\n <th>New_deaths</th>\n <th>Cumulative_deaths</th>\n </tr>\n <tr>\n <th>Date_reported</th>\n <th></th>\n <th></th>\n <th></th>\n <th></th>\n <th></th>\n <th></th>\n <th></th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>2020-02-24</th>\n <td>AF</td>\n <td>Afghanistan</td>\n <td>EMRO</td>\n <td>5</td>\n <td>5</td>\n <td>0</td>\n <td>0</td>\n </tr>\n <tr>\n <th>2020-02-25</th>\n <td>AF</td>\n <td>Afghanistan</td>\n <td>EMRO</td>\n <td>0</td>\n <td>5</td>\n <td>0</td>\n <td>0</td>\n </tr>\n <tr>\n <th>2020-02-26</th>\n <td>AF</td>\n <td>Afghanistan</td>\n <td>EMRO</td>\n <td>0</td>\n <td>5</td>\n <td>0</td>\n <td>0</td>\n </tr>\n <tr>\n <th>2020-02-27</th>\n <td>AF</td>\n <td>Afghanistan</td>\n <td>EMRO</td>\n <td>0</td>\n <td>5</td>\n <td>0</td>\n <td>0</td>\n </tr>\n <tr>\n <th>2020-02-28</th>\n <td>AF</td>\n <td>Afghanistan</td>\n <td>EMRO</td>\n <td>0</td>\n <td>5</td>\n <td>0</td>\n <td>0</td>\n </tr>\n </tbody>\n</table>\n</div>" | ||
}, | ||
"execution_count": 42, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"path = r'c:/Users/jonescy/Downloads/WHO-COVID-19-global-data.csv'\n", | ||
"df = pd.read_csv(path,index_col='Date_reported')\n", | ||
"df.head()" | ||
], | ||
"metadata": { | ||
"collapsed": false, | ||
"pycharm": { | ||
"name": "#%%\n" | ||
} | ||
} | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 43, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": "<pandas.core.groupby.generic.DataFrameGroupBy object at 0x00000285EB0EE348>" | ||
}, | ||
"execution_count": 43, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"data = df.groupby('Country')\n", | ||
"\n", | ||
"data" | ||
], | ||
"metadata": { | ||
"collapsed": false, | ||
"pycharm": { | ||
"name": "#%%\n" | ||
} | ||
} | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 44, | ||
"outputs": [ | ||
{ | ||
"ename": "AttributeError", | ||
"evalue": "'DataFrameGroupBy' object has no attribute 'index'", | ||
"output_type": "error", | ||
"traceback": [ | ||
"\u001B[1;31m---------------------------------------------------------------------------\u001B[0m", | ||
"\u001B[1;31mAttributeError\u001B[0m Traceback (most recent call last)", | ||
"\u001B[1;32m<ipython-input-44-ce6f732eaab9>\u001B[0m in \u001B[0;36m<module>\u001B[1;34m\u001B[0m\n\u001B[1;32m----> 1\u001B[1;33m \u001B[0mdata\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mindex\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0m\u001B[0;32m 2\u001B[0m \u001B[1;33m\u001B[0m\u001B[0m\n", | ||
"\u001B[1;32mc:\\users\\jonescy\\onedrive\\文档\\pycharmprojects\\dataanalysis\\lib\\site-packages\\pandas\\core\\groupby\\groupby.py\u001B[0m in \u001B[0;36m__getattr__\u001B[1;34m(self, attr)\u001B[0m\n\u001B[0;32m 702\u001B[0m \u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0;32m 703\u001B[0m raise AttributeError(\n\u001B[1;32m--> 704\u001B[1;33m \u001B[1;34mf\"'{type(self).__name__}' object has no attribute '{attr}'\"\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0m\u001B[0;32m 705\u001B[0m )\n\u001B[0;32m 706\u001B[0m \u001B[1;33m\u001B[0m\u001B[0m\n", | ||
"\u001B[1;31mAttributeError\u001B[0m: 'DataFrameGroupBy' object has no attribute 'index'" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"data.index\n" | ||
], | ||
"metadata": { | ||
"collapsed": false, | ||
"pycharm": { | ||
"name": "#%%\n" | ||
} | ||
} | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 2 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython2", | ||
"version": "2.7.6" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
} |
Oops, something went wrong.