Reputation: 1
This is the code I wrote to load dataframe iris in df and to plot stacked area plot
import matplotlib.pyplot as plt
import seaborn as sns
def read_dataset():
df = sns.load_dataset('iris')
print(df)
return df
def line_plot():
df = read_dataset()
col1 = "sepal_length"
col2 = "sepal_width"
col3 = "species"
plt.stackplot(col1, col2)
plt.show()
line_plot()
error coming as follows:
TypeError: cannot perform accumulate with a flexible type
Upvotes: 0
Views: 36
Reputation: 557
You seems to only have made a simple mistake. You don't set the variables col1, col2, and col3 properly.
col1 = df["sepal_length"]
col2 = df["sepal_width"]
col3 = df["species"]
Upvotes: 1