Question
need 7-15 1) Enter imports: In [ ]: import pandas as pd 2) Read in the Zillow CSV file to a dataframe and print the
need 7-15
1) Enter imports:
In [ ]:
import pandas as pd
2) Read in the Zillow CSV file to a dataframe and print the head:
In [ ]:
df = pd.read_csv('ZILLOW-CO1749_MLPSF.csv')
print(df.head())
3) Set the 'Date' column as an index and print the first row:
In [ ]:
df.set_index('Date', inplace=True)
print(df.head(1))
4) Export the data to a CSV file and name the file WorkbookCSV1.csv:
In [ ]:
df.to_csv('WorkbookCSV1.csv')
5) Read back into a dataframe the data from the file WorkbookCSV1.csv and print the first row:
In [ ]:
df = pd.read_csv('WorkbookCSV1.csv')
print(df.head(1))
6) Set the 'Date' column as an index and print the first row:
In [ ]:
df = pd.read_csv('WorkbookCSV1.csv', index_col=0)
print(df.head(1))
7) Export the column 'Value' file WorkbookCSV2.csv:
In [ ]:
8) Read back into a dataframe the data from the file WorkbookCSV2.csv and print the first row:
In [ ]:
9) Read in the Zillow CSV file into the dataframe again and print the last row:
In [ ]:
10) Relabel the existing Dataframe column 'Value' to 'Home_Prices' and print the head:
In [ ]:
11) Set the 'Date' column as an index and print the first row:
In [ ]:
12) Export the existing Dataframe data to a CSV file and name the file WorkbookCSV3.csv without the column labels, Read back into a dataframe the data from the file WorkbookCSV3.csv and print the first three rows:
In [ ]:
13) Reread back in the file WorkbookCSV3.csv to the Dataframe, this time add the column labels 'Date' and 'House_Price' (Respectively), set 'Date' as the index (all at once), then print the first three lines:
In [ ]:
14) Remove the index from the dataframe (keeping all labels) and print the last three lines:
In [ ]:
13) Create an HTML file named WorkbookHTML.html from the data in the Dataframe
In [ ]:
14) Rename existing Dataframe columns at the same time to 'Calendar_Date' and 'Price' (Respectively) and print the first ten rows:
In [ ]:
15) Rename the Dataframe column 'Calendar_Date' to 'Date', set the column 'Date' as the index and print the first eight rows:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started