0

I have many sets of data that need to be read into the same DataFrame The variable names of each group of data are data_1 data_2 ... etc.

So I hope that the data can be read in with one line of instructions instead of input line by line However, there seems to be something wrong with the characterization method. I have checked Google and have not seen similar problems, so I came up to ask you all, thank you.

And.. below is my try.

for i in range(40):
    test_frame.append([data_'%d'%(i)])
余昌翰
  • 63
  • 1
  • 7

1 Answers1

0

Been there, done that :)

since I don't know what's the type of data_x, I assume it is not a dataframe as you are using a list.

for i in range(40):
    test_frame = test_frame.append([data_'%d'%(i)])

If its a dataframe

for i in range(40):
    test_frame = test_frame.append(data_'%d'%(i))

Appending in pandas is not an in-place operation

nodaj
  • 60
  • 5