Suppose I have a framework with columns with rows, rows, and integers that I would like to combine into a new data framework with String and Integer in combination with each record in Series. How can i do this?
In this example:
data = {'fruits': ['banana', 'apple', 'pear'], 'source' : (['brazil', 'algeria', 'nigera'], ['brazil', 'morocco', 'iran', 'france'], ['china', 'india', 'mexico']), 'prices' : [2, 3, 7]} df = pd.DataFrame(data, columns = ['fruits', 'source', 'prices'])
I would like to get a 3x10 s frame:
['banana', 'banana', 'banana', 'apple', 'apple', 'apple', 'apple', 'pear', 'pear', 'pear'], ['brazil', 'algeria', 'nigera', 'brazil', 'morocco', 'iran', 'france', 'china', 'india', 'mexico'], ['2', '2', '2', '3', '3', '3', '3', '7', '7', '7'],
I think it should not be too difficult, but I can not find neat solutions.