Home > other >  O god! Pandas only a DataFrame, how to merge the data
O god! Pandas only a DataFrame, how to merge the data

Time:12-02

 

The import pandas as pd
One=pd. DataFrame (columns=(" a ", "b", "c"))
For s in range (5) :
One=one. Append ([{" a ": [1 + s]," b ": [2 + s]," c ": [3 + s]}], ignore_index=True)
One1=pd. Concat ([one], axis=0, ignore_index=True)
Print (one1)


Demand is to all the lines together, using the concat function seems to be no, I don't know whether can only merge DataFrame more, a great god, please have other way?


CodePudding user response:

Solve the
 

The import pandas as pd
Two=pd. DataFrame ()
One=pd. DataFrame (columns=(" a ", "b", "c"))
For s in range (5) :
S=one. Append ([{" a ": [1 + s]," b ": [2 + s]," c ": [3 + s]}], ignore_index=True)
Two=pd. Concat ([two] s, ignore_index=True)
Print (two)


  • Related