커뮤니티
포인트
로딩중
쿠폰
내 강의실
국비 신청 내역
수강권
증명서
숙제 피드백
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
[2-6] 한걸음 더 예시 관련 질문 2개
[왕초보] 마케터, 기획자를 위한 실전 데이터 분석 v0
0주차
북마크
최*원
댓글
1
추천
0
조회수
12
조회수
12
답변 완료

* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.

* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.



titanic['Age'].hist(bins=40, gifsize=(18,8), grid=True)

> 실수로 figsize를 gifsize로 써서 출력하니 AttribueError가 발생!!!(그럼에도 표는 표출됨)

AttributeError Traceback (most recent call last)

<ipython-input-21-bf31e907de6a> in <cell line: 14>()

12

13

---> 14 titanic['Age'].hist(bins=40, gifsize=(18,8), grid=True)


5 frames

/usr/local/lib/python3.10/dist-packages/matplotlib/artist.py in _update_props(self, props, errfmt)

1195 func = getattr(self, f"set_{k}", None)

1196 if not callable(func):

-> 1197 raise AttributeError(

1198 errfmt.format(cls=type(self), prop_name=k))

1199 ret.append(func(v))


AttributeError: Rectangle.set() got an unexpected keyword argument 'gifsize'


1. 어떻게 된 영문인지 잘 모르겠습니다. unexpected keyword argument임에도 결과값이 동일하게 나오는 이유는 무엇인가요?


2. 마지막 코드를 붙이고 실행하는 과정에서 아래와 같이 예기치 못한 에러가 떴습니다. 어떻게 해결할 수 있나요?







</

import pandas as pd

import matplotlib.pyplot as plt

import numpy as np

import seaborn as sns

titanic = pd.read_table('train.csv',sep=',')

titanic.head()

print(titanic.isnull().sum())

titanic = titanic.dropna()

titanic.describe()

titanic['Age'].hist(bins=40, figsize=(18,8), grid=True)

#나이별 구분 및 각 나이별 생존율 확인 하기

titanic['Age_cat'] = pd.cut(titanic['Age'],bins=[0,3,7,15,30,60,100],include_lowest=True,labels=['baby','children','teenage','young','adult','old'])

#연령대를 기준으로 평균 값을 구해 볼수 있어요!

titanic.groupby('Age_cat').mean()

#그래프 크기 설정

plt.figure(figsize=(14,5))

# 바 그래프 그리기 (x축 = Age_cat, y축 = Survived)

sns.barplot('Age_cat','Survived', data=titanic)

# 그래프 나타내기

plt.show()

>


TypeError                                 Traceback (most recent call last)
<ipython-input-35-8543d52d205d> in <cell line: 26>()
     24 
     25 # 바 그래프 그리기 (x축 = Age_cat, y축 = Survived)
---> 26 sns.barplot('Age_cat','Survived', data=titanic)
     27 
     28 # 그래프 나타내기

TypeError: barplot() got multiple values for argument 'data'

취소
 공유
취소
댓글 0
댓글 알림
나의얼굴