I have an Excel document with following inputs:
Row 1: Name of the product- 7up soft drink
Row 2: Diffrent varients- 600ml;1.25lt;2.25lt;600ml-lemon;2.25lt-lemon
Row 3: price of its Vareints- 35;60;90;35;90
I want the output to look like this
7up soft dring 600 ml 35
7up soft drink 1.25ltr 60
7up soft drink 2.25ltr 90
7up soft drink 600ml lemon 35
7up soft drink 2.25ltr lemon 90
I have come this far using python
import os
import pandas as pd
os.chdir('/Users/apple/Desktop')
tab1 = pd.read_excel('master.xlsx')
tab1['measure'] = tab1['measure'].apply(lambda x: str(x))
tab1['measure'] = tab1['measure'].apply(lambda x: x.split(';'))
tab1['price'] = tab1['price'].apply(lambda x: str(x))
tab1['price'] = tab1['price'].apply(lambda x: x.split(';'))
test = tab1.iloc[13]
tdc = dict.fromkeys(test.index)
for i in tdc.keys():
tdc[i] = []
tls = []
for i, j in zip(test['measure'],test['price']):
tls.append([test['products'] + ' ' + i, i, int(j)])
for x in tls:
for i, j in zip(['products', 'measure', 'price'], x):
tdc[i].append(j)
I got this output
Measure
list
['600ml', '1.25lt', '2.25lt', '600ml-lemon', '2.25lt-lemon']
Price
list
[35, 60, 90, 35, 90]
Products
list
['7up soft dring 600 ml',
'7up soft drink 1.25ltr',
'7up soft drink 2.25ltr',
'7up soft drink 600ml lemon',
'7up soft drink 2.25ltr lemon']
How to assign price list to product list?