How To get value in [[ ]]

crowzz

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]
Rene

You can try:

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

Result:

  value
0   300
1   200
2   100
3    10

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related