inflearn logo
강의

講義

知識共有

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

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

attributeError가 발생합니다

746

ldskoo12036160

投稿した質問数 1

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

Melody Shin

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) )

로 수정하면 되더라구요.

수강기간 연장 문의드립니다

0

2

1

로지스틱 회귀 데이터 누락 관련 질문

0

5

1

수강기간 연장 문의드립니다.

0

6

1

작업형1 - 연습문제 1번 관련 질문입니다.

0

29

2

강의 자료 16~39 관련

0

38

2

데이터 전처리 시 문의

0

40

2

random_state 값

0

35

2

applymap이 더 이상 권장되지 않는다고 하는데요

0

314

1

dataframe append 불가능

0

3233

1

메모리 참조 오류?

0

334

0

if else 오류

0

259

1

행 삽입

0

328

1

github cheetshit파일에 write dataframe to file 이후가 안 보입니다. 전체 파일 볼 수 있는 방법

0

268

1

input을 이용해서 원하는 행 추출

0

315

1

pandas 설치 오류

2

1388

3

컬럼명이 다를 경우 어떻게 합치나요?

0

350

1

df = pd.DataFrame.from_items(...)에서 AttributeError에 대한 추가 질문입니다.

0

662

1

선생님과 학생 나이 변경하는 부분 질문입니다.

0

238

1

filter like

0

356

1

index 질문이요

0

233

1

데이터프레임을 만들 때 딕셔너를 자주 쓰시는 이유가 있나요?

1

229

0

판다스로 생성된 데이터 프레임은 csv로 저장되나요?

0

373

1

future error

0

399

1

pandas.core.base.DataError: No numeric types to aggregate 라는 오류가 발생합니다.

0

319

0