Pandas Concat: Valueerror: Shape of Passed Values Is Blah, Indices Imply Blah2

ValueError: Shape of passed values is (6, 6), indices imply (4, 6) error when merging two df in pandas

Try changing your code from:

df5 = pd.concat([df1, linkdf], axis=1, ignore_index=True)

To

df5 = pd.concat([df1.reset_index(), linkdf], axis=1)

Gives you:

   index Background        Skin  ...      Face        Head                  Link
0 value Beige Light Gray ... Beard Bowl Cut https://example.com
1 value Blue Normal ... Blushing Durag Red. httpsl//example2.com

Concat gives Shape of passed values is X, indices imply Y

Here's a simple way:

df['grad'] = np.gradient(df['value'], df['diff_day'])

To make your solution work, you can do:

result = pd.concat([df.reset_index(drop=True), grouped_2.reset_index(drop=True)], axis=1)


Related Topics



Leave a reply



Submit