У меня есть этот фрейм данных [code]transjakarta_lines = gpd.read_file('https://raw.githubusercontent.com/lokalhangatt/stackoverlow/refs/heads/main/dataviz_day13/transjakarta_lines.geojson') transjakarta_data = pd.read_excel("https://github.com/lokalhangatt/stackoverlow/raw/refs/heads/main/dataviz_day13/TJ_Agustus_2020.xlsx", index_col=0).T.reset_index() #transposed [/code] Это выглядит примерно так: [img]https://i.sstatic.net/Jfs3mrV2.png[/img] [img]https://i.sstatic.net/198gjdT3.png[/img] Я пытаюсь объединить эти два кадра данных. Но появляется такая ошибка:
File c:\Program Files\Python313\Lib\site-packages\pandas\core\apply.py:1427, in SeriesApply.apply(self) 1424 return self.apply_compat() 1426 # self.func is Callable -> 1427 return self.apply_standard()
File c:\Program Files\Python313\Lib\site-packages\pandas\core\apply.py:1507, in SeriesApply.apply_standard(self) 1501 # row-wise access 1502 # apply doesn't have a `na_action` keyword and for backward compat reasons 1503 # we need to give `na_action="ignore"` for categorical data. 1504 # TODO: remove the `na_action="ignore"` when that default has been changed in 1505 # Categorical (GH51645). 1506 action = "ignore" if isinstance(obj.dtype, CategoricalDtype) else None -> 1507 mapped = obj._map_values( 1508 mapper=curried, na_action=action, convert=self.convert_dtype 1509 ) 1511 if len(mapped) and isinstance(mapped[0], ABCSeries): 1512 # GH#43986 Need to do list(mapped) in order to get treated as nested 1513 # See also GH#25959 regarding EA support 1514 return obj._constructor_expanddim(list(mapped), index=obj.index)
File lib.pyx:2972, in pandas._libs.lib.map_infer()
ValueError: invalid literal for int() with base 10: 'Rata-rata Harlan' [/code] Если я не транспонирую transjakarta_data и попытаюсь применить(int), появится такая ошибка: [code]pd.read_excel("https://github.com/lokalhangatt/stackoverlow/raw/refs/heads/main/dataviz_day13/TJ_Agustus_2020.xlsx", index_col=0).reset_index().index.apply(int) [/code] Ошибка: [code]--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Cell In[255], line 1 ----> 1 pd.read_excel("https://github.com/lokalhangatt/stackoverlow/raw/refs/heads/main/dataviz_day13/TJ_Agustus_2020.xlsx", index_col=0).reset_index().index.apply(int)
AttributeError: 'RangeIndex' object has no attribute 'apply' [/code] Как это решить?