1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
Import Pandas as PD Import JSON
filename = ' Top5.txt ' data = pd.read_csv (filename, sep= "\ T", Header=none)
# test model.8.10 modelname 810 8101 2018-03-28 04:21:13 2018-03-28 04:21:13 # 1 0 2018-04-02 14:50:54 {"Cell_info": "LTE plmn:46000 earfcn:38400 (B39) cell Identity #: 197539969 pci:141 tac:37884 rssi:-65 rsrp:-95 rsrq:-11 sinr*10:133 EMM state:registered # service State:normal reg DOMAIN:CS_PS Lte_tx_power tx = 9 Lte_rx_chain0 rssi=-64 rsrp=-94 # sinr=133 lte_rx_chain1 rssi=-69 rsrp=-99 sinr=118 "," Log_from ":" Com.android.phone ", # "Reg_at_time": "31112", "rat": "+", "Reg_during_time": "3554", "HPLMN": "46002"} 2018-04-02
columns = [] For I in range (Data.shape[1]): Columns.Append (' A ' + str (i)) Data.columns = Columns Print (Data.columns) # Index ([' A0 ', ' A1 ', ' A2 ', ' A3 ', ' A4 ', ' A5 ', ' A6 ', ' A7 ', ' A8 ', ' A9 ', ' A10 ', ' A11 '), # dtype= ' object ')
Print (data[' A10 ') # 0 {"Cell_info": "LTE plmn:46000 earfcn:38400 (B39 ... data = Data.join (data[' A10 '].apply (json.loads). Apply (PD. Series))
Print (Data.columns) # Index ([' A0 ', ' A1 ', ' A2 ', ' A3 ', ' A4 ', ' A5 ', ' A6 ', ' A7 ', ' A8 ', ' A9 ', ' A10 ', # ' A11 ', ' cell_info ', ' hplmn ', ' log_from ', ' rat ', ' reg_at_time ', # ' Reg_during_time '), # dtype= ' object ') |