-1

I don't get how to do this. I'm trying the follow:

OutputData_tmp = pd.DataFrame(columns=('frame_len', 'frame_transport_protocol', 'ip_len', 'ip_ttl', 'ip_src', 'ip_dst', 'src_port', 'dst_port', 'payload_len', 'data_len'))

to create an empty dataframe, and then, inside a for loop I do:

OutputData_tmp.loc(line)

whit 'line' being a list of float values.

Then:

OutputData_tmp.to_csv('TrainingSet\\TrainingFeatures.csv')

to save the dataframe as csv.

But when I open TrainingFeatures.csv it is empty.. only have the header (columns names)

What???

sooaran
  • 183
  • 1
  • 2
  • 13

1 Answers1

0

You are adding row in a dataframe wrong.

Refer to following link for adding a row.

add one row in a pandas.DataFrame

Rather than doing OutputData_tmp.loc(line), do

OutputData_tmp.loc(i) = line

Hope this helps.