Professional Documents
Culture Documents
Q 1: How to Open files with extension .ipynb / How to Open Jupyter notebook ?
Ans: Jupyter files can be seen only in Jupyter Notebook environment. So, in order to read them.
Please follow the below given steps:
Step 1:
Step 2:
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Step 3:
OR
Step 1.
Write Anaconda Prompt in Search Option that is at left corner in your screen
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Step 2:
Click Open
Step 3:
write Jupyter Notebook
Click Enter
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.
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.
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Q2: How to read csv/excel file in Jupyter notebook?
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:
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Step 2:
Click Properties
Step 3:
Copy the path shown in front of location, & write filename with excel as shown below:
C:\Users\Shradha\Downloads\iris.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/Shradha/Downloads/iris.csv
Finally you have to write the below mentioned code:
Import pandas as pd
Iris=pd.read_csv(“C:/Users/Shradha/Downloads/iris.csv”) # CSV file
Or
Iris_new=pd.read_excel(r’C:/Users/Shradha/Downloads/iris.xlsx’) # Excel file
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Q 3: I am getting the below error while trying to open ipynb file directly.
Ans. Please make a note that ipynb files are to be open using your Jupyter Notebook. You
cannot open ipynb file directly. Refer to Q 1 & Q2.
Q 4: Could you please explain what the general rule of thumb is to use single quote and
double quote?
Ans. In python, a single quote or double quotes can be used interchangeably. Doing this will
not have any impact on the python output.
However, Just in case you are using Apostrophes in the text while printing, you have to use double
quotes. Please refer to the example below:
you're Amazing
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Q 5: I got an “unexpected indent” error while running a code.
Ans: Please remove the initial space in all the three lines of codes. Indentation has a
meaning in python which you will come across while going through the loop statements.
Ans. Please note the brackets used here. Round brackets are used to define a Tuple and
Square brackets are used to define a list.
Q 7: On dividing two integers, the answer is integer, but in Python, its reflecting as Float.
E.g. 98 divided by 2 will be 49, but Python is considering 49 as float.
Ans: In python, when we use division operator, it considers the output as float by default. It
does not concern python if there is no decimal point in python, if we have used a division
operator, outcome datatype will be of float type. There are ways to convert a datatype to
another which will be covered in later modules.
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Q 8: How can we save our Jupyter Notebook?
Ans: You can save a notebook by using the "File" -> "Download as" -> "Notebook (.ipynb)".
The file will be downloaded in the Downloads.
Alternatively, you can click on “Save and Checkpoint” Tab or can press “Ctrl+ S” or
“Command+ S”. The ipynb file will be saved in your working directory.
Ans: The error message says that it is invalid syntax. The reason here is that we are assigning
a value 1086M which is of string type (1086 is Numeric, however adding M converts it into
String). As we know all the strings are to be passed using the quotes. Hence, we got the
error. Please try using the below code:
complex="1086M"
type(complex)
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Q 11: What are the various important operators in python?
Ans: Below given is a list of Arithmetic operators of python- Arithmetic operators are used
to perform mathematical operations.
Operator Description Syntax Example Output
Below given are a few Relational Operators- Relational Operators compares the values and
gives one of the binary outputs i.e. True or False depending on the given condition.
Operator Description Syntax Example Output
Less than: True if left number is less than the 6<2 False
< right x<y
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited