I have a Pandas series orders['customer']
that looks like this:
0 {'id': 454543543533, 'email': 'aaaaaa@gmail.com...
1 {'id': 437890767654, 'email': 'bbbbbbbb@mail.com...
2 {'id': 534764345453, 'email': 'ccccccccc@mail.com..
3 {'id': 345436564353, 'email': None, 'accepts_m....
4 {'id': 671341215803, 'email': None, 'accepts_m...
5 {'id': 671317065787, 'email': None, 'accepts_m...
I would like to iterate over the rows of this series and get the first element for each dictionary (id
). Moreover I would like to substitute the values in the series with only the id.
I tried many different solutions, last this one, but I cannot make this thing work:
for i in range(len(orders_df['customer'].values.tolist())):
orders_df['customer'] = orders_df['customer'].values.tolist()[i]