Let's suppose that I have a big data in a csv file:
frame.number frame.len frame.cap_len frame.Type
1 100 100 ICMP
2 64 64 UDP
3 100 100 ICMP
4 87 64 ICMP
I want to change the type of the frame based on its length. The first problem is that I don't know how to extract the rank of the column, then change the frame typelike this:
if frame.len==100 then it puts frame.type=ICMP_tt else if frame.len==87 then it puts frame.type=ICMP_nn
I would like that it looks like this:
frame.number frame.len frame.cap_len frame.Type
1 100 100 ICMP_tt
2 64 64 UDP
3 100 100 ICMP_tt
4 87 64 ICMP_nn
I try by using this code but it doesn't make any modification.
import pandas
df = pandas.read_csv('Test.csv')
if df['frame.len'] == 100:
df['frame.type'].replace("ICMP_tt")
I would be very grateful if you could help me please.