1 Import and Handling Data - Jupyter Notebook
1 Import and Handling Data - Jupyter Notebook
In [2]: import os
In [4]: os.getcwd()
In [6]: import os # OS module provides a way of using operating system dependent function
import pandas as pd
os.chdir("C:\\Users\\rgandyala\\4 Data processing and Stats")
In [5]: # Now place the data set in working directory and use below code to import the da
In [8]: csv1
...
In [7]: # if working directory is not set we can access the data directly from any folder
...
In [26]: data
#filename['columnname']
...
Out[47]: 10
...
...
In [24]: data.tail() # Displays last 6 rows - we can mention the required row numbers
#data.tail(4)
Out[28]: (10, 4)
...
...
...
Data Selection
.loc() which is for label based indexing - can search value based on values
.iloc() which is for integer based - can search value based on indexing
syntax - file[row,columns]
In [29]: data
...
In [35]: data.loc[data["Purchased"]=="Yes"]
...
In [30]: data
...
In [38]: X
...
In [39]: # To identiy the missing values - True means we have missing values in Data
In [40]: data.isnull()
...
...
2 30.0 54000.0 No
3 38.0 61000.0 No
6 NaN 52000.0 No
8 50.0 83000.0 No
In [57]: data
...
In [74]: data
...
In [78]: data
...
In [80]: data
...
In [ ]: