# Let's create a sample dataframedata= {
"name": ["John", "Jane", "Jim", "Janet"],
"age": [25, 30, 35, 40],
"location": ["New York", "Chicago", "Los Angeles", "Miami"],
}
df=pd.DataFrame(data)
# Now let's print out the dataframedisplay(df)
name
age
location
0
John
25
New York
1
Jane
30
Chicago
2
Jim
35
Los Angeles
3
Janet
40
Miami
# Create the plotplt.bar(df['name'], df['age'])
plt.title('Age by Name')
plt.xlabel('Name')
plt.ylabel('Age')
# Save the plot as a PNG image fileplt.savefig('assets/age_by_name_plot.png', dpi=300, bbox_inches='tight')
# Close the plot to prevent it from being displayedplt.close()