import pandas as pd delete_all pd read_csv file csv dtype json object

1
2
3
4
5
6
7
8
9
import pandas as pd
delete_all = pd.read_csv('file.csv', dtype={'json': object, 'dt': object})
with open('hw_2.csv', 'w') as file_to_save:
for idx, row in delete_all.iterrows():
data = json.loads(row['json'])
device_id = data['device_id']
ding_id = data['ding_id']
file_to_save.write(f'{device_id},{ding_id}\n')