I have this dataframe(df) that looks like this
`
user_id |date |last_dep_amt| dep_amt| Bin | Action
1031 |2017-03-11 |200.0 |100 | 100-200 | [{'A1':[350,400,450],
'A2':[450,480,490],
'A3':[500,550,600],
'A4':[650, 700,850],
'A5':[750,800,950],
'Last_5_deposits':[50],
'num_unique_a1':3,
'num_unique_a2':4,
'num_unique_a3':7,
'num_unique_a4':8,
'num_unique_a5':9}]
1031 |2017-03-12 |300.0 |120 | 100-200 | [{'A1':[250,300,550],
'A2':[150,440,460],
'A3':[250,300,430],
'A4':[350, 500,650],
'A5':[650,700,780],
'Last_5_deposits':[50],
'num_unique_a1':3,
'num_unique_a2':4,
'num_unique_a3':7,
'num_unique_a4':8,
'num_unique_a5':9}]
231 |2017-03-14 |350.0 |130 | 100-200 | [{'A1':[250,300,550],
'A2':[150,440,460],
'A3':[250,300,430],
'A4':[350, 500,650],
'A5':[650,700,780],
'Last_5_deposits':[50],
'num_unique_a1':3,
'num_unique_a2':4,
'num_unique_a3':7,
'num_unique_a4':8,
'num_unique_a5':9}]
`
Essentially containing 6 columns. Where the last column('Action') of the dataframe is list of dictionary.
Так что мне нужно разделить последний столбец («Действие») на несколько столбцов, как показано ниже, например: user_id | date | last_dep_amt |dep_amt | Bin | A1 | A2 | A3 | A4 | А5 | Last_5_deposits |num_unique_a1 | num_unique_a2 | num_unique_a3 | num_unique_a4 | num_unique_a5
Немного о фрейме данных type(df['Action']) - pandas.core.series.Series
type(df) - pandas.core.frame.DataFrame
Ожидаемый результат: все вложенные столбцы в столбце Action должны быть разделены на отдельные столбцы
user_id|date|last_dep_amt|dep_amt|Bin|A1|A2|A3|A4|A5|Last_5_deposits|
num_unique_a1|num_unique_a2|num_unique_a3|num_unique_a4|num_unique_a5
`
+---------+-----------+--------------+---------+---------+---------------+---------------+---------------+----------------+---------------+-----------------+---------------+---------------+---------------+----------------+----------------+
| user_id | date | last_dep_amt | dep_amt | Bin | A1 | A2 | A3 | A4 | A5 | Last_5_deposits | num_unique_a1 | num_unique_a2 | num_unique_a3 | num_unique_a4 | num_unique_a5 |
+---------+-----------+--------------+---------+---------+---------------+---------------+---------------+----------------+---------------+-----------------+---------------+---------------+---------------+----------------+----------------+
| 1031 | 3/11/2017 | 200 | 100 | 100-200 | [350,400,450] | [450,480,490] | [500,550,600] | [650, 700,850] | [750,800,950] | [50] | 3 | 4 | 7 | 8 | 9 |
+---------+-----------+--------------+---------+---------+---------------+---------------+---------------+----------------+---------------+-----------------+---------------+---------------+---------------+----------------+----------------+
`
Also have attached below the link that contains an image of the expected final output needed from the above dataframe(df)
`
<https://ibb.co/0JyKhHQ>