inflearn logo
강의

Course

Instructor

Pandas Pandas Data Analysis Basics Practice

Create a data frame

attributeError가 발생합니다

744

ldskoo12036160

1 asked

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

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

로 수정하면 되더라구요.

작업형 1 유형 부분

0

11

1

작업형 1 (삭제예정, 구 버전)

0

31

2

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

0

21

1

2유형 레이블 인코딩 VS 원핫 인코딩

0

24

3

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

0

26

1

인덱스 슬라이싱

0

27

2

Free Edition 실습 영상은 아직 업데이트전인가요?

0

22

1

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

0

311

1

dataframe append 불가능

0

3217

1

메모리 참조 오류?

0

330

0

if else 오류

0

255

1

행 삽입

0

326

1

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

0

267

1

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

0

312

1

pandas 설치 오류

2

1384

3

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

0

349

1

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

0

657

1

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

0

234

1

filter like

0

354

1

index 질문이요

0

232

1

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

1

222

0

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

0

368

1

future error

0

396

1

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

0

316

0