Loading CSV Data From Files
Loading CSV data from files The pandas livrary provides built-in support for loading data in .csv format
import pandas as pd
df = pd.read_csv('data/weather.csv')
df
MinTemp | MaxTemp | Rainfall | Evaporation | Sunshine | WindGustDir | WindGustSpeed | WindDir9am | WindDir3pm | WindSpeed9am | ... | Humidity3pm | Pressure9am | Pressure3pm | Cloud9am | Cloud3pm | Temp9am | Temp3pm | RainToday | RISK_MM | RainTomorrow | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 8.0 | 24.3 | 0.0 | 3.4 | 6.3 | NW | 30.0 | SW | NW | 6.0 | ... | 29 | 1019.7 | 1015.0 | 7 | 7 | 14.4 | 23.6 | No | 3.6 | Yes |
1 | 14.0 | 26.9 | 3.6 | 4.4 | 9.7 | ENE | 39.0 | E | W | 4.0 | ... | 36 | 1012.4 | 1008.4 | 5 | 3 | 17.5 | 25.7 | Yes | 3.6 | Yes |
2 | 13.7 | 23.4 | 3.6 | 5.8 | 3.3 | NW | 85.0 | N | NNE | 6.0 | ... | 69 | 1009.5 | 1007.2 | 8 | 7 | 15.4 | 20.2 | Yes | 39.8 | Yes |
3 | 13.3 | 15.5 | 39.8 | 7.2 | 9.1 | NW | 54.0 | WNW | W | 30.0 | ... | 56 | 1005.5 | 1007.0 | 2 | 7 | 13.5 | 14.1 | Yes | 2.8 | Yes |
4 | 7.6 | 16.1 | 2.8 | 5.6 | 10.6 | SSE | 50.0 | SSE | ESE | 20.0 | ... | 49 | 1018.3 | 1018.5 | 7 | 7 | 11.1 | 15.4 | Yes | 0.0 | No |
5 | 6.2 | 16.9 | 0.0 | 5.8 | 8.2 | SE | 44.0 | SE | E | 20.0 | ... | 57 | 1023.8 | 1021.7 | 7 | 5 | 10.9 | 14.8 | No | 0.2 | No |
6 | 6.1 | 18.2 | 0.2 | 4.2 | 8.4 | SE | 43.0 | SE | ESE | 19.0 | ... | 47 | 1024.6 | 1022.2 | 4 | 6 | 12.4 | 17.3 | No | 0.0 | No |
7 | 8.3 | 17.0 | 0.0 | 5.6 | 4.6 | E | 41.0 | SE | E | 11.0 | ... | 57 | 1026.2 | 1024.2 | 6 | 7 | 12.1 | 15.5 | No | 0.0 | No |
8 | 8.8 | 19.5 | 0.0 | 4.0 | 4.1 | S | 48.0 | E | ENE | 19.0 | ... | 48 | 1026.1 | 1022.7 | 7 | 7 | 14.1 | 18.9 | No | 16.2 | Yes |
9 | 8.4 | 22.8 | 16.2 | 5.4 | 7.7 | E | 31.0 | S | ESE | 7.0 | ... | 32 | 1024.1 | 1020.7 | 7 | 1 | 13.3 | 21.7 | Yes | 0.0 | No |
10 | 9.1 | 25.2 | 0.0 | 4.2 | 11.9 | N | 30.0 | SE | NW | 6.0 | ... | 34 | 1024.4 | 1021.1 | 1 | 2 | 14.6 | 24.0 | No | 0.2 | No |
11 | 8.5 | 27.3 | 0.2 | 7.2 | 12.5 | E | 41.0 | E | NW | 2.0 | ... | 35 | 1023.8 | 1019.9 | 0 | 3 | 16.8 | 26.0 | No | 0.0 | No |
12 | 10.1 | 27.9 | 0.0 | 7.2 | 13.0 | WNW | 30.0 | S | NW | 6.0 | ... | 29 | 1022.0 | 1017.1 | 0 | 1 | 17.0 | 27.1 | No | 0.0 | No |
13 | 12.1 | 30.9 | 0.0 | 6.2 | 12.4 | NW | 44.0 | WNW | W | 7.0 | ... | 20 | 1017.3 | 1013.1 | 1 | 4 | 19.7 | 30.7 | No | 0.0 | No |
14 | 10.1 | 31.2 | 0.0 | 8.8 | 13.1 | NW | 41.0 | S | W | 6.0 | ... | 16 | 1018.2 | 1013.7 | 0 | 1 | 18.7 | 30.4 | No | 0.0 | No |
15 | 12.4 | 32.1 | 0.0 | 8.4 | 11.1 | E | 46.0 | SE | WSW | 7.0 | ... | 22 | 1017.9 | 1012.8 | 0 | 3 | 19.1 | 30.7 | No | 0.0 | No |
16 | 13.8 | 31.2 | 0.0 | 7.2 | 8.4 | ESE | 44.0 | WSW | W | 6.0 | ... | 23 | 1014.4 | 1009.8 | 7 | 6 | 20.2 | 29.8 | No | 1.2 | Yes |
17 | 11.7 | 30.0 | 1.2 | 7.2 | 10.1 | S | 52.0 | SW | NE | 6.0 | ... | 26 | 1016.4 | 1013.0 | 1 | 5 | 20.1 | 28.6 | Yes | 0.6 | No |
18 | 12.4 | 32.3 | 0.6 | 7.4 | 13.0 | E | 39.0 | NNE | W | 4.0 | ... | 25 | 1017.1 | 1013.3 | 1 | 3 | 20.2 | 31.2 | No | 0.0 | No |
19 | 15.6 | 33.4 | 0.0 | 8.0 | 10.4 | NE | 33.0 | NNW | NNW | 2.0 | ... | 27 | 1018.5 | 1013.7 | 0 | 1 | 22.8 | 32.0 | No | 0.0 | No |
20 | 15.3 | 33.4 | 0.0 | 8.8 | 9.5 | WNW | 59.0 | N | NW | 2.0 | ... | 26 | 1012.4 | 1006.5 | 1 | 5 | 22.2 | 32.8 | No | 0.4 | No |
21 | 16.4 | 19.4 | 0.4 | 9.2 | 0.0 | E | 26.0 | ENE | E | 6.0 | ... | 72 | 1010.7 | 1008.9 | 8 | 8 | 16.5 | 18.3 | No | 25.8 | Yes |
22 | 12.8 | 18.5 | 25.8 | 2.8 | 0.6 | ESE | 28.0 | S | SE | 13.0 | ... | 79 | 1014.0 | 1014.9 | 8 | 8 | 14.0 | 16.8 | Yes | 0.4 | No |
23 | 12.0 | 24.3 | 0.4 | 1.2 | 7.5 | NNE | 26.0 | WSW | NE | 6.0 | ... | 57 | 1020.7 | 1019.2 | 7 | 5 | 17.8 | 22.8 | No | 0.0 | No |
24 | 15.4 | 28.4 | 0.0 | 4.4 | 8.1 | ENE | 33.0 | SSE | NE | 9.0 | ... | 31 | 1022.4 | 1018.6 | 8 | 2 | 16.8 | 27.3 | No | 0.0 | No |
25 | 15.6 | 26.9 | 0.0 | 6.8 | 8.9 | E | 41.0 | E | E | 6.0 | ... | 48 | 1019.7 | 1016.5 | 2 | 4 | 19.8 | 25.1 | No | 0.2 | No |
26 | 13.3 | 22.2 | 0.2 | 6.6 | 2.3 | ENE | 39.0 | E | E | 20.0 | ... | 55 | 1021.0 | 1018.6 | 7 | 7 | 16.5 | 21.2 | No | 0.0 | No |
27 | 12.9 | 28.0 | 0.0 | 4.4 | 10.7 | S | 52.0 | S | NNE | 6.0 | ... | 31 | 1019.2 | 1014.8 | 5 | 7 | 18.8 | 26.7 | No | 0.0 | No |
28 | 15.1 | 24.3 | 0.0 | 7.0 | 0.4 | SE | 39.0 | SE | SE | 7.0 | ... | 80 | 1019.0 | 1017.1 | 7 | 7 | 18.9 | 19.7 | No | 0.4 | No |
29 | 13.6 | 24.1 | 0.4 | 2.6 | 0.5 | NNW | 30.0 | SSW | S | 6.0 | ... | 49 | 1017.2 | 1013.3 | 8 | 7 | 17.3 | 23.2 | No | 22.6 | Yes |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
336 | 5.6 | 27.6 | 0.0 | 5.2 | 11.0 | NW | 46.0 | NNW | NW | 15.0 | ... | 21 | 1017.7 | 1014.1 | 0 | 0 | 19.0 | 26.7 | No | 0.0 | No |
337 | 16.8 | 28.9 | 0.0 | 10.0 | 10.8 | NNW | 70.0 | NW | NW | 31.0 | ... | 22 | 1016.3 | 1011.8 | 1 | 1 | 22.5 | 28.4 | No | 7.6 | Yes |
338 | 14.4 | 20.7 | 7.6 | 9.4 | 4.9 | NNW | 33.0 | NNW | NNW | 20.0 | ... | 65 | 1015.5 | 1013.2 | 8 | 4 | 14.5 | 19.3 | Yes | 3.0 | Yes |
339 | 10.3 | 21.3 | 3.0 | 4.2 | 6.7 | NNW | 43.0 | ENE | N | 7.0 | ... | 46 | 1018.1 | 1013.6 | 8 | 1 | 11.7 | 19.8 | Yes | 0.0 | No |
340 | 11.2 | 18.0 | 0.0 | 4.8 | 8.4 | W | 65.0 | N | W | 24.0 | ... | 40 | 1009.5 | 1005.3 | 5 | 4 | 12.8 | 16.2 | No | 8.2 | Yes |
341 | 0.3 | 16.0 | 8.2 | 5.4 | 11.8 | NW | 57.0 | NNW | N | 11.0 | ... | 45 | 1016.8 | 1013.3 | 1 | 1 | 6.9 | 14.6 | Yes | 0.0 | No |
342 | 0.5 | 17.9 | 0.0 | 5.8 | 11.5 | N | 44.0 | NNE | NNW | 2.0 | ... | 33 | 1019.1 | 1017.5 | 0 | 1 | 7.2 | 16.6 | No | 0.0 | No |
343 | 0.5 | 20.0 | 0.0 | 6.2 | 11.5 | NNW | 31.0 | S | N | 2.0 | ... | 22 | 1026.2 | 1024.2 | 0 | 1 | 8.1 | 18.8 | No | 0.0 | No |
344 | 4.6 | 22.0 | 0.0 | 4.4 | 11.0 | N | 41.0 | NNW | N | 6.0 | ... | 25 | 1028.8 | 1024.9 | 1 | 2 | 10.0 | 21.4 | No | 0.0 | No |
345 | 8.2 | 22.4 | 0.0 | 5.4 | 11.2 | NW | 31.0 | SSW | NW | 2.0 | ... | 30 | 1027.8 | 1023.8 | 1 | 3 | 13.6 | 20.6 | No | 0.0 | No |
346 | 4.5 | 23.9 | 0.0 | 4.8 | 11.7 | NW | 30.0 | ENE | NNW | 4.0 | ... | 27 | 1025.8 | 1021.5 | 0 | 4 | 12.6 | 22.3 | No | 0.0 | No |
347 | 6.7 | 26.1 | 0.0 | 6.2 | 7.5 | SSW | 70.0 | NE | NNW | 6.0 | ... | 47 | 1020.9 | 1016.0 | 4 | 7 | 16.3 | 23.2 | No | 13.2 | Yes |
348 | 11.9 | 21.1 | 13.2 | 6.6 | NaN | NW | 41.0 | NNE | N | 7.0 | ... | 61 | 1019.2 | 1016.7 | 7 | 3 | 14.5 | 19.4 | Yes | 0.6 | No |
349 | 9.2 | 19.6 | 0.6 | 3.4 | 10.4 | ENE | 31.0 | SSE | NNW | 4.0 | ... | 42 | 1022.3 | 1019.7 | 7 | 4 | 11.6 | 18.4 | No | 0.0 | No |
350 | 4.4 | 21.0 | 0.0 | 4.2 | 12.2 | NW | 28.0 | SW | NW | 2.0 | ... | 30 | 1025.7 | 1022.3 | 1 | 1 | 9.6 | 19.2 | No | 0.0 | No |
351 | 5.0 | 24.1 | 0.0 | 6.2 | 12.0 | NNW | 52.0 | NaN | NNW | 0.0 | ... | 34 | 1024.5 | 1020.7 | 6 | 1 | 11.6 | 21.9 | No | 0.0 | No |
352 | 6.7 | 24.7 | 0.0 | 5.4 | 8.6 | NW | 43.0 | N | NW | 4.0 | ... | 31 | 1025.7 | 1022.2 | 1 | 7 | 12.7 | 23.7 | No | 0.0 | No |
353 | 8.3 | 28.5 | 0.0 | 5.8 | 9.8 | NW | 46.0 | W | NW | 2.0 | ... | 30 | 1024.1 | 1019.8 | 1 | 6 | 16.8 | 27.4 | No | 0.2 | No |
354 | 11.3 | 27.4 | 0.2 | 7.6 | 12.1 | NW | 52.0 | SE | NW | 6.0 | ... | 20 | 1021.4 | 1017.5 | 1 | 1 | 16.4 | 26.3 | No | 0.0 | No |
355 | 9.0 | 20.6 | 0.0 | 9.0 | 6.2 | ENE | 39.0 | S | SW | 11.0 | ... | 28 | 1022.3 | 1018.6 | 7 | 5 | 11.4 | 18.5 | No | 0.8 | No |
356 | 3.4 | 15.0 | 0.8 | 4.8 | 11.7 | S | 70.0 | S | S | 35.0 | ... | 24 | 1023.4 | 1023.1 | 1 | 5 | 8.3 | 14.3 | No | 0.0 | No |
357 | 3.2 | 18.0 | 0.0 | 7.4 | 12.2 | SSE | 48.0 | SSE | S | 26.0 | ... | 25 | 1026.6 | 1022.8 | 1 | 2 | 9.1 | 16.3 | No | 0.0 | No |
358 | 0.9 | 20.7 | 0.0 | 5.4 | 8.4 | NNW | 39.0 | SSE | N | 2.0 | ... | 29 | 1023.2 | 1018.4 | 3 | 8 | 9.4 | 19.1 | No | 0.0 | No |
359 | 3.3 | 25.5 | 0.0 | 5.2 | 10.8 | N | 43.0 | N | NNW | 4.0 | ... | 16 | 1018.8 | 1014.6 | 0 | 3 | 12.0 | 24.8 | No | 0.0 | No |
360 | 7.9 | 26.1 | 0.0 | 6.8 | 3.5 | NNW | 43.0 | NaN | WNW | 0.0 | ... | 20 | 1017.6 | 1014.2 | 5 | 8 | 16.3 | 25.9 | No | 0.0 | No |
361 | 9.0 | 30.7 | 0.0 | 7.6 | 12.1 | NNW | 76.0 | SSE | NW | 7.0 | ... | 15 | 1016.1 | 1010.8 | 1 | 3 | 20.4 | 30.0 | No | 0.0 | No |
362 | 7.1 | 28.4 | 0.0 | 11.6 | 12.7 | N | 48.0 | NNW | NNW | 2.0 | ... | 22 | 1020.0 | 1016.9 | 0 | 1 | 17.2 | 28.2 | No | 0.0 | No |
363 | 12.5 | 19.9 | 0.0 | 8.4 | 5.3 | ESE | 43.0 | ENE | ENE | 11.0 | ... | 47 | 1024.0 | 1022.8 | 3 | 2 | 14.5 | 18.3 | No | 0.0 | No |
364 | 12.5 | 26.9 | 0.0 | 5.0 | 7.1 | NW | 46.0 | SSW | WNW | 6.0 | ... | 39 | 1021.0 | 1016.2 | 6 | 7 | 15.8 | 25.9 | No | 0.0 | No |
365 | 12.3 | 30.2 | 0.0 | 6.0 | 12.6 | NW | 78.0 | NW | WNW | 31.0 | ... | 13 | 1009.6 | 1009.2 | 1 | 1 | 23.8 | 28.6 | No | 0.0 | No |
366 rows × 22 columns
# the contents of the MinTemp column
df.MinTemp
0 8.0
1 14.0
2 13.7
3 13.3
4 7.6
5 6.2
6 6.1
7 8.3
8 8.8
9 8.4
10 9.1
11 8.5
12 10.1
13 12.1
14 10.1
15 12.4
16 13.8
17 11.7
18 12.4
19 15.6
20 15.3
21 16.4
22 12.8
23 12.0
24 15.4
25 15.6
26 13.3
27 12.9
28 15.1
29 13.6
...
336 5.6
337 16.8
338 14.4
339 10.3
340 11.2
341 0.3
342 0.5
343 0.5
344 4.6
345 8.2
346 4.5
347 6.7
348 11.9
349 9.2
350 4.4
351 5.0
352 6.7
353 8.3
354 11.3
355 9.0
356 3.4
357 3.2
358 0.9
359 3.3
360 7.9
361 9.0
362 7.1
363 12.5
364 12.5
365 12.3
Name: MinTemp, Length: 366, dtype: float64
# we can get the first value in the MinTemp column
df.MinTemp[0]
8.0
# it is a float
type(df.MinTemp[0])
numpy.float64