I feel like this should be pretty straightforward but I've been getting errors.I want to create a function where I can pass in three different data frames (temp_years_df,co2_emissions_df,energy_use_df)
and plot trends on the column 'United States' with different y-labels on the plot:
%pylab inline
import seaborn as sns
def US_trends(df):
US_plot=df.T['United States'].plot()
plt.xlabel("Year")
if df=temp_years_df:
plt.ylabel("Number of People Affected by Extreme Temperatures")
elif df=co2_emissions_df:
plt.ylabel("CO2 Emissions")
elif df=energy_use_df:
plt.ylabel("Energy Use")
return US_plot
US_trends(temp_years_df)
But this is the error I received:
if df=temp_years_df:
^
SyntaxError: invalid syntax
I tried df==temp_years_df
and it still doesn't work. Can anyone enlighten me? Thanks!