You work in XYZ Corporation as a Data Analyst. Your corporation has told you to visualize the mtcars.csv dataset with various plots. Tasks to be performed:
Dataset Link 1. Generate a bar plot graph for the columns ‘carbs’ and ‘gear’.
a. Map the ‘carbs’ onto the x-axis.
b. Map the ‘gear’ onto the y-axis.
c. Provide the x-axis label as Number of carburetors.
d. Provide the y-axis label as Number of forward gears.
e. Set the title as carbs vs gear.
You work in XYZ Corporation as a Data Analyst. Your corporation has told you to visualize the mtcars.csv dataset with various plots. Tasks to be performed:
Dataset Link 1. Plot a histogram for the column ‘wt’.
a. Map the ‘wt’ onto the x-axis.
b. Provide the x-axis label as ‘weight of the cars’.
c. Provide the y-axis label as ‘Count’
d. Set the number of bins as 30.
e. Set the title as ‘Histogram for the weight values
import matplotlib.pyplot as plt
import pandas as pd
df = pd.read_csv('mtcars.csv')
plt.plot(df['carbs'], df['gear'])
plt.title('carbs vs gear')
plt.xlabel('Number of carburetors')
plt.ylabel('Number of forward gears')
plt.show()
Comments
Leave a comment