inflearn logo
강의

Course

Instructor

Pandas Pandas Data Analysis Basics Practice

Create a data frame

attributeError가 발생합니다

774

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

로 수정하면 되더라구요.

random_state 값

0

16

2

강의 연장 문의 드립니다.

0

13

1

강의 연장 문의

0

44

1

오징어게임

0

53

1

object 컬럼이 여러 개인 경우 인코딩 전처리 방법

0

45

2

데이터 전처리 순서 관련

0

56

2

작업형2 모의문제 데이터 불러오기

0

58

2

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

0

350

1

dataframe append 불가능

0

3309

1

메모리 참조 오류?

0

372

0

if else 오류

0

292

1

행 삽입

0

362

1

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

0

290

1

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

0

352

1

pandas 설치 오류

2

1451

3

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

0

387

1

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

0

700

1

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

0

281

1

filter like

0

381

1

index 질문이요

0

272

1

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

1

264

0

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

0

411

1

future error

0

426

1

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

0

351

0