我有一个很大的.csv文件,我正在阅读一个pandas数据帧。然后我遍历文件,一旦找到我正在寻找的值,我就使用dataR = df.append(data)。 .csv文件中有2列我读了一个(A列),其中值从1到3然后再从1到3再次重复,并再次像这样:注意B列不重复。 / p>
+-----+---+---+--+--+
| | A | B | | |
+-----+---+---+--+--+
| 288 | 1 | 4 | | |
+-----+---+---+--+--+
| 245 | 2 | 3 | | |
+-----+---+---+--+--+
| 543 | 3 | 6 | | |
+-----+---+---+--+--+
| 867 | 1 | 9 | | |
+-----+---+---+--+--+
| 345 | 2 | 7 | | |
+-----+---+---+--+--+
| 122 | 3 | 8 | | |
+-----+---+---+--+--+
| 233 | 1 | 1 | | |
+-----+---+---+--+--+
| 346 | 2 | 6 | | |
+-----+---+---+--+--+
| 765 | 3 | 3 | | |
+-----+---+---+--+--+
我想要做的不是将值附加为我想要将它们作为列附加的行:
+-----+---+---+-----+
| | A | B | C |
+-----+---+---+-----+
| 288 | 1 | 4 | 9 |
+-----+---+---+-----+
| 245 | 2 | 3 | 7 |
+-----+---+---+-----+
| 543 | 3 | 6 | 8 |
+-----+---+---+-----+
| 867 |NaN| 9 | 1 |
+-----+---+---+-----+
| 345 |NaN| 7 | 6 |
+-----+---+---+-----+
| 122 |NAN| 8 | 3 |
+-----+---+---+-----+
| 233 |NaN| 1 | NaN |
+-----+---+---+-----+
| 346 |NaN| 6 | NaN |
+-----+---+---+-----+
| 765 |NaN| 3 | NaN |
+-----+---+---+-----+
是否有为此设置的标志? dataR = df.append(data,flag =?)
由于