我在这个位置“C:\ Users \ ASHWIN \ Desktop \ Test3_pcap.csv”中有网络流量数据。在该文件中包含frame.number,frame.time,eth.src,eth.dst,ip.src,ip.dst,ip.proto,tcp.stream,tcp.seq,tcp.ack,tcp.window_size和tcp。在列中划分的len。TCP时间序列图Ipython笔记本
而且我已经宣布我的IPython的笔记本电脑是在下面的一些导入文件:
from pandas import DataFrame, read_csv
import matplotlib.pyplot as plt
import pandas as pd
import sys
%matplotlib inline
我想用我的CSV文件,但其匝数很多错误做了TCP时间序列图绘制图。我做的示例代码并且出错如下:
fields=["tcp.stream", "ip.src", "ip.dst", "tcp.seq", "tcp.ack", "tcp.window_size", "tcp.len"]
ts=read_csv("C:\Users\ASHWIN\Desktop\Test3_pcap.csv", fields, timeseries=True, strict=True)
ts
stream=ts[ts["tcp.stream"] == 10]
print stream.to_string()
stream["type"] = stream.apply(lambda x: "client" if x["ip.src"] == stream.irow(0)["ip.src"] else "server", axis=1)
print stream.to_string()
client_stream=stream[stream.type == "client"]
client_stream["tcp.seq"].plot(style="r-o")
当我通过我的Ipython笔记本运行所有这8个代码时,它显示了很多错误。任何人都可以使用这个网络流量CSV文件解决我的问题。我想为csv格式的网络流量数据创建一个TCP时间序列图。我希望很多人都能解决我在这个ipython笔记本上的问题。谢谢。
我的代码:
from pandas import DataFrame, read_csv
import matplotlib.pyplot as plt
import pandas as pd
import sys
%matplotlib inline
Location = r'C:\Users\ASHWIN\Desktop\tempo\New folderTest3_pcap.csv'
fields=["tcp.stream", "ip.src", "ip.dst", "tcp.seq", "tcp.ack", "tcp.window_size", "tcp.len"]
ts=read_csv(Location, fields, timeseries=True, strict=True)
ts
这是错误我得到:
TypeError Traceback (most recent call last)
<ipython-input-6-ae8455b41c8b> in <module>()
1 Location = r'C:\Users\ASHWIN\Desktop\tempo\New folderTest3_pcap.csv'
2 fields=["tcp.stream", "ip.src", "ip.dst", "tcp.seq", "tcp.ack", "tcp.window_size", "tcp.len"]
----> 3 ts=read_csv(Location, fields, timeseries=True, strict=True)
4 ts
TypeError: parser_f() got an unexpected keyword argument 'timeseries'
的无效参数你能发布你收到的错误吗? – 2014-11-23 20:40:23