in wide_to_long function the error of [stubname can't be identical to a column name]

Viewed 16

Below wide_to_long function can't work, anyone can help ? Thanks!

import pandas as pd
ori_df = pd.DataFrame()
ori_df = pd.DataFrame([['a', '1'], ['w:', 'z'], ['t', '6'], ['f:', 'z'], ['a', '2']],
                      columns=['type', 'value']
                      )
ori_df['id'] = ori_df.index


pd.wide_to_long(ori_df, ['type', 'value'], i='id', j='amount')
0 Answers
Related