Enrollments closing soon for Post Graduate Certificate Program in Applied Data Science & AI By IIT Roorkee | 3 Seats Left
Apply NowLogin using Social Account
     Continue with GoogleLogin using your credentials
We are gonna work on California Housing Dataset in this project. The data contains information from the 1990 California Census.
Let's load the data. It is available in CSV(Comma Separated Values) format at path "/cxldata/datasets/project/housing/housing.csv".
We can load the CSV file by using the read_csv()
function from pandas
. It reads a CSV file into a DataFrame. A DataFrame is a two-dimensional data structure in which data is aligned in a tabular format in rows and columns.
So first, let's import the library pandas. We generally import pandas
as an alias pd
. In Python, aliases are an alternate name for referring to the same thing. Now the pandas
package can be referred to as pd
for ease.
So, the syntax for importing a library is-
import library_name as alias_name
And, the syntax for using read_csv()
is-
read_csv(path)
where, path
contains a URL or directory location of a file. Remember, path
must be contained inside single or double quotes.
Import library pandas
as an alias pd
.
Load the csv file(from the path as: “/cxldata/datasets/project/housing/housing.csv
”) as a DataFrame object and store it in a variable housing
.
Taking you to the next exercise in seconds...
Want to create exercises like this yourself? Click here.
Note - Having trouble with the assessment engine? Follow the steps listed here
Loading comments...