General FAQ’s
1. I got an error while running the below command to generate a series. Please help
me to resolve this error.
Ans: Please note that python is case-sensitive. Here you have used small “s” to call a
series. Please use pd.Series([1,2,3,4,5]) in-place of pd.series(([1,2,3,4,5]) in your
code and it will work fine.
[email protected]
X9IMGDQ0PO
2. Getting the below error while reading a csv file into Jupyter Notebook. Please help
me to resolve this issue.
Ans: Every file has some location where it is stored, we call it a pathname. So for
example, you have downloaded iris.csv. Now, it is in the downloads folder, however if
you want to read it in a Jupyter notebook you have to specify the complete path. Below
is the example for your reference:
Step 1:
To get the path of the file, Right click on the file name as shown below:
This file is meant for personal use by [email protected] only.
Sharing or publishing the contents in part or full is liable for legal action.
[email protected]X9IMGDQ0PO
Step 2:
Click Properties
This file is meant for personal use by [email protected] only.
Sharing or publishing the contents in part or full is liable for legal action.
Step 3:
Copy the path shown in front of location, & write filename with excel as shown below:
C:\Users\Downloads\Automobile.csv – this is the path of the file in my system.
However, in jupyter notebook we have to change the backslash to forward slash to read the file,
hence you have to write:
C:/Users/Downloads/ Automobile.csv
Finally you have to write the below mentioned code:
Import pandas as pd
Iris=pd.read_csv(“C:/Users/Downloads/ Automobile.csv”) # CSV file
Incase of Excel file, try using line of code mentioned below:
Iris_new=pd.read_excel(r’C:/Users/Downloads/iris.xlsx’) # Excel file
-----------------------------------------------------------Other way-------------------------------------------------
Change the current working directory
(set the path where your dataset is saved/downloaded)
import os
#set the directory path
os.chdir("path name as mentioned above without filename")
[email protected]X9IMGDQ0PO
#for example
os.chdir(“C:/Users/Downloads”)
this will become our default working directory now
# this will show the path of the directory, recently set
print("Current Working Directory " , os.getcwd())
# Next time whenever we want to read any dataset, just type
# read the dataset
df=pd.read_csv(“filename.csv”)
## for example
pd=df.read_csv(“Automobile.csv”)
3: I am getting the below error while trying to open ipynb file directly.
Ans: Jupyter files can be seen only in Jupyter Notebook environment. So, in order to read them.
Please follow the below given steps:
This file is meant for personal use by [email protected] only.
Sharing or publishing the contents in part or full is liable for legal action.
Step 1:
Step 2:
[email protected]
X9IMGDQ0PO
Step 3:
This file is meant for personal use by [email protected] only.
Sharing or publishing the contents in part or full is liable for legal action.
OR
Step 1.
Write Anaconda Prompt in Search Option that is at left corner in your screen
[email protected]
X9IMGDQ0PO
Step 2:
Click Open
Step 3:
write Jupyter Notebook
Click Enter
This file is meant for personal use by [email protected] only.
Sharing or publishing the contents in part or full is liable for legal action.
It will redirect you to Jupyter Home Page, from where you can select your file. Usually you will
find all your files in Downloads Folder.
[email protected]
X9IMGDQ0PO
Step 4:
Click downloads, you will be able to see all the files which are available in your Desktop
Downloads. Now you just click on the Jupyter file (.ipynb extension) which you want to Open. In
the new tab, it will Open.
This file is meant for personal use by [email protected] only.
Sharing or publishing the contents in part or full is liable for legal action.