Generation

generate functionTue, 21 Mar 2023

There is a Pandas dataframe: water nutri mineral 0 1 1 2 1 2 2 1 2 3 4 1 3 4 6 3 4 2 5 2 5 4 6 4 6 2 7 2 7 4 5 4 8 5 4 5 9 2 5 4 10 3 6 3 11 4 7 2 12 2 4 3 13 1 3 2 14 3 5 3 15 4 5 1 16 3 6 3 17 2 5 4 18 5 4 5 19 1 3 1 Construct a vertical bar graph comparing these values, where the x-axis is index and the y-axis is the value of each column

import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt df = pd.DataFrame(data=[1,1,2,2,4,1,3,2,5,4,3,2,4,1,3,4,3,2,4,5,1,3], columns=['water']) df['nutri'] = pd.DataFrame(data=[1,2,2,4,6,2,4,5,4,5,6,4,3,3,5,5,6,5,4,3,3,5], columns=['nutri']) df['mineral'] = pd.DataFrame(data=[2,1,1,3,2,4,1,2,5,4,3,3,2,2,3,1,3,4,5,4,1,3], columns=['mineral']) plt.figure(figsize=(12,5)) sns.

Questions about programming?Chat with your personal AI assistant