커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
그래프 작성 에러
undefined주차
북마크
윤*중
댓글
2
추천
0
조회수
11
조회수
11
답변 완료

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

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



그래프 작성 중 에러 valueError입니다. 코드는 아래와 같습니다.



스파르타 즉문즉답



import pandas as pd

import numpy as np

import matplotlib.pyplot as plt

plt.rc('font', family='NanumBarunGothic') #한글 깨짐 방지 글꼴 설정


sparta_data = pd.read_table('user_db1.csv',sep=',')


sum_discouted_students = sparta_data[sparta_data==1].count()

sum_not_discounted_students = sparta_data[sparta_data==0].count()



#실제 결제 전환율 구하기

percent_discounted = sum_discouted_students/12000*100

percent_not_discounted = sum_not_discounted_students/12000*100


# print(percent_discounted, percent_not_discounted)


#그래프 사이즈

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

#x 그룹

x_list =["정가 구입 그룹", "할인 적용 그룹"]

#y 값

y_list = [percent_not_discounted, percent_discounted]

#x,y값 설정

plt.bar(x_list, y_list)

#그래프 타이틀

plt.title('할인 여부 결제 전환율 비교 분석')

#x축 레이블

plt.xlabel('할인 적용 여부')

#y축 레이블

plt.ylabel('결제 전환율')

#그래프 보여주기

plt.show()



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