Skip to content

Commit ec0b52f

Browse files
committed
Updated lesson 5 notebooks
1 parent 59c4f17 commit ec0b52f

7 files changed

+1110
-49
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Data file contents: Daily temperatures (mean, min, max) for Kumpula, Helsinki
2+
# for June 1-30, 2016
3+
# Data source: https://www.ncdc.noaa.gov/cdo-web/search?datasetid=GHCND
4+
# Data processing: Extracted temperatures from raw data file, converted to
5+
# comma-separated format
6+
#
7+
# David Whipp - 02.10.2017
8+
9+
YEARMODA,TEMP,MAX,MIN
10+
20160601,65.5,73.6,54.7
11+
20160602,65.8,80.8,55.0
12+
20160603,68.4,,55.6
13+
20160604,57.5,70.9,47.3
14+
20160605,51.4,58.3,43.2
15+
20160606,52.2,59.7,42.8
16+
20160607,56.9,65.1,45.9
17+
20160608,54.2,,47.5
18+
20160609,49.4,54.1,45.7
19+
20160610,49.5,55.9,43.0
20+
20160611,54.0,62.1,41.7
21+
20160612,55.4,64.2,46.0
22+
20160613,58.3,68.2,47.3
23+
20160614,59.7,67.8,47.8
24+
20160615,63.4,70.3,49.3
25+
20160616,57.8,67.5,55.6
26+
20160617,60.4,70.7,55.9
27+
20160618,57.3,,54.0
28+
20160619,56.3,59.2,54.1
29+
20160620,59.3,69.1,52.2
30+
20160621,62.6,71.4,50.4
31+
20160622,61.7,70.2,55.4
32+
20160623,60.9,67.1,54.9
33+
20160624,61.1,68.9,56.7
34+
20160625,65.7,75.4,57.9
35+
20160626,69.6,77.7,60.3
36+
20160627,60.7,70.0,
37+
20160628,65.4,73.0,55.8
38+
20160629,65.8,73.2,
39+
20160630,65.7,72.7,59.2

notebooks/L5/exploring-data-using-pandas.ipynb

Lines changed: 27 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"editable": true
7171
},
7272
"source": [
73-
"**Next, we'll read the input data file**, and store the contents of that file into a variable called `data` Using the `pandas.read_csv()` -function:"
73+
"**Next, we'll read the input data file**, and store the contents of that file into a variable called `data` Using the `pandas.read_csv()` function:"
7474
]
7575
},
7676
{
@@ -85,7 +85,9 @@
8585
}
8686
},
8787
"outputs": [],
88-
"source": []
88+
"source": [
89+
"# Read the file using pandas\n"
90+
]
8991
},
9092
{
9193
"cell_type": "markdown",
@@ -122,9 +124,7 @@
122124
}
123125
},
124126
"outputs": [],
125-
"source": [
126-
"print(data)"
127-
]
127+
"source": []
128128
},
129129
{
130130
"cell_type": "markdown",
@@ -303,13 +303,6 @@
303303
"No surprises here, our data variable is a Pandas DataFrame ;)."
304304
]
305305
},
306-
{
307-
"cell_type": "markdown",
308-
"metadata": {},
309-
"source": [
310-
"Check more details about available paramenters and methods from [the pandas.DataFrame documentation](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html#pandas-dataframe)."
311-
]
312-
},
313306
{
314307
"cell_type": "markdown",
315308
"metadata": {
@@ -340,8 +333,7 @@
340333
},
341334
"outputs": [],
342335
"source": [
343-
"# Display variable names:\n",
344-
"%who"
336+
"# Display variable names:\n"
345337
]
346338
},
347339
{
@@ -350,8 +342,7 @@
350342
"metadata": {},
351343
"outputs": [],
352344
"source": [
353-
"# Display variable name, type and info\n",
354-
"%whos"
345+
"# Display variable name, type and info\n"
355346
]
356347
},
357348
{
@@ -621,7 +612,9 @@
621612
}
622613
},
623614
"outputs": [],
624-
"source": []
615+
"source": [
616+
"# Check datatype of the column\n"
617+
]
625618
},
626619
{
627620
"cell_type": "markdown",
@@ -656,9 +649,7 @@
656649
"execution_count": null,
657650
"metadata": {},
658651
"outputs": [],
659-
"source": [
660-
"type(data.TEMP)"
661-
]
652+
"source": []
662653
},
663654
{
664655
"cell_type": "markdown",
@@ -768,9 +759,7 @@
768759
"execution_count": null,
769760
"metadata": {},
770761
"outputs": [],
771-
"source": [
772-
"%matplotlib inline"
773-
]
762+
"source": []
774763
},
775764
{
776765
"cell_type": "markdown",
@@ -784,9 +773,7 @@
784773
"execution_count": null,
785774
"metadata": {},
786775
"outputs": [],
787-
"source": [
788-
"data[[\"TEMP\", \"MAX\", \"MIN\"]].plot()"
789-
]
776+
"source": []
790777
},
791778
{
792779
"cell_type": "markdown",
@@ -827,9 +814,7 @@
827814
},
828815
"outputs": [],
829816
"source": [
830-
"# Create Pandas Series from a list\n",
831-
"number_series = pd.Series([ 4, 5, 6, 7.0])\n",
832-
"print(number_series)"
817+
"# Create Pandas Series from a list\n"
833818
]
834819
},
835820
{
@@ -854,19 +839,14 @@
854839
"execution_count": null,
855840
"metadata": {},
856841
"outputs": [],
857-
"source": [
858-
"number_series = pd.Series([ 4, 5, 6, 7.0], index=['a','b','c','d'])\n",
859-
"print(number_series)"
860-
]
842+
"source": []
861843
},
862844
{
863845
"cell_type": "code",
864846
"execution_count": null,
865847
"metadata": {},
866848
"outputs": [],
867-
"source": [
868-
"type(number_series)"
869-
]
849+
"source": []
870850
},
871851
{
872852
"cell_type": "markdown",
@@ -903,19 +883,14 @@
903883
"execution_count": null,
904884
"metadata": {},
905885
"outputs": [],
906-
"source": [
907-
"new_data = pd.DataFrame(data = {\"station_name\" : stations, \"lat\" : lats, \"lon\" : lons})\n",
908-
"new_data"
909-
]
886+
"source": []
910887
},
911888
{
912889
"cell_type": "code",
913890
"execution_count": null,
914891
"metadata": {},
915892
"outputs": [],
916-
"source": [
917-
"type(new_data)"
918-
]
893+
"source": []
919894
},
920895
{
921896
"cell_type": "markdown",
@@ -929,17 +904,20 @@
929904
"execution_count": null,
930905
"metadata": {},
931906
"outputs": [],
932-
"source": [
933-
"df = pd.DataFrame()"
934-
]
907+
"source": []
935908
},
936909
{
937910
"cell_type": "code",
938911
"execution_count": null,
939912
"metadata": {},
940913
"outputs": [],
914+
"source": []
915+
},
916+
{
917+
"cell_type": "markdown",
918+
"metadata": {},
941919
"source": [
942-
"print(df)"
920+
"Check more details about available paramenters and methods from [the pandas.DataFrame documentation](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html#pandas-dataframe)."
943921
]
944922
},
945923
{
@@ -956,7 +934,7 @@
956934
"metadata": {
957935
"anaconda-cloud": {},
958936
"kernelspec": {
959-
"display_name": "Python [default]",
937+
"display_name": "Python 3",
960938
"language": "python",
961939
"name": "python3"
962940
},
@@ -970,7 +948,7 @@
970948
"name": "python",
971949
"nbconvert_exporter": "python",
972950
"pygments_lexer": "ipython3",
973-
"version": "3.5.6"
951+
"version": "3.7.3"
974952
}
975953
},
976954
"nbformat": 4,
687 KB
Loading
151 KB
Loading
-218 KB
Binary file not shown.
-50.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)