visit
import matplotlib.pyplot as plt
csvFile.plot(kind = 'scatter', x='Volume', y='CO2', figsize=(20,7), grid=True, fontsize=15)
Here, the “csvFile” is the pandas dataframe, and the plot is created using the Python library Matplotlib.
csvFile['CO2'].plot(kind='hist')
csvFile.pivot(columns='Car', values='CO2')
csvFile.pivot(columns='Car', values='CO2').plot(kind='box', figsize=(20,7), fontsize=15)
The box plot shows that Mercedez has the highest carbon emission of all the cars.
csvFile.groupby('CO2')['Car'].value_counts()
We unstack the pivot table:
csvFile.groupby('CO2')['Car'].value_counts().unstack()
csvFile.groupby('CO2')['Car'].value_counts().unstack().plot(kind='bar',stacked=True, figsize=(20,7), fontsize=15)
The chart shows that the carbon emission of 99 is the highest number of cars according to the data.