Python

error) TypeError: first argument must be an iterable of pandas objects, you passed an object of type "Series"

summerorange 2022. 12. 22. 21:28
반응형

TypeError: first argument must be an iterable of pandas objects, you passed an object of type "Series"

pandas에서 series 잘못 연결할 경우에 나는 에러

TypeError                                 Traceback (most recent call last)
<ipython-input-432-6519c374ebef> in <module>
----> 1 pd.concat(s1, s5)

2 frames
/usr/local/lib/python3.8/dist-packages/pandas/core/reshape/concat.py in __init__(self, objs, axis, join, keys, levels, names, ignore_index, verify_integrity, copy, sort)
    327     ):
    328         if isinstance(objs, (ABCSeries, ABCDataFrame, str)):
--> 329             raise TypeError(
    330                 "first argument must be an iterable of pandas "
    331                 f'objects, you passed an object of type "{type(objs).__name__}"'

TypeError: first argument must be an iterable of pandas objects, you passed an object of type "Series"

잘못 연결해주었다.

pd.concat([s1, s5])

혹은 axis=1로 열 방향으로 해주면

pd.concat([s1, s5], axis=1)

에러는 나지 않음

반응형