I was able to ingest a csv in jupyter notes by doing this :
csvData= pd.read_csv("logfile.csv")
My data looks like this:
event_timestamp ip url
2018-01-10 00:00 111.111.111.111 http://webpage1.com
2018-01-10 00:00 222.222.222.222 http://webpage2.com
...
..
.
I got a list of unique ips:
list_ips = csvData("[ip]")
What I'm trying to do is get a unique. Normally I would do:
list_ips.unique()
But in this case I get this error:
AttributeError: 'DataFrame' object has no attribute 'unique'
(I can use list_ips.head() and it will list a few IPs but it's not a unique list)
Thanks
EDIT
My problem is I actually had:
list_ips = csvData([["ip"]])
So I removed 1 set of brackets so it became:
list_ips = csvData(["ip"])
Then I was able to follow Wen's example and do:
list_ips.unique().tolist()
Output:
['111.111.111.111','222.222.222.222'...]
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…