Конкатенация панд не работает должным образом - PullRequest
0 голосов
/ 20 июня 2019

Итак, я настраивал архив меток в своем классификаторе с углубленным изучением и хотел объединить метки уже существующего 2D-архива в один, который я только что создал.

То, что существует, это y_trainvalid (39209, 43), что означает 39209 изображений в 43 классах. Архив новой метки, который я пытаюсь добавить, это 'new_file_label' (23, 43). В этих архивах число устанавливается равным 1, если оно соответствует классу, и 0, если оно не соответствует. Вот образец их обоих:

print(y_trainvalid)
print(new_file_label)

       0    1    2    3    4    5    6   ...   36   37   38   39   40   41   42
0     0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
1     0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
2     0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
3     0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
4     0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  1.0  0.0  0.0  0.0  0.0
5     0.0  0.0  0.0  0.0  0.0  1.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
6     0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
7     0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  1.0  0.0  0.0  0.0
8     0.0  1.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
9     0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
10    0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
11    0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
12    0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
13    0.0  0.0  1.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
14    0.0  0.0  0.0  1.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
15    0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
16    0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
17    0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
18    0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
19    0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
20    0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
21    0.0  1.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
22    0.0  0.0  0.0  0.0  1.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
23    0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
24    0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
25    0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
26    0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
27    0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
28    0.0  0.0  1.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
29    0.0  0.0  0.0  0.0  0.0  1.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
...   ...  ...  ...  ...  ...  ...  ...  ...  ...  ...  ...  ...  ...  ...  ...
4380  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
4381  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
4382  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
4383  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
4384  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
4385  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
4386  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
4387  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
4388  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
4389  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
4390  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
4391  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
4392  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
4393  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
4394  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
4395  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
4396  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
4397  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
4398  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
4399  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
4400  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
4401  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
4402  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
4403  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
4404  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
4405  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
4406  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
4407  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
4408  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
4409  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0

[39209 rows x 43 columns]
      0    1    2    3    4    5    6  ...   36   37   38   39   40   41   42
0   0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
1   0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
2   0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
3   0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
4   0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
5   0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
6   0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
7   0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
8   0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
9   0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
10  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
11  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
12  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
13  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
14  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
15  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
16  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
17  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
18  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
19  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
20  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
21  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
22  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0

[23 rows x 43 columns]

Когда я пытался объединить с помощью этой команды:

y_trainvalid2 = pd.concat([y_trainvalid, new_file_label], ignore_index=True)

Нечто подобное появилось:

 0    1    2    3    4    5    6  ...   41   42    5    6    7    8    9
39204  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  NaN  NaN  NaN  NaN  NaN  NaN  NaN
39205  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  NaN  NaN  NaN  NaN  NaN  NaN  NaN
39206  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  NaN  NaN  NaN  NaN  NaN  NaN  NaN
39207  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  NaN  NaN  NaN  NaN  NaN  NaN  NaN
39208  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...  NaN  NaN  NaN  NaN  NaN  NaN  NaN
39209  NaN  NaN  NaN  NaN  NaN  NaN  NaN  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
39210  NaN  NaN  NaN  NaN  NaN  NaN  NaN  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
39211  NaN  NaN  NaN  NaN  NaN  NaN  NaN  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
39212  NaN  NaN  NaN  NaN  NaN  NaN  NaN  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
39213  NaN  NaN  NaN  NaN  NaN  NaN  NaN  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
39214  NaN  NaN  NaN  NaN  NaN  NaN  NaN  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
39215  NaN  NaN  NaN  NaN  NaN  NaN  NaN  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
39216  NaN  NaN  NaN  NaN  NaN  NaN  NaN  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
39217  NaN  NaN  NaN  NaN  NaN  NaN  NaN  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
39218  NaN  NaN  NaN  NaN  NaN  NaN  NaN  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
39219  NaN  NaN  NaN  NaN  NaN  NaN  NaN  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
39220  NaN  NaN  NaN  NaN  NaN  NaN  NaN  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
39221  NaN  NaN  NaN  NaN  NaN  NaN  NaN  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
39222  NaN  NaN  NaN  NaN  NaN  NaN  NaN  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
39223  NaN  NaN  NaN  NaN  NaN  NaN  NaN  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
39224  NaN  NaN  NaN  NaN  NaN  NaN  NaN  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
39225  NaN  NaN  NaN  NaN  NaN  NaN  NaN  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
39226  NaN  NaN  NaN  NaN  NaN  NaN  NaN  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
39227  NaN  NaN  NaN  NaN  NaN  NaN  NaN  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
39228  NaN  NaN  NaN  NaN  NaN  NaN  NaN  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
39229  NaN  NaN  NaN  NaN  NaN  NaN  NaN  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
39230  NaN  NaN  NaN  NaN  NaN  NaN  NaN  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0
39231  NaN  NaN  NaN  NaN  NaN  NaN  NaN  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0

Как будто он удваивает количество столбцов, чтобы соответствовать данным, вместо того, чтобы помещать новые данные чуть ниже него. Я не уверен, почему это происходит, потому что я почти уверен, что оба архива меток имеют одинаковое количество столбцов.

Когда я печатаю с помощью команды 'y_trainvalid2.head (). To_dict ()', это выглядит так:

{0: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '0': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 1: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '1': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 10: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '10': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 11: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '11': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 12: {0: 1.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '12': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 13: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '13': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 14: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '14': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 15: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '15': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 16: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '16': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 17: {0: 0.0, 1: 1.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '17': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 18: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '18': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 19: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '19': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 2: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '2': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 20: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '20': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 21: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '21': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 22: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '22': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 23: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '23': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 24: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '24': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 25: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '25': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 26: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '26': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 27: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '27': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 28: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '28': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 29: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '29': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 3: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '3': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 30: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '30': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 31: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '31': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 32: {0: 0.0, 1: 0.0, 2: 0.0, 3: 1.0, 4: 0.0},
 '32': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 33: {0: 0.0, 1: 0.0, 2: 1.0, 3: 0.0, 4: 0.0},
 '33': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 34: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '34': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 35: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '35': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 36: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '36': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 37: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '37': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 38: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 1.0},
 '38': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 39: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '39': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 4: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '4': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 40: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '40': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 41: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '41': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 42: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '42': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 5: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '5': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 6: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '6': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 7: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '7': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 8: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '8': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 9: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
 '9': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan}}

Как мне решить эту проблему?

1 Ответ

1 голос
/ 20 июня 2019
y_trainvalid.columns = [str(x) for x in y_trainvalid.columns]
new_file_label.columns = [str(x) for x in new_file_label.columns]
y_trainvalid2 = pd.concat([y_trainvalid, new_file_label])
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...