You work in XYZ Corporation as a Data Analyst. Your corporation has told you to visualize the mtcars.csv dataset with various plots.
1. Plot the area chart for the colmns: ‘am’ and ‘carb’.
a. Set the ‘am’ on the x-axis.
b. Set the ‘carb’ on the y-axis.
c. Provide the x-axis label as Transmission.
d. Provide the y-axis labe as Number of carburetors.
e. Provide the title as Transmission vs Number of carburetors.
You work in XYZ Corporation as a Data Analyst. Your corporation has told you to visualize the mtcars.csv dataset with various plots.
1. Plot a pie chart for columns: ‘cyl’ and ‘model’ form the mtcars.csv data frame
import matplotlib.pyplot as plt
import pandas as pd
df = pd.read_csv('mtcars.csv')
plt.plot(df['am'], df['carbs'])
plt.title('Transmission vs Number of carburetors')
plt.xlabel('Transmission')
plt.ylabel('Number of carburetors')
plt.show()
Comments
Leave a comment