676 Rows × 17 Columns: Import As
676 Rows × 17 Columns: Import As
import pandas as pd
pandas.core.frame.DataFrame
Out[2]:
Out[3]: date mean_temperature max_temperature min_temperature Mean_dew_pt mean_pressure max_humidity min_humidity max_dew_pt_1
2016-
0 34 41 27 6 1006.00 27 5 12
05-04
2016-
1 31 38 24 7 1005.65 29 6 13
05-05
2016-
2 28 34 21 11 1007.94 61 13 16
05-06
2016-
3 30 38 23 13 1008.39 69 18 17
05-07
2016-
4 34 41 26 10 1007.62 50 8 14
05-08
... ... ... ... ... ... ... ... ... ...
2018-
671 24 32 15 4 1015.39 48 6 9
03-07
2018-
672 24 32 15 2 1014.07 55 5 8
03-08
2018-
673 26 33 19 1 1014.41 42 7 5
03-09
2018-
674 26 34 19 3 1014.16 37 8 6
03-10
2018-
675 26 34 18 4 1013.76 38 6 8
03-11
In [4]: #To access first 5 rows of data from the Jaipur csv file
print(df.head())
In [5]: #To access first 5 rows of data from the Jaipur csv file
print(df.head())
In [6]: # To find out the type of data (i.e., string, float, integer)
df.dtypes
date object
Out[6]:
mean_temperature int64
max_temperature int64
min_temperature int64
Mean_dew_pt int64
mean_pressure float64
max_humidity int64
min_humidity int64
max_dew_pt_1 int64
max_dew_pt_2 int64
min_dew_pt_1 int64
min_dew_pt_2 int64
max_pressure_1 int64
max_pressure_2 int64
min_pressure_1 int64
min_pressure_2 int64
rainfall float64
dtype: object
In [10]: df.dtypes
date object
Out[10]:
mean_temperature int64
max_temperature int64
min_temperature int64
Mean_dew_pt int64
mean_pressure float64
max_humidity int64
min_humidity int64
max_dew_pt_1 int64
min_dew_pt_1 int64
min_dew_pt_2 int64
max_pressure_1 int64
max_pressure_2 int64
min_pressure_1 int64
min_pressure_2 int64
rainfall float64
dtype: object
In [12]: print(df.head())
min_pressure_2 rainfall
0 1001 0.0
2 1001 5.0
3 1003 0.0
4 1004 0.0
5 1002 0.0
In [14]: # To Sort the values in descending order of date and print the first 5 rows
jaipur_weather = df.sort_values(by='date',ascending = False)
print(jaipur_weather.head())
In [15]: # To Sort the values in ascending order of mean temperature and print the first 5 rows
jaipur_weather = df.sort_values(by='mean_temperature',ascending = True)
print(jaipur_weather.head())
(array([ 0, 60, 120, 180, 240, 300, 360, 420, 480, 540, 600, 660]),
Out[17]:
[Text(0, 0, ''),
Text(0, 0, ''),
Text(0, 0, ''),
Text(0, 0, ''),
Text(0, 0, ''),
Text(0, 0, ''),
Text(0, 0, ''),
Text(0, 0, ''),
Text(0, 0, ''),
Text(0, 0, ''),
Text(0, 0, ''),
Text(0, 0, '')])
(5655, 3770, 3)
(5655, 3770)
True
Out[8]:
(5655, 3770, 3)
(1413, 942, 3)