I have a sample data frame shown below. I want to plot each column against the data frame index.
x1 = pd.DataFrame()
x1['x25'] = df['X'][0:45].reset_index(drop=True)
x1['x50'] = df['X'][90:135].reset_index(drop=True)
x1['x75'] = df['X'][180:225].reset_index(drop=True)
x1['x100'] = df['X'][270:315].reset_index(drop=True)
x1['x125'] = df['X'][360:405].reset_index(drop=True)
using x1.head() the output is shown below.
x25 x50 x75 x100 x125
0 22732 22852 22997 23151 23253
1 22732 22853 22995 23153 23254
2 22733 22851 22997 23153 23254
3 22731 22851 22995 23150 23255
4 22730 22851 22997 23152 23254
I checked the output of each column, they are all equal.
print(len(x1.index), len(x1['x25']), len(x1['x50']), len(x1['x75']), len(x1['x100']), len(x1['x125']))
45 45 45 45 45 45
I am trying to plot with the command below, but i am getting The error message ValueError: arrays must all be same length
sns.lineplot( x1, x1.index, ['x25','x50','x75','x100','x125'])
could somebody please let me know, what i am doing wrong.


lineplot.