I want to split the record if it contains /
below into 2 rows with the same volume and premium values but with group values of 4942 and 5350. The second transformation
Current dataframe
Group Volume Premium
4941.0 5721.0 5057.76
4942/5350 6154.0 5462.46
transformed
Group Volume Premium
4941.0 5721.0 5057.76
4942 6154.0 5462.46
5350 6154.0 5462.46
I tried the code below and the first record group value should be 4941 but it returns nan instead
dfRosters=(dfRosters.set_index(['Volume', 'Premium'])
.apply(lambda x: x.str.split('/').explode())
.reset_index())
Volume Premium Group
0 5721.0 5057.76 NaN
1 6154.0 5462.46 4942
2 6154.0 5462.46 5350