Generation

generate functionSat, 04 Mar 2023

Construct a line graph using the data from this dataframe, where the x-axis is years and the y-axis is the columns 2015 2016 2017 2018 2019 0 5.375734 5.382185 5.354019 5.375917 5.407096

def f(dframe): years = dframe.columns.get_level_values(0).get_level_values(0).unique() fig = plt.figure() ax = fig.add_subplot(111) for col in dframe.columns: dframe[col].plot(kind='line', ax=ax) plt.xticks(years) plt.show() f(df)

Questions about programming?Chat with your personal AI assistant