I have a dataframe called Prices1
, which I have pasted below. I would like to plot all the columns against the index in seaborn
.
Please note that in this example I have four columns but in other problems I will have different number of columns.
AMZN BABA COST WMT
716 0.1256 1.62168 1.1572 1.35279
717 0.117824 1.6236 1.19329 1.36988
718 0.120359 1.65928 1.2042 1.38496
719 0.119176 1.64181 1.18629 1.39703
720 0.123233 1.67813 1.20476 1.36385
I have tried to use this but I keep getting an error:
sns.lineplot(data= Prices1.iloc[:, :2])
The error is as follows:
--------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-123-d006d5480255> in <module>
----> 1 sns.lineplot(data= df.iloc[:, :2])
~/opt/anaconda3/lib/python3.8/site-packages/seaborn/_decorators.py in inner_f(*args, **kwargs)
44 )
45 kwargs.update({k: arg for k, arg in zip(sig.parameters, args)})
---> 46 return f(**kwargs)
47 return inner_f
48
~/opt/anaconda3/lib/python3.8/site-packages/seaborn/relational.py in lineplot(x, y, hue, size, style, data, palette, hue_order, hue_norm, sizes, size_order, size_norm, dashes, markers, style_order, units, estimator, ci, n_boot, seed, sort, err_style, err_kws, legend, ax, **kwargs)
694 p._attach(ax)
695
--> 696 p.plot(ax, kwargs)
697 return ax
698
~/opt/anaconda3/lib/python3.8/site-packages/seaborn/relational.py in plot(self, ax, kws)
469 # Loop over the semantic subsets and add to the plot
470 grouping_vars = "hue", "size", "style"
--> 471 for sub_vars, sub_data in self.iter_data(grouping_vars, from_comp_data=True):
472
473 if self.sort:
~/opt/anaconda3/lib/python3.8/site-packages/seaborn/_core.py in iter_data(self, grouping_vars, reverse, from_comp_data)
979 grouping_keys.append(self.var_levels.get(var, []))
980
--> 981 iter_keys = itertools.product(*grouping_keys)
982 if reverse:
983 iter_keys = reversed(list(iter_keys))
TypeError: 'NoneType' object is not iterable
Any suggestions? Thank you in advance.