Question: 1. Use Pandas read_csv to read the data from file Marketing Raw Data.csv into variable raw_data 2. Display the shape of the raw_data DataFrame. 3.
1. Use Pandasread_csvto read the data from fileMarketing Raw Data.csvinto variableraw_data
2. Display theshapeof theraw_dataDataFrame.
3. Display thefirst 5 rowsof the DataFrame [HINT: Remember the .head() method]
In[14]:
# INSERT CODE FOR STEPS 1 - 3 # Load the data from the file #1 raw_data = pd.read_csv("Marketing Raw Data.csv") # Display the shape of the data #2 raw_data.shape # Display the first 5 rows of data from the file #3 raw_data.head(5)
4. Use.plotto create a simpleline graphof theVisitorsdata. [HINT: Use "Visitors" as the index for raw_data]
5.Showthe plot.
In[42]:
# Example 1 - Simple line graph # INSERT CODE FOR STEPS 4 - 5 #4 #plt.plot(raw_data.index="Visitors" #5 #plt.show()
6.Copythe code from Step 4 (above) to re-create the simpleline graphof theVisitorsdata.
7. Set thexticksto the string values inraw_data["Date"].
Therangeneeds to match the number of data points. Uselen(raw_data["Visitors"])calculate the upper range value.
Because there are so many data points, try addingrotation = 90to rotate the date values]
8.Showthe plot.
NOTE: The date values along the X-axis are still going to look like BLACK SMUDGES
In[6]:
# Example 2 - Line graphs with xtickers # INSERT CODE FOR STEPS 6 - 8
Limit the amount of data plotted to make the graph easier to read.
9.Createan array namedawith only the last 10 rows of data. Useraw_data.tail(10)get only the last 10 rows.
Note:Because this return rows 172-182, theindexvalues need to be reset.
10. Add.reset_index()to the end of the previous command
11.Copytheplot, xticks & showcommands from the previous cell.
12.Changeall references toraw_datain the copied lines toaso the correct array is used.
link:
https://drive.google.com/file/d/1lybttcyAAw_4qq50GJB7Ov5LTMOlFS5-/view?usp=sharing
question #4 is not working!!!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
