У меня есть dataframe, который выглядит так:
everything file_names searched_for_found file_id_value
0 <package_name = 'a.dtsx' a.dtsx where 0
6 'test all the things' a.dtsx where 1
12 'where' a.dtsx where 2
18 'group by eggs' a.dtsx where 3
24 'order by name' a.dtsx where 4
30 where col = 'thing' b.dtsx where 5
36 select col_1, col_2 b.dtsx where 6
42 from table b.dtsx where 7
52 id_value = '123abc' b.dtsx where 8 id_value_2 = '123'
62 'hello' b.dtsx where 9
Я запускаю это:
df_all_xml_mfiles_tgther = df_all_xml_mfiles.groupby(['file_names', 'searched_for_found'])['everything'].apply(' '.join).reset_index()
Я получаю сообщение об ошибке:
sequence item 2813: expected str instance, float found
Я не уверен, что я сделал не так, кто-нибудь сталкивался с этим раньше? Из того, что я могу сказать, ценности, которые я делаю в моей группе, - это все строки, нет?
У вас может быть NaN в столбцах все, добавляя fillna
до groupby
df_all_xml_mfiles.fillna('').groupby(['file_names', 'searched_for_found'])['everything'].apply(' '.join).reset_index()