I need to make a wide-to-long transformation using Pandas.
I tried to make a list (from 1 to the value of the second column) but I got the error below :
Code :
import pandas as pd
df = pd.DataFrame({'Id': ['AA', 'BB', 'CC'], 'Value': [4, 2, 3]})
df['Value'] = df.apply(list(range(1, df['Value'])))
df.explode('Value')
Error :
TypeError: 'Series' object cannot be interpreted as an integer
Do you know you have to fix that or any other suggestions to make this transformation work ?
