
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
titanic = pd.read_table('train.csv',sep=',')
#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-18-cca8ff81e48c> in <cell line: 19>()
17
18 # 바 그래프 그리기 (x축 = Age_cat, y축 = Survived)
---> 19 sns.barplot('Age_cat','Survived',data=titanic)
20
21 # 그래프 나타내기
TypeError: barplot() got multiple values for argument 'data'
SEARCH STACK OVERFLOW
<Figure size 1400x500 with 0 Axes>오류 발생 시, 작성한 코드 전체와 에러 메시지를 첨부해 주세요.
Tip 1) </> 아이콘을 눌러 코드박스를 만들어 보세요.
Tip 2) Ctrl+A(맥의 경우 Command+A) 단축키로 코드를 한 번에 선택할 수 있어요!
