Page 270 - AI Computer 10
P. 270
Step 10: Find the distance using the generated linear equation as per y = mx + c. For example, if the
value of Speed (X) = 8, what will be the distance covered by the vehicle?
Pop Quiz Quiz
Pop
Write the output of the following code:
a. import numpy as np b. import numpy as np
a = np.array ([1, 2, 3]) a = np full ((3, 4), 6)
print(a) print(a)
WORKING WITH CSV FILES IN PYTHON
A CSV file is a file which contains a set of data, separated by comma. In general, a .csv file can be accessed in any
spreadsheet application like Excel, Calc, etc. While working with Python packages, you should remember that a
csv file should be stored at the location where all the packages are installed.
To read a CSV file in Jupyter notebook, firstly, you will import Pandas with the help of the following command:
import pandas as pd
After that, you will create a new variable in which your .csv file will be saved. Here, we create a variable dataframe.
To save a .csv file in dataframe, type the following command after importing pandas:
dataframe = pd.read_csv(“F:\Softwares\Setups\DataScience\Anaconda\pkgs\pandas-
1.0.5-py38h47e9c7a_0\Lib\site-packages\pandas\CHARTS.csv”)
Now, .csv file is saved in the variable dataframe. You can explore the data of the csv file using .head() function.
To do this, you can type the following command:
print (dataframe.head())
The visual look of the code is as follows:
The output of the code looks like as follows:
136
136