빅데이터 분석기사/퇴근 후 딴짓 3

pandas 1 axis=0, 1, describe(inclue='O'), astype() 유의

시리즈 만들기데이터프레임 만들기menu = pd.Series(['아아','아라','바콜'])menu # 데이터 프레임 만들기 pd.DataFrame({"컬럼명":데이터})pd.DataFrame({    'menu' : menu,    'price' : price}) object형 칼럼 기초통계Object의 Odescribe(include='O')# 기초 통계 (object)# O 는 알파벳 대문자 df.describe(include='O')  메뉴count 7unique 7top 아메리카노freq 1 결측값은 Numpy 패키지 사용# 결측값으로 추가, 원두 컬럼을 만들고 결측값(NaN)으로 대입# 결측값을 넣을 때는 np 사용함import numpy as npdf['원두'] = np.nandf 데이터 삭..

python 2, 3 - 인덱싱, 슬라이싱, 반복분 -enumerate(), def 함수

오류 모음1. AttributeError# 밸류 값# dictbox.values()# di에는 이런 속성이 없다는 의미 -> 오류 di.value()AttributeError: 'dict' object has no attribute 'value'2. IndexErrorlistbox = [2,4,6,8,10]# list[index] 원소 값# print(listbox[0]) # index 첫번째 값# print(listbox[3]) # index 3 (네번째)# python은 index는 0부터 시작함# 첫번째 인덱스 값을 출력하려면 0을 써야 함# 범위가 넘어섰다는 에러 메세지를 받게 됨 -> 오류listbox[5]IndexError: list index out of range3. NameError#..

python 1 - 주석 cltr + /, 내어쓰기 shift + tab

# 셀의 마지막 행에 입력했을 때는 print를 안 해도 출력이 됨# 하지막 두 줄 입력시에는 마지막 거가 나옴213456456  한 줄만 주석 처리(해제) : Ctrl + / (맥 Command + /)여러 줄 주석 처리(해제) : 블록지정 후 Ctrl + / (맥 Command + /)# 주석입니다.# 파이썬은 들여쓰기가 예민하고# 에러가 뜨면 들여쓰기가 잘못된 것임!# 주석쓰기 할 때 shift+ 3 을 누르는 사람 없음# ctrl + /를 입력해야 함 - 유용한 단축기임!!!!! print("파이썬 공부 중") # 출력문print("파이썬은 쉽다") File "", line 2 print("파이썬 공부 중") # 출력문 ^IndentationError: unexpected inde..