0

This is the json file My question is that how to Flatten the data per item array as needed in this file.

Properties needed :

  • Tracking number
  • Payment type (Prepaid/COD)
  • Pickup Date Time
  • Delivery Date Time
  • All Out for Delivery (date/times)
  • Shipment weight
  • Pickup Pincode, City, State
  • Drop Pincode, City, State
df = pd.DataFrame('json file path')

bn = pd.DataFrame(df.trackDetails.values.tolist())['trackingNumber'],['ancillaryDetails'['reasonDescription']],['datesOrTimes'['type':'ACTUAL_PICKUP', 'ACTUAL_DELIVERY', 'SHIP']],['shipmentWeight'],['statusDetail'['code':'DL'['locations'["city"],['stateOrProvinceCode']]]['shipperAddress'['city'],['stateOrProvinceCode']]]  

But, it gives me syntax error, it is saying that-

SyntaxWarning: str indices must be integers or slices, not str; perhaps you missed a comma?                           

Can anyone guide me through this?

Andrej Kesely
  • 168,389
  • 15
  • 48
  • 91

0 Answers0