-4

example

import pandas as pd  
b = [[300, 200, 100, 10]] #(data which pass from upper side so cant edit)

data_dict = {'value': pd.Series(b)}
dframe = pd.DataFrame(data_dict)
dframe
     value
0   [300, 200, 100,10]

How to make the number show on each row? like below

   value
0 [300]
1 [200]
2 [100]
3 [10]
crowzz
  • 112
  • 1
  • 6
  • Your code throws "TypeError: unsupported operand type(s) for /: 'module' and 'type'", I know it's trivial but could you please ensure your minimal example at least runs? – cs95 Jul 14 '20 at 11:10
  • `{'value': pd.Series(b[0])}` should work right? Since it's a nested list. – cs95 Jul 14 '20 at 11:12

1 Answers1

1

You can try:

dframe.explode('value').reset_index(drop=True)

Result:

  value
0   300
1   200
2   100
3    10
René
  • 4,594
  • 5
  • 23
  • 52