pyqt_data_analysis/data_show.ipynb

301 lines
10 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"id": "initial_id",
"metadata": {
"collapsed": true,
"ExecuteTime": {
"end_time": "2024-06-08T09:52:47.287637Z",
"start_time": "2024-06-08T09:52:46.348111Z"
}
},
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import pandas as pd"
],
"outputs": [],
"execution_count": 1
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2024-06-08T09:53:28.061215Z",
"start_time": "2024-06-08T09:53:28.039931Z"
}
},
"cell_type": "code",
"source": [
"df = pd.read_csv(\"./data/world-happiness-report-2017.csv\")\n",
"df.head(10)"
],
"id": "613252be66c5c97d",
"outputs": [
{
"data": {
"text/plain": [
" Country Happiness.Rank Happiness.Score Whisker.high Whisker.low \\\n",
"0 Norway 1 7.537 7.594445 7.479556 \n",
"1 Denmark 2 7.522 7.581728 7.462272 \n",
"2 Iceland 3 7.504 7.622030 7.385970 \n",
"3 Switzerland 4 7.494 7.561772 7.426227 \n",
"4 Finland 5 7.469 7.527542 7.410458 \n",
"5 Netherlands 6 7.377 7.427426 7.326574 \n",
"6 Canada 7 7.316 7.384403 7.247597 \n",
"7 New Zealand 8 7.314 7.379510 7.248490 \n",
"8 Sweden 9 7.284 7.344095 7.223905 \n",
"9 Australia 10 7.284 7.356651 7.211349 \n",
"\n",
" Economy..GDP.per.Capita. Family Health..Life.Expectancy. Freedom \\\n",
"0 1.616463 1.533524 0.796667 0.635423 \n",
"1 1.482383 1.551122 0.792566 0.626007 \n",
"2 1.480633 1.610574 0.833552 0.627163 \n",
"3 1.564980 1.516912 0.858131 0.620071 \n",
"4 1.443572 1.540247 0.809158 0.617951 \n",
"5 1.503945 1.428939 0.810696 0.585384 \n",
"6 1.479204 1.481349 0.834558 0.611101 \n",
"7 1.405706 1.548195 0.816760 0.614062 \n",
"8 1.494387 1.478162 0.830875 0.612924 \n",
"9 1.484415 1.510042 0.843887 0.601607 \n",
"\n",
" Generosity Trust..Government.Corruption. Dystopia.Residual \n",
"0 0.362012 0.315964 2.277027 \n",
"1 0.355280 0.400770 2.313707 \n",
"2 0.475540 0.153527 2.322715 \n",
"3 0.290549 0.367007 2.276716 \n",
"4 0.245483 0.382612 2.430182 \n",
"5 0.470490 0.282662 2.294804 \n",
"6 0.435540 0.287372 2.187264 \n",
"7 0.500005 0.382817 2.046456 \n",
"8 0.385399 0.384399 2.097538 \n",
"9 0.477699 0.301184 2.065211 "
],
"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</th>\n",
" <th>Happiness.Rank</th>\n",
" <th>Happiness.Score</th>\n",
" <th>Whisker.high</th>\n",
" <th>Whisker.low</th>\n",
" <th>Economy..GDP.per.Capita.</th>\n",
" <th>Family</th>\n",
" <th>Health..Life.Expectancy.</th>\n",
" <th>Freedom</th>\n",
" <th>Generosity</th>\n",
" <th>Trust..Government.Corruption.</th>\n",
" <th>Dystopia.Residual</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Norway</td>\n",
" <td>1</td>\n",
" <td>7.537</td>\n",
" <td>7.594445</td>\n",
" <td>7.479556</td>\n",
" <td>1.616463</td>\n",
" <td>1.533524</td>\n",
" <td>0.796667</td>\n",
" <td>0.635423</td>\n",
" <td>0.362012</td>\n",
" <td>0.315964</td>\n",
" <td>2.277027</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Denmark</td>\n",
" <td>2</td>\n",
" <td>7.522</td>\n",
" <td>7.581728</td>\n",
" <td>7.462272</td>\n",
" <td>1.482383</td>\n",
" <td>1.551122</td>\n",
" <td>0.792566</td>\n",
" <td>0.626007</td>\n",
" <td>0.355280</td>\n",
" <td>0.400770</td>\n",
" <td>2.313707</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Iceland</td>\n",
" <td>3</td>\n",
" <td>7.504</td>\n",
" <td>7.622030</td>\n",
" <td>7.385970</td>\n",
" <td>1.480633</td>\n",
" <td>1.610574</td>\n",
" <td>0.833552</td>\n",
" <td>0.627163</td>\n",
" <td>0.475540</td>\n",
" <td>0.153527</td>\n",
" <td>2.322715</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Switzerland</td>\n",
" <td>4</td>\n",
" <td>7.494</td>\n",
" <td>7.561772</td>\n",
" <td>7.426227</td>\n",
" <td>1.564980</td>\n",
" <td>1.516912</td>\n",
" <td>0.858131</td>\n",
" <td>0.620071</td>\n",
" <td>0.290549</td>\n",
" <td>0.367007</td>\n",
" <td>2.276716</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Finland</td>\n",
" <td>5</td>\n",
" <td>7.469</td>\n",
" <td>7.527542</td>\n",
" <td>7.410458</td>\n",
" <td>1.443572</td>\n",
" <td>1.540247</td>\n",
" <td>0.809158</td>\n",
" <td>0.617951</td>\n",
" <td>0.245483</td>\n",
" <td>0.382612</td>\n",
" <td>2.430182</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>Netherlands</td>\n",
" <td>6</td>\n",
" <td>7.377</td>\n",
" <td>7.427426</td>\n",
" <td>7.326574</td>\n",
" <td>1.503945</td>\n",
" <td>1.428939</td>\n",
" <td>0.810696</td>\n",
" <td>0.585384</td>\n",
" <td>0.470490</td>\n",
" <td>0.282662</td>\n",
" <td>2.294804</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>Canada</td>\n",
" <td>7</td>\n",
" <td>7.316</td>\n",
" <td>7.384403</td>\n",
" <td>7.247597</td>\n",
" <td>1.479204</td>\n",
" <td>1.481349</td>\n",
" <td>0.834558</td>\n",
" <td>0.611101</td>\n",
" <td>0.435540</td>\n",
" <td>0.287372</td>\n",
" <td>2.187264</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>New Zealand</td>\n",
" <td>8</td>\n",
" <td>7.314</td>\n",
" <td>7.379510</td>\n",
" <td>7.248490</td>\n",
" <td>1.405706</td>\n",
" <td>1.548195</td>\n",
" <td>0.816760</td>\n",
" <td>0.614062</td>\n",
" <td>0.500005</td>\n",
" <td>0.382817</td>\n",
" <td>2.046456</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>Sweden</td>\n",
" <td>9</td>\n",
" <td>7.284</td>\n",
" <td>7.344095</td>\n",
" <td>7.223905</td>\n",
" <td>1.494387</td>\n",
" <td>1.478162</td>\n",
" <td>0.830875</td>\n",
" <td>0.612924</td>\n",
" <td>0.385399</td>\n",
" <td>0.384399</td>\n",
" <td>2.097538</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>Australia</td>\n",
" <td>10</td>\n",
" <td>7.284</td>\n",
" <td>7.356651</td>\n",
" <td>7.211349</td>\n",
" <td>1.484415</td>\n",
" <td>1.510042</td>\n",
" <td>0.843887</td>\n",
" <td>0.601607</td>\n",
" <td>0.477699</td>\n",
" <td>0.301184</td>\n",
" <td>2.065211</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"execution_count": 2
},
{
"metadata": {},
"cell_type": "code",
"outputs": [],
"execution_count": null,
"source": "",
"id": "3065eaa0832b900b"
}
],
"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": 5
}