
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
[문의]
4주차 숙제 코딩을 해보고 있는데,

위와 같이 DataFrame() 및 .reset_index() 진행 후
plt.bar(students_by_discounted['discounted'], students_by_discounted['percent'])
위 코드를 통해 bar 그래프를 그리려고 하나,
결과값에 그래프 표현이 나타지 않음
문의)
1.그래프가 나타나지 않는 이유가 있으면 말씀 부탁 드립니다.
2.BAR 그래프 X축을 보면, students_by_discounted['discounted'] 입력을 했으므로 10000, 20000, 30000 으로
표현되어야 하는데, 연속성 있는 숫자로 표현 되는 이유가 궁금 합니다.
[전체 코드]
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
#한글 깨짐 방지 글꼴 설정
plt.rc('font', family='NanumBarunGothic')
sparta_data = pd.read_table('/content/user_db1.csv',sep=',')
sparta_data
sum_of_students_by_discounted = sparta_data[sparta_data['group']==1]['user_id'].count()
print(sum_of_students_by_discounted)
students_by_discounted = sparta_data[sparta_data['group']==1]
students_by_discounted = pd.DataFrame(students_by_discounted.groupby('discounted')['user_id'].count())
students_by_discounted = students_by_discounted.reset_index()
students_by_discounted['percent'] = students_by_discounted['user_id']/ sum_of_students_by_discounted *100
students_by_discounted
#plt.figure(width, height) : 넓이와 높이 만큼 이미지를 생성한다는 것을 말해줍니다!
plt.figure(figsize=(6,6))
#x,y값 설정
plt.bar(students_by_discounted['discounted'], students_by_discounted['percent'])
#그래프 타이틀
plt.title('할인액 별 결제 전환율 비교 분석')
#x축 레이블
plt.xlabel('할인액')
#y축 레이블
plt.ylabel('결제 전환율')
#그래프를 화면에 나타나도록 합니다.
plt.show()
작성한 코드 및 에러 메세지
[결과]

