使用Pandas在Python中提取相同的命名值

使用Pandas在Python中提取相同的命名值,python,pandas,csv,dataframe,extract,Python,Pandas,Csv,Dataframe,Extract,我正在编写一个Python程序,以从.csv文件中的一列中提取多个值。 这是我的密码: import csv import pandas as pd # read items with column name df=pd.read_csv('D:\\My Documents\\Skype_Call_Session\\logs\\2018-06\\18\\skype_session_av.csv', header=0) # extract values df['FromIPAddr'] = d

我正在编写一个Python程序,以
.csv
文件中的一列中提取多个值。

这是我的密码:

import csv
import pandas as pd

# read items with column name
df=pd.read_csv('D:\\My Documents\\Skype_Call_Session\\logs\\2018-06\\18\\skype_session_av.csv', header=0)

# extract values
df['FromIPAddr'] = df['QoEReport'].str.extract(r',"\FromIPAddr\":"\s*([^\.]*)\s*\","\ToIPAddr', expand=False)
df['ToIPAddr'] = df['QoEReport'].str.extract(r',"\ToIPAddr\":"\s*([^\.]*)\s*\","\FromBssid', expand=False)
df['Stream_1_PacketLossRate'] = df['QoEReport'].str.extract(r',\s*([^\.]*)\s*\.', expand=False)
df['Stream_1_RoundTrip'] = df['QoEReport'].str.extract(r',\s*([^\.]*)\s*\.', expand=False)
df['Stream_1_JitterInterArrival'] = df['QoEReport'].str.extract(r',\s*([^\.]*)\s*\.', expand=False)
df['Stream_2_PacketLossRate'] = df['QoEReport'].str.extract(r',\s*([^\.]*)\s*\.', expand=False)
df['Stream_2_RoundTrip'] = df['QoEReport'].str.extract(r',\s*([^\.]*)\s*\.', expand=False)
df['Stream_2_JitterInterArrival'] = df['QoEReport'].str.extract(r',\s*([^\.]*)\s*\.', expand=False)
df['OverallAvgNetworkMOS'] = df['QoEReport'].str.extract(r',\s*([^\.]*)\s*\.', expand=False)

# OUTPUT TO NEW CSV
df.to_csv('D:\\My Documents\\Skype_Call_Session\\logs\\2018-06\\18\\extracted_av.csv', index=False, header=True)`
到目前为止,测试进行得很顺利,但我遇到了一个问题,提取两个值,而它们周围的字符都是相同的,并使用
Stream_1
Stream_2
分别命名,如代码所示。但是
df['qoreport'].str.extract
这次不起作用

这是我试图提取的QoReport列中一个单元格的一部分:

}],"AudioStreams":[{"JitterInterArrival":10,"JitterInterArrivalMax":24,"PacketLossRate":0.01353227,"PacketLossRateMax":0.09027778,"BurstDensity":null,"BurstDuration":null,"BurstGapDensity":null,"BurstGapDuration":null,"BandwidthEst":25245423,"RoundTrip":520,"RoundTripMax":11099,"PacketUtilization":2843,"RatioConcealedSamplesAvg":0.02746676,"ConcealedRatioMax":0.01598402,"PayloadDescription":"SIREN","AudioSampleRate":16000,"AudioFECUsed":true,"SendListenMOS":null,"OverallAvgNetworkMOS":3.487248,"DegradationAvg":0.2727518,"DegradationMax":0.2727518,"NetworkJitterAvg":253.0633,"NetworkJitterMax":1149.659,"JitterBufferSizeAvg":220,"JitterBufferSizeMax":1211,"PossibleDataMissing":false,"StreamDirection":"FROM-to-TO"},{"JitterInterArrival":10,"JitterInterArrivalMax":24,"PacketLossRate":0.01342051,"PacketLossRateMax":0.09027778,"BurstDensity":null,"BurstDuration":null,"BurstGapDensity":null,"BurstGapDuration":null,"BandwidthEst":2347573,"RoundTrip":721,"RoundTripMax":1703,"PacketUtilization":2906,"
 {"Session":{"MediaStartTime":"2018-06-13T00:53:31.023","MediaEndTime":"2018-06-13T01:12:27.0251","IsFromReceived":true,"IsToReceived":true,"ConferenceUri":null,"MediationServerBypassFlag":false,"FromOS":"Windows 10.0.15063 SP: 0.0 Type: 1(Workstation) Suite: 256 Arch: x64 WOW64: True","ToOS":"","FromCPUName":"Intel(R) Core(TM) i5-7300U CPU @ 2.60GHz","ToCPUName":"","FromCPUNumberOfCores":null,"ToCPUNumberOfCores":2,"FromCPUProcessorSpeed":2701,"ToCPUProcessorSpeed":2501,"FromVirtualizationFlag":null,"ToVirtualizationFlag":null,"PossibleDataMissing":false},"MediaLines":[{"MediaLineLabelText":"main-audio","MidCallReport":false,"FromConnectivityIce":"","ToConnectivityIce":"DIRECT","Transport":"UDP","Security":"SRTP","FromPort":50010,"ToPort":50003,"FromRelayIPAddr":"52.113.2.161","ToRelayIPAddr":"52.113.2.165","FromRelayPort":null,"ToRelayPort":51623,"FromCaptureDev":"Headset Microphone (Plantronics C310-M)","ToCaptureDev":"Headset Microphone (Plantronics C310-M)","FromCaptureDevDriver":"Microsoft: 10.0.15063.502","ToCaptureDevDriver":"Microsoft: 6.1.7601.18208","FromRenderDev":"Headset Earphone (Plantronics C310-M)","ToRenderDev":"Headset Earphone (Plantronics C310-M)","FromRenderDevDriver":"Microsoft: 10.0.15063.502","ToRenderDevDriver":"Microsoft: 6.1.7601.18208","FromVPN":false,"ToVPN":false,"FromLinkSpeed":130000000,"ToLinkSpeed":36000000,"FromNetworkConnectionDetail":"wifi","ToNetworkConnectionDetail":"wifi","FromIPAddr":"192.168.1.55","ToIPAddr":"88.168.20.106","FromBssid":"1890d8d727d0","ToBssid":"f22695127d94","FromReflexiveLocalIPAddr":"176.136.98.193","ToReflexiveLocalIPAddr":"88.168.20.106","FromWifiDriverDeviceDesc":"Microsoft Wi-Fi Direct Virtual Adapter;Intel(R) Dual Band Wireless-AC 8265","ToWifiDriverDeviceDesc":"Intel(R) Dual Band Wireless-AC 8260;Microsoft Virtual WiFi Miniport Adapter","FromWifiDriverVersion":"Microsoft:10.0.15063.0;Intel:19.1.0.4","ToWifiDriverVersion":"Intel:18.12.0.3;Microsoft:6.1.7600.16385","FromWifiRSSI":0,"ToWifiRSSI":0,"FromSSID":"42626f782d4537353541423731","ToSSID":"66726565626f78656e747265","FromWifiChannel":1,"ToWifiChannel":1,"FromActivePowerProfile":0,"ToActivePowerProfile":0,"FromWifiHandovers":0,"ToWifiHandovers":0,"FromWifiChannelSwitches":0,"ToWifiChannelSwitches":0,"FromWifiChannelReassociations":0,"ToWifiChannelReassociations":0,"FromWifiRadioFrequency":0,"ToWifiRadioFrequency":0,"FromWifiSignalStrength":99,"ToWifiSignalStrength":88,"PossibleDataMissing":false},{"MediaLineLabelText":"main-video","MidCallReport":false,"FromConnectivityIce":"","ToConnectivityIce":"DIRECT","Transport":"UDP","Security":"SRTP","FromPort":50022,"ToPort":50039,"FromRelayIPAddr":"52.113.2.153","ToRelayIPAddr":"52.113.2.169","FromRelayPort":null,"ToRelayPort":54941,"FromCaptureDev":"Integrated Webcam","ToCaptureDev":"Integrated Webcam","FromCaptureDevDriver":"","ToCaptureDevDriver":"","FromRenderDev":"Intel(R) HD Graphics 620","ToRenderDev":"Intel(R) HD Graphics 520","FromRenderDevDriver":"Intel Corporation:21.20.16.4627","ToRenderDevDriver":"Intel Corporation:20.19.15.4390","FromVPN":false,"ToVPN":false,"FromLinkSpeed":130000000,"ToLinkSpeed":36000000,"FromNetworkConnectionDetail":"wifi","ToNetworkConnectionDetail":"wifi","FromIPAddr":"192.168.1.55","ToIPAddr":"88.168.20.106","FromBssid":"1890d8d727d0","ToBssid":"f22695127d94","FromReflexiveLocalIPAddr":"176.136.98.193","ToReflexiveLocalIPAddr":"88.168.20.106","FromWifiDriverDeviceDesc":"Microsoft Wi-Fi Direct Virtual Adapter;Intel(R) Dual Band Wireless-AC 8265","ToWifiDriverDeviceDesc":"Intel(R) Dual Band Wireless-AC 8260;Microsoft Virtual WiFi Miniport Adapter","FromWifiDriverVersion":"Microsoft:10.0.15063.0;Intel:19.1.0.4","ToWifiDriverVersion":"Intel:18.12.0.3;Microsoft:6.1.7600.16385","FromWifiRSSI":0,"ToWifiRSSI":0,"FromSSID":"42626f782d4537353541423731","ToSSID":"66726565626f78656e747265","FromWifiChannel":1,"ToWifiChannel":1,"FromActivePowerProfile":0,"ToActivePowerProfile":0,"FromWifiHandovers":0,"ToWifiHandovers":0,"FromWifiChannelSwitches":0,"ToWifiChannelSwitches":0,"FromWifiChannelReassociations":0,"ToWifiChannelReassociations":0,"FromWifiRadioFrequency":0,"ToWifiRadioFrequency":0,"FromWifiSignalStrength":99,"ToWifiSignalStrength":88,"PossibleDataMissing":false}],"AudioStreams":[{"JitterInterArrival":9,"JitterInterArrivalMax":22,"PacketLossRate":0.003282649,"PacketLossRateMax":0.4927536,"BurstDensity":null,"BurstDuration":null,"BurstGapDensity":null,"BurstGapDuration":null,"BandwidthEst":3977162,"RoundTrip":94,"RoundTripMax":324,"PacketUtilization":32194,"RatioConcealedSamplesAvg":0.008398115,"ConcealedRatioMax":0.2057942,"PayloadDescription":"SILKWide","AudioSampleRate":16000,"AudioFECUsed":false,"SendListenMOS":3.33,"OverallAvgNetworkMOS":4.163474,"DegradationAvg":0.1265264,"DegradationMax":1.078434,"NetworkJitterAvg":29.02976,"NetworkJitterMax":188.6704,"JitterBufferSizeAvg":101,"JitterBufferSizeMax":273,"PossibleDataMissing":false,"StreamDirection":"FROM-to-TO"},{"JitterInterArrival":9,"JitterInterArrivalMax":22,"PacketLossRate":0.003282547,"PacketLossRateMax":0.4927536,"BurstDensity":null,"BurstDuration":null,"BurstGapDensity":null,"BurstGapDuration":null,"BandwidthEst":626065,"RoundTrip":72,"RoundTripMax":1249,"PacketUtilization":32292,"RatioConcealedSamplesAvg":0.008398115,"ConcealedRatioMax":null,"PayloadDescription":"SILKWide","AudioSampleRate":16000,"AudioFECUsed":true,"SendListenMOS":3.29,"OverallAvgNetworkMOS":null,"DegradationAvg":null,"DegradationMax":null,"NetworkJitterAvg":null,"NetworkJitterMax":null,"JitterBufferSizeAvg":null,"JitterBufferSizeMax":null,"PossibleDataMissing":false,"StreamDirection":"TO-to-FROM"}],"VideoStreams":[{"PossibleDataMissing":false,"VideoMediaLineLabelText":"main-video","JitterInterArrival":1,"JitterInterArrivalMax":19,"PacketLossRate":0.0002356738,"PacketLossRateMax":0.009090909,"BandwidthEst":2598927,"RoundTrip":81,"RoundTripMax":545,"PacketUtilization":55181,"PayloadDescription":"H264","VideoResolution":"424x240","VideoBitRateAvg":184640,"VideoBitRateMax":329133,"VideoFrameRateAvg":7.494197,"VideoPacketLossRate":0.0002356738,"VideoFrameLossRate":191.9469,"CIFQualityRatio":76,"VGAQualityRatio":3,"HD720QualityRatio":20,"NoneDropRatio":null,"SendCodecTypes":"","SendResolutionWidth":null,"SendResolutionHeight":null,"SendFrameRateAverage":12.81255,"SendBitRateMaximum":null,"SendBitRateAverage":null,"SendVideoStreamsMax":null,"VideoPostFECPLR":0.0001450063,"RecvCodecTypes":"H264 SW","RecvResolutionWidth":1280,"RecvResolutionHeight":720,"RecvFrameRateAverage":7.49366,"RecvBitRateMaximum":2350453,"RecvBitRateAverage":667126,"DynamicCapabilityPercent":0.0,"LowBitRateCallPercent":0.0,"LowFrameRateCallPercent":45.53571,"LowResolutionCallPercent":null,"DurationSeconds":1128.574,"IsAggregatedData":true,"UseForCallClassification":true,"StreamDirection":"FROM-to-TO"},{"PossibleDataMissing":false,"VideoMediaLineLabelText":"main-video","JitterInterArrival":1,"JitterInterArrivalMax":19,"PacketLossRate":0.000237157,"PacketLossRateMax":0.009090909,"BandwidthEst":778259,"RoundTrip":73,"RoundTripMax":531,"PacketUtilization":55170,"PayloadDescription":"H264","VideoResolution":"424x240","VideoBitRateAvg":210845,"VideoBitRateMax":445636,"VideoFrameRateAvg":7.499987,"VideoPacketLossRate":0.000237157,"VideoFrameLossRate":null,"CIFQualityRatio":null,"VGAQualityRatio":null,"HD720QualityRatio":null,"NoneDropRatio":null,"SendCodecTypes":"H264 HW","SendResolutionWidth":424,"SendResolutionHeight":240,"SendFrameRateAverage":7.499987,"SendBitRateMaximum":445636,"SendBitRateAverage":210845,"SendVideoStreamsMax":1,"VideoPostFECPLR":null,"RecvCodecTypes":"","RecvResolutionWidth":null,"RecvResolutionHeight":null,"RecvFrameRateAverage":null,"RecvBitRateMaximum":null,"RecvBitRateAverage":null,"DynamicCapabilityPercent":1.0,"LowBitRateCallPercent":null,"LowFrameRateCallPercent":null,"LowResolutionCallPercent":null,"DurationSeconds":1120.002,"IsAggregatedData":false,"UseForCallClassification":true,"StreamDirection":"TO-to-FROM"}],"AudioSignals":[{"PossibleDataMissing":false,"SubmittedByFromUser":false,"SendSignalLevel":-23,"RecvSignalLevel":-20,"SendNoiseLevel":-68,"RecvNoiseLevel":-61,"AudioSpeakerGlitchRate":0,"AudioMicGlitchRate":0,"VsEntryCauses":"","EchoEventCauses":"","RecvSignalLevelCh1":-20,"RecvSignalLevelCh2":null,"RecvNoiseLevelCh1":-61,"RecvNoiseLevelCh2":null,"SendSignalLevelCh1":-23,"SendSignalLevelCh2":null,"SendNoiseLevelCh1":-68,"SendNoiseLevelCh2":null,"RenderSignalLevel":0.0,"RenderNoiseLevel":0.0,"RenderLoopbackSignalLevel":-19.30759},{"PossibleDataMissing":false,"SubmittedByFromUser":true,"SendSignalLevel":-20,"RecvSignalLevel":-23,"SendNoiseLevel":-63,"RecvNoiseLevel":-64,"AudioSpeakerGlitchRate":0,"AudioMicGlitchRate":0,"VsEntryCauses":"","EchoEventCauses":"","RecvSignalLevelCh1":-23,"RecvSignalLevelCh2":null,"RecvNoiseLevelCh1":-64,"RecvNoiseLevelCh2":null,"SendSignalLevelCh1":-20,"SendSignalLevelCh2":null,"SendNoiseLevelCh1":-63,"SendNoiseLevelCh2":null,"RenderSignalLevel":0.0,"RenderNoiseLevel":0.0,"RenderLoopbackSignalLevel":-23.17426}],"AppSharingStreams":null,"FeedBackReports":null,"AudioClientEvents":[{"PossibleDataMissing":false,"SubmittedByFromUser":false,"NetworkSendQualityEventRatio":0.03,"NetworkReceiveQualityEventRatio":0.0,"NetworkDelayEventRatio":0.0,"NetworkBandwidthLowEventRatio":0.0,"CPUInsufficientEventRatio":0.0,"DeviceHalfDuplexAECEventRatio":0.0,"DeviceRenderNotFunctioningEventRatio":0.0,"DeviceCaptureNotFunctioningEventRatio":0.0,"DeviceGlitchesEventRatio":0.0,"DeviceLowSNREventRatio":0.0,"DeviceLowSpeechLevelEventRatio":0.0,"DeviceClippingEventRatio":0.03,"DeviceEchoEventRatio":0.0,"DeviceNearEndToEchoRatioEventRatio":0.0,"DeviceMultipleEndpointsEventCount":0,"DeviceHowlingEventCount":0,"DeviceRenderZeroVolumeEventRatio":0.0,"DeviceRenderMuteEventRatio":0.0},{"PossibleDataMissing":false,"SubmittedByFromUser":true,"NetworkSendQualityEventRatio":0.0,"NetworkReceiveQualityEventRatio":0.03,"NetworkDelayEventRatio":0.0,"NetworkBandwidthLowEventRatio":0.0,"CPUInsufficientEventRatio":0.0,"DeviceHalfDuplexAECEventRatio":0.0,"DeviceRenderNotFunctioningEventRatio":0.0,"DeviceCaptureNotFunctioningEventRatio":0.0,"DeviceGlitchesEventRatio":0.0,"DeviceLowSNREventRatio":0.0,"DeviceLowSpeechLevelEventRatio":0.0,"DeviceClippingEventRatio":0.0,"DeviceEchoEventRatio":0.0,"DeviceNearEndToEchoRatioEventRatio":0.0,"DeviceMultipleEndpointsEventCount":0,"DeviceHowlingEventCount":0,"DeviceRenderZeroVolumeEventRatio":0.0,"DeviceRenderMuteEventRatio":0.0}],"VideoClientEvents":[{"PossibleDataMissing":false,"VideoMediaLineLabel":"main-video","SubmittedByFromUser":false,"NetworkBandwidthLowEventRatio":0.0,"NetworkReceiveQualityEventRatio":0.0},{"PossibleDataMissing":false,"VideoMediaLineLabel":"main-video","SubmittedByFromUser":true,"NetworkBandwidthLowEventRatio":0.0,"NetworkReceiveQualityEventRatio":0.0}],"TraceRoutes":[{"PossibleDataMissing":false,"TraceRouteMediaLineLabelText":"main-audio","SubmittedByFromUser":false,"Hop":0,"IPAddress":"192.168.0.254","RTT":2},{"PossibleDataMissing":false,"TraceRouteMediaLineLabelText":"main-audio","SubmittedByFromUser":false,"Hop":1,"IPAddress":"88.168.20.254","RTT":57},{"PossibleDataMissing":false,"TraceRouteMediaLineLabelText":"main-audio","SubmittedByFromUser":false,"Hop":2,"IPAddress":"78.254.5.62","RTT":57},{"PossibleDataMissing":false,"TraceRouteMediaLineLabelText":"main-audio","SubmittedByFromUser":false,"Hop":3,"IPAddress":"78.254.255.161","RTT":59},{"PossibleDataMissing":false,"TraceRouteMediaLineLabelText":"main-audio","SubmittedByFromUser":false,"Hop":4,"IPAddress":"194.149.163.157","RTT":63},{"PossibleDataMissing":false,"TraceRouteMediaLineLabelText":"main-audio","SubmittedByFromUser":false,"Hop":5,"IPAddress":"194.149.163.90","RTT":62},{"PossibleDataMissing":false,"TraceRouteMediaLineLabelText":"main-audio","SubmittedByFromUser":false,"Hop":6,"IPAddress":"194.117.192.9","RTT":62},{"PossibleDataMissing":false,"TraceRouteMediaLineLabelText":"main-audio","SubmittedByFromUser":false,"Hop":7,"IPAddress":"212.194.171.144","RTT":65},{"PossibleDataMissing":false,"TraceRouteMediaLineLabelText":"main-audio","SubmittedByFromUser":false,"Hop":8,"IPAddress":"212.194.171.5","RTT":65},{"PossibleDataMissing":false,"TraceRouteMediaLineLabelText":"main-audio","SubmittedByFromUser":true,"Hop":0,"IPAddress":"192.168.1.254","RTT":4},{"PossibleDataMissing":false,"TraceRouteMediaLineLabelText":"main-audio","SubmittedByFromUser":true,"Hop":1,"IPAddress":"10.108.238.2","RTT":10},{"PossibleDataMissing":false,"TraceRouteMediaLineLabelText":"main-audio","SubmittedByFromUser":true,"Hop":2,"IPAddress":"212.194.171.4","RTT":13},{"PossibleDataMissing":false,"TraceRouteMediaLineLabelText":"main-audio","SubmittedByFromUser":true,"Hop":3,"IPAddress":"212.194.171.145","RTT":10},{"PossibleDataMissing":false,"TraceRouteMediaLineLabelText":"main-audio","SubmittedByFromUser":true,"Hop":5,"IPAddress":"194.149.162.85","RTT":13},{"PossibleDataMissing":false,"TraceRouteMediaLineLabelText":"main-audio","SubmittedByFromUser":true,"Hop":6,"IPAddress":"194.149.163.170","RTT":12},{"PossibleDataMissing":false,"TraceRouteMediaLineLabelText":"main-audio","SubmittedByFromUser":true,"Hop":7,"IPAddress":"78.254.255.162","RTT":12},{"PossibleDataMissing":false,"TraceRouteMediaLineLabelText":"main-audio","SubmittedByFromUser":true,"Hop":8,"IPAddress":"78.254.5.40","RTT":12},{"PossibleDataMissing":false,"TraceRouteMediaLineLabelText":"main-audio","SubmittedByFromUser":true,"Hop":9,"IPAddress":"88.168.20.106","RTT":58}]}
例如,在一个单元格中有两个
PacketLossRate
,它们都被
JitterInterArrivalMax
,“PacketLossRateMax:
,虽然我可以用数字表示差异,但不可能知道确切的值,因为它们每次都在变化

有人知道如何解决这个问题吗?非常感谢

*************************************更新************************************

我试图提取的一列值:

}],"AudioStreams":[{"JitterInterArrival":10,"JitterInterArrivalMax":24,"PacketLossRate":0.01353227,"PacketLossRateMax":0.09027778,"BurstDensity":null,"BurstDuration":null,"BurstGapDensity":null,"BurstGapDuration":null,"BandwidthEst":25245423,"RoundTrip":520,"RoundTripMax":11099,"PacketUtilization":2843,"RatioConcealedSamplesAvg":0.02746676,"ConcealedRatioMax":0.01598402,"PayloadDescription":"SIREN","AudioSampleRate":16000,"AudioFECUsed":true,"SendListenMOS":null,"OverallAvgNetworkMOS":3.487248,"DegradationAvg":0.2727518,"DegradationMax":0.2727518,"NetworkJitterAvg":253.0633,"NetworkJitterMax":1149.659,"JitterBufferSizeAvg":220,"JitterBufferSizeMax":1211,"PossibleDataMissing":false,"StreamDirection":"FROM-to-TO"},{"JitterInterArrival":10,"JitterInterArrivalMax":24,"PacketLossRate":0.01342051,"PacketLossRateMax":0.09027778,"BurstDensity":null,"BurstDuration":null,"BurstGapDensity":null,"BurstGapDuration":null,"BandwidthEst":2347573,"RoundTrip":721,"RoundTripMax":1703,"PacketUtilization":2906,"
 {"Session":{"MediaStartTime":"2018-06-13T00:53:31.023","MediaEndTime":"2018-06-13T01:12:27.0251","IsFromReceived":true,"IsToReceived":true,"ConferenceUri":null,"MediationServerBypassFlag":false,"FromOS":"Windows 10.0.15063 SP: 0.0 Type: 1(Workstation) Suite: 256 Arch: x64 WOW64: True","ToOS":"","FromCPUName":"Intel(R) Core(TM) i5-7300U CPU @ 2.60GHz","ToCPUName":"","FromCPUNumberOfCores":null,"ToCPUNumberOfCores":2,"FromCPUProcessorSpeed":2701,"ToCPUProcessorSpeed":2501,"FromVirtualizationFlag":null,"ToVirtualizationFlag":null,"PossibleDataMissing":false},"MediaLines":[{"MediaLineLabelText":"main-audio","MidCallReport":false,"FromConnectivityIce":"","ToConnectivityIce":"DIRECT","Transport":"UDP","Security":"SRTP","FromPort":50010,"ToPort":50003,"FromRelayIPAddr":"52.113.2.161","ToRelayIPAddr":"52.113.2.165","FromRelayPort":null,"ToRelayPort":51623,"FromCaptureDev":"Headset Microphone (Plantronics C310-M)","ToCaptureDev":"Headset Microphone (Plantronics C310-M)","FromCaptureDevDriver":"Microsoft: 10.0.15063.502","ToCaptureDevDriver":"Microsoft: 6.1.7601.18208","FromRenderDev":"Headset Earphone (Plantronics C310-M)","ToRenderDev":"Headset Earphone (Plantronics C310-M)","FromRenderDevDriver":"Microsoft: 10.0.15063.502","ToRenderDevDriver":"Microsoft: 6.1.7601.18208","FromVPN":false,"ToVPN":false,"FromLinkSpeed":130000000,"ToLinkSpeed":36000000,"FromNetworkConnectionDetail":"wifi","ToNetworkConnectionDetail":"wifi","FromIPAddr":"192.168.1.55","ToIPAddr":"88.168.20.106","FromBssid":"1890d8d727d0","ToBssid":"f22695127d94","FromReflexiveLocalIPAddr":"176.136.98.193","ToReflexiveLocalIPAddr":"88.168.20.106","FromWifiDriverDeviceDesc":"Microsoft Wi-Fi Direct Virtual Adapter;Intel(R) Dual Band Wireless-AC 8265","ToWifiDriverDeviceDesc":"Intel(R) Dual Band Wireless-AC 8260;Microsoft Virtual WiFi Miniport Adapter","FromWifiDriverVersion":"Microsoft:10.0.15063.0;Intel:19.1.0.4","ToWifiDriverVersion":"Intel:18.12.0.3;Microsoft:6.1.7600.16385","FromWifiRSSI":0,"ToWifiRSSI":0,"FromSSID":"42626f782d4537353541423731","ToSSID":"66726565626f78656e747265","FromWifiChannel":1,"ToWifiChannel":1,"FromActivePowerProfile":0,"ToActivePowerProfile":0,"FromWifiHandovers":0,"ToWifiHandovers":0,"FromWifiChannelSwitches":0,"ToWifiChannelSwitches":0,"FromWifiChannelReassociations":0,"ToWifiChannelReassociations":0,"FromWifiRadioFrequency":0,"ToWifiRadioFrequency":0,"FromWifiSignalStrength":99,"ToWifiSignalStrength":88,"PossibleDataMissing":false},{"MediaLineLabelText":"main-video","MidCallReport":false,"FromConnectivityIce":"","ToConnectivityIce":"DIRECT","Transport":"UDP","Security":"SRTP","FromPort":50022,"ToPort":50039,"FromRelayIPAddr":"52.113.2.153","ToRelayIPAddr":"52.113.2.169","FromRelayPort":null,"ToRelayPort":54941,"FromCaptureDev":"Integrated Webcam","ToCaptureDev":"Integrated Webcam","FromCaptureDevDriver":"","ToCaptureDevDriver":"","FromRenderDev":"Intel(R) HD Graphics 620","ToRenderDev":"Intel(R) HD Graphics 520","FromRenderDevDriver":"Intel Corporation:21.20.16.4627","ToRenderDevDriver":"Intel Corporation:20.19.15.4390","FromVPN":false,"ToVPN":false,"FromLinkSpeed":130000000,"ToLinkSpeed":36000000,"FromNetworkConnectionDetail":"wifi","ToNetworkConnectionDetail":"wifi","FromIPAddr":"192.168.1.55","ToIPAddr":"88.168.20.106","FromBssid":"1890d8d727d0","ToBssid":"f22695127d94","FromReflexiveLocalIPAddr":"176.136.98.193","ToReflexiveLocalIPAddr":"88.168.20.106","FromWifiDriverDeviceDesc":"Microsoft Wi-Fi Direct Virtual Adapter;Intel(R) Dual Band Wireless-AC 8265","ToWifiDriverDeviceDesc":"Intel(R) Dual Band Wireless-AC 8260;Microsoft Virtual WiFi Miniport Adapter","FromWifiDriverVersion":"Microsoft:10.0.15063.0;Intel:19.1.0.4","ToWifiDriverVersion":"Intel:18.12.0.3;Microsoft:6.1.7600.16385","FromWifiRSSI":0,"ToWifiRSSI":0,"FromSSID":"42626f782d4537353541423731","ToSSID":"66726565626f78656e747265","FromWifiChannel":1,"ToWifiChannel":1,"FromActivePowerProfile":0,"ToActivePowerProfile":0,"FromWifiHandovers":0,"ToWifiHandovers":0,"FromWifiChannelSwitches":0,"ToWifiChannelSwitches":0,"FromWifiChannelReassociations":0,"ToWifiChannelReassociations":0,"FromWifiRadioFrequency":0,"ToWifiRadioFrequency":0,"FromWifiSignalStrength":99,"ToWifiSignalStrength":88,"PossibleDataMissing":false}],"AudioStreams":[{"JitterInterArrival":9,"JitterInterArrivalMax":22,"PacketLossRate":0.003282649,"PacketLossRateMax":0.4927536,"BurstDensity":null,"BurstDuration":null,"BurstGapDensity":null,"BurstGapDuration":null,"BandwidthEst":3977162,"RoundTrip":94,"RoundTripMax":324,"PacketUtilization":32194,"RatioConcealedSamplesAvg":0.008398115,"ConcealedRatioMax":0.2057942,"PayloadDescription":"SILKWide","AudioSampleRate":16000,"AudioFECUsed":false,"SendListenMOS":3.33,"OverallAvgNetworkMOS":4.163474,"DegradationAvg":0.1265264,"DegradationMax":1.078434,"NetworkJitterAvg":29.02976,"NetworkJitterMax":188.6704,"JitterBufferSizeAvg":101,"JitterBufferSizeMax":273,"PossibleDataMissing":false,"StreamDirection":"FROM-to-TO"},{"JitterInterArrival":9,"JitterInterArrivalMax":22,"PacketLossRate":0.003282547,"PacketLossRateMax":0.4927536,"BurstDensity":null,"BurstDuration":null,"BurstGapDensity":null,"BurstGapDuration":null,"BandwidthEst":626065,"RoundTrip":72,"RoundTripMax":1249,"PacketUtilization":32292,"RatioConcealedSamplesAvg":0.008398115,"ConcealedRatioMax":null,"PayloadDescription":"SILKWide","AudioSampleRate":16000,"AudioFECUsed":true,"SendListenMOS":3.29,"OverallAvgNetworkMOS":null,"DegradationAvg":null,"DegradationMax":null,"NetworkJitterAvg":null,"NetworkJitterMax":null,"JitterBufferSizeAvg":null,"JitterBufferSizeMax":null,"PossibleDataMissing":false,"StreamDirection":"TO-to-FROM"}],"VideoStreams":[{"PossibleDataMissing":false,"VideoMediaLineLabelText":"main-video","JitterInterArrival":1,"JitterInterArrivalMax":19,"PacketLossRate":0.0002356738,"PacketLossRateMax":0.009090909,"BandwidthEst":2598927,"RoundTrip":81,"RoundTripMax":545,"PacketUtilization":55181,"PayloadDescription":"H264","VideoResolution":"424x240","VideoBitRateAvg":184640,"VideoBitRateMax":329133,"VideoFrameRateAvg":7.494197,"VideoPacketLossRate":0.0002356738,"VideoFrameLossRate":191.9469,"CIFQualityRatio":76,"VGAQualityRatio":3,"HD720QualityRatio":20,"NoneDropRatio":null,"SendCodecTypes":"","SendResolutionWidth":null,"SendResolutionHeight":null,"SendFrameRateAverage":12.81255,"SendBitRateMaximum":null,"SendBitRateAverage":null,"SendVideoStreamsMax":null,"VideoPostFECPLR":0.0001450063,"RecvCodecTypes":"H264 SW","RecvResolutionWidth":1280,"RecvResolutionHeight":720,"RecvFrameRateAverage":7.49366,"RecvBitRateMaximum":2350453,"RecvBitRateAverage":667126,"DynamicCapabilityPercent":0.0,"LowBitRateCallPercent":0.0,"LowFrameRateCallPercent":45.53571,"LowResolutionCallPercent":null,"DurationSeconds":1128.574,"IsAggregatedData":true,"UseForCallClassification":true,"StreamDirection":"FROM-to-TO"},{"PossibleDataMissing":false,"VideoMediaLineLabelText":"main-video","JitterInterArrival":1,"JitterInterArrivalMax":19,"PacketLossRate":0.000237157,"PacketLossRateMax":0.009090909,"BandwidthEst":778259,"RoundTrip":73,"RoundTripMax":531,"PacketUtilization":55170,"PayloadDescription":"H264","VideoResolution":"424x240","VideoBitRateAvg":210845,"VideoBitRateMax":445636,"VideoFrameRateAvg":7.499987,"VideoPacketLossRate":0.000237157,"VideoFrameLossRate":null,"CIFQualityRatio":null,"VGAQualityRatio":null,"HD720QualityRatio":null,"NoneDropRatio":null,"SendCodecTypes":"H264 HW","SendResolutionWidth":424,"SendResolutionHeight":240,"SendFrameRateAverage":7.499987,"SendBitRateMaximum":445636,"SendBitRateAverage":210845,"SendVideoStreamsMax":1,"VideoPostFECPLR":null,"RecvCodecTypes":"","RecvResolutionWidth":null,"RecvResolutionHeight":null,"RecvFrameRateAverage":null,"RecvBitRateMaximum":null,"RecvBitRateAverage":null,"DynamicCapabilityPercent":1.0,"LowBitRateCallPercent":null,"LowFrameRateCallPercent":null,"LowResolutionCallPercent":null,"DurationSeconds":1120.002,"IsAggregatedData":false,"UseForCallClassification":true,"StreamDirection":"TO-to-FROM"}],"AudioSignals":[{"PossibleDataMissing":false,"SubmittedByFromUser":false,"SendSignalLevel":-23,"RecvSignalLevel":-20,"SendNoiseLevel":-68,"RecvNoiseLevel":-61,"AudioSpeakerGlitchRate":0,"AudioMicGlitchRate":0,"VsEntryCauses":"","EchoEventCauses":"","RecvSignalLevelCh1":-20,"RecvSignalLevelCh2":null,"RecvNoiseLevelCh1":-61,"RecvNoiseLevelCh2":null,"SendSignalLevelCh1":-23,"SendSignalLevelCh2":null,"SendNoiseLevelCh1":-68,"SendNoiseLevelCh2":null,"RenderSignalLevel":0.0,"RenderNoiseLevel":0.0,"RenderLoopbackSignalLevel":-19.30759},{"PossibleDataMissing":false,"SubmittedByFromUser":true,"SendSignalLevel":-20,"RecvSignalLevel":-23,"SendNoiseLevel":-63,"RecvNoiseLevel":-64,"AudioSpeakerGlitchRate":0,"AudioMicGlitchRate":0,"VsEntryCauses":"","EchoEventCauses":"","RecvSignalLevelCh1":-23,"RecvSignalLevelCh2":null,"RecvNoiseLevelCh1":-64,"RecvNoiseLevelCh2":null,"SendSignalLevelCh1":-20,"SendSignalLevelCh2":null,"SendNoiseLevelCh1":-63,"SendNoiseLevelCh2":null,"RenderSignalLevel":0.0,"RenderNoiseLevel":0.0,"RenderLoopbackSignalLevel":-23.17426}],"AppSharingStreams":null,"FeedBackReports":null,"AudioClientEvents":[{"PossibleDataMissing":false,"SubmittedByFromUser":false,"NetworkSendQualityEventRatio":0.03,"NetworkReceiveQualityEventRatio":0.0,"NetworkDelayEventRatio":0.0,"NetworkBandwidthLowEventRatio":0.0,"CPUInsufficientEventRatio":0.0,"DeviceHalfDuplexAECEventRatio":0.0,"DeviceRenderNotFunctioningEventRatio":0.0,"DeviceCaptureNotFunctioningEventRatio":0.0,"DeviceGlitchesEventRatio":0.0,"DeviceLowSNREventRatio":0.0,"DeviceLowSpeechLevelEventRatio":0.0,"DeviceClippingEventRatio":0.03,"DeviceEchoEventRatio":0.0,"DeviceNearEndToEchoRatioEventRatio":0.0,"DeviceMultipleEndpointsEventCount":0,"DeviceHowlingEventCount":0,"DeviceRenderZeroVolumeEventRatio":0.0,"DeviceRenderMuteEventRatio":0.0},{"PossibleDataMissing":false,"SubmittedByFromUser":true,"NetworkSendQualityEventRatio":0.0,"NetworkReceiveQualityEventRatio":0.03,"NetworkDelayEventRatio":0.0,"NetworkBandwidthLowEventRatio":0.0,"CPUInsufficientEventRatio":0.0,"DeviceHalfDuplexAECEventRatio":0.0,"DeviceRenderNotFunctioningEventRatio":0.0,"DeviceCaptureNotFunctioningEventRatio":0.0,"DeviceGlitchesEventRatio":0.0,"DeviceLowSNREventRatio":0.0,"DeviceLowSpeechLevelEventRatio":0.0,"DeviceClippingEventRatio":0.0,"DeviceEchoEventRatio":0.0,"DeviceNearEndToEchoRatioEventRatio":0.0,"DeviceMultipleEndpointsEventCount":0,"DeviceHowlingEventCount":0,"DeviceRenderZeroVolumeEventRatio":0.0,"DeviceRenderMuteEventRatio":0.0}],"VideoClientEvents":[{"PossibleDataMissing":false,"VideoMediaLineLabel":"main-video","SubmittedByFromUser":false,"NetworkBandwidthLowEventRatio":0.0,"NetworkReceiveQualityEventRatio":0.0},{"PossibleDataMissing":false,"VideoMediaLineLabel":"main-video","SubmittedByFromUser":true,"NetworkBandwidthLowEventRatio":0.0,"NetworkReceiveQualityEventRatio":0.0}],"TraceRoutes":[{"PossibleDataMissing":false,"TraceRouteMediaLineLabelText":"main-audio","SubmittedByFromUser":false,"Hop":0,"IPAddress":"192.168.0.254","RTT":2},{"PossibleDataMissing":false,"TraceRouteMediaLineLabelText":"main-audio","SubmittedByFromUser":false,"Hop":1,"IPAddress":"88.168.20.254","RTT":57},{"PossibleDataMissing":false,"TraceRouteMediaLineLabelText":"main-audio","SubmittedByFromUser":false,"Hop":2,"IPAddress":"78.254.5.62","RTT":57},{"PossibleDataMissing":false,"TraceRouteMediaLineLabelText":"main-audio","SubmittedByFromUser":false,"Hop":3,"IPAddress":"78.254.255.161","RTT":59},{"PossibleDataMissing":false,"TraceRouteMediaLineLabelText":"main-audio","SubmittedByFromUser":false,"Hop":4,"IPAddress":"194.149.163.157","RTT":63},{"PossibleDataMissing":false,"TraceRouteMediaLineLabelText":"main-audio","SubmittedByFromUser":false,"Hop":5,"IPAddress":"194.149.163.90","RTT":62},{"PossibleDataMissing":false,"TraceRouteMediaLineLabelText":"main-audio","SubmittedByFromUser":false,"Hop":6,"IPAddress":"194.117.192.9","RTT":62},{"PossibleDataMissing":false,"TraceRouteMediaLineLabelText":"main-audio","SubmittedByFromUser":false,"Hop":7,"IPAddress":"212.194.171.144","RTT":65},{"PossibleDataMissing":false,"TraceRouteMediaLineLabelText":"main-audio","SubmittedByFromUser":false,"Hop":8,"IPAddress":"212.194.171.5","RTT":65},{"PossibleDataMissing":false,"TraceRouteMediaLineLabelText":"main-audio","SubmittedByFromUser":true,"Hop":0,"IPAddress":"192.168.1.254","RTT":4},{"PossibleDataMissing":false,"TraceRouteMediaLineLabelText":"main-audio","SubmittedByFromUser":true,"Hop":1,"IPAddress":"10.108.238.2","RTT":10},{"PossibleDataMissing":false,"TraceRouteMediaLineLabelText":"main-audio","SubmittedByFromUser":true,"Hop":2,"IPAddress":"212.194.171.4","RTT":13},{"PossibleDataMissing":false,"TraceRouteMediaLineLabelText":"main-audio","SubmittedByFromUser":true,"Hop":3,"IPAddress":"212.194.171.145","RTT":10},{"PossibleDataMissing":false,"TraceRouteMediaLineLabelText":"main-audio","SubmittedByFromUser":true,"Hop":5,"IPAddress":"194.149.162.85","RTT":13},{"PossibleDataMissing":false,"TraceRouteMediaLineLabelText":"main-audio","SubmittedByFromUser":true,"Hop":6,"IPAddress":"194.149.163.170","RTT":12},{"PossibleDataMissing":false,"TraceRouteMediaLineLabelText":"main-audio","SubmittedByFromUser":true,"Hop":7,"IPAddress":"78.254.255.162","RTT":12},{"PossibleDataMissing":false,"TraceRouteMediaLineLabelText":"main-audio","SubmittedByFromUser":true,"Hop":8,"IPAddress":"78.254.5.40","RTT":12},{"PossibleDataMissing":false,"TraceRouteMediaLineLabelText":"main-audio","SubmittedByFromUser":true,"Hop":9,"IPAddress":"88.168.20.106","RTT":58}]}

Coulmn值是JSON,您只需解析JSON并查找键值:

这是一个从您共享的JSON中提取(PacketLossRate)值的示例:

df['Stream_1_PacketLossRate'] = df['QoEReport']['AudioStreams'][0]['PacketLossRate']

可能您使用了错误的方法:该列中有某种JSON。还要注意列表中的dict。我认为这里应该避免使用正则表达式。您能否将数据作为son/json行对象获取?顺便说一句,您不需要在脚本中导入csv。它是列表中字典中的一个值,您可以解析字典并搜索dict键以查找PacketLossRate的值。@Quickbeam2k1感谢您的快速响应。是的,你是对的,以前有人建议我使用dict键,但我有点固执地想改变我的解决方案。现在我明白了!非常感谢@min2bro非常感谢。我还有一个问题要问。所以现在的基本步骤是首先将dataframe转换为json,然后再处理回dataframe,对吗?但是因为我只想处理一个
df
列,它包含json格式的数据。我只是将它们转换为json字符串列表?@Qucikbeam2k1 btw for json lines对象我想你的意思是将
df
中的列转换为json字符串列表?然后在处理后使用循环将它们逐个转换回
df
?这里有点困惑。。