강의

멘토링

로드맵

Inflearn コミュニティ Q&A

ldskoo12036160 のプロフィール画像
ldskoo12036160

投稿した質問数

Pandas Pandasのデータ分析基礎実習

データフレームを作成する

attributeError가 발생합니다

作成

·

744

0

friend_list = [
    ['name', ['John', 'Nate']],
     ['age', [20, 30]],
     ['job', ['student', 'teahcer']]
]


df = pd.DataFrame.from_items(friend_list)


위와 같이 할 경우에 아래와 같이 에러가 발생합니다.

type object 'DataFrame' has no attribute 'from_items'
pandas

回答 1

9

API 문서 보니까 이렇게 나오네요.

Deprecated since version 0.23.0: from_items is deprecated and will be removed in a future version. Use DataFrame.from_dict(dict(items)) instead. DataFrame.from_dict(OrderedDict(items)) may be used to preserve the key order.

위의 예제에서는 

df = pd.DataFrame.from_dict( dict(friend_list) )

로 수정하면 되더라구요.

ldskoo12036160 のプロフィール画像
ldskoo12036160

投稿した質問数

質問する