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

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

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


4주차 숙제 3가지 질문

  1. 글꼴깨짐 방지 코드를 썼는데 그래프에 나올 때는 글꼴이 깨져서 나옵니다! 어떻게 해결하나요?(나눔폰트 다운받고 설정하는것하고나서도 그래프에 글꼴이 깨져서 나옵니다.)
  2. discounted를 값을 구하는 코드를 짤 때 students_discounted = sparta_data.groupby('discounted')['user_id'].count() 이거를 쓰는데 맨처음에 스튜던츠디스카운티드라고 하는 이유가 있나요? 스튜던트는 어디에 나와있어서 추가를 하는걸까요? 그냥 discounted = sparta_data. ~ 라고 하면 안되는건가요?
  3. 1만원 쿠폰 그룹, 2만원 쿠폰 그룹, 3만원 쿠폰 그룹 이라는 단어도 어디서 가져오는건가요? 엑셀에서 자료를 확인해도 group에 10000, 20000, 30000 이런식으로 숫자만 나와있는데 어디서 저렇게 단어를 가져오는가 싶어서요! 저런 단어는 제가 실질 업무에서 알아서 만들어야하는건가요?

(사진 1번으로 글꼴 설정 후 2번 -> 3번 그래프 나옴, 4번은 엑셀 파일 내용)

스파르타 즉문즉답스파르타 즉문즉답스파르타 즉문즉답스파르타 즉문즉답





!sudo apt-get install -y fonts-NanumBarunGothic
!sudo fc-cache -fv
!rm ~/.cache/matplatlib -rf


plt.rc('font', family='NanumBarunGothic')
[3]
5!sudo apt-get install -y fonts-NanumBarunGothic
!sudo fc-cache -fv
!rm ~/.cache/matplatlib -rf
plt.rc('font', family='NanumBarunGothic')
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package fonts-NanumBarunGothic
/usr/share/fonts: caching, new cache contents: 0 fonts, 1 dirs
/usr/share/fonts/truetype: caching, new cache contents: 0 fonts, 2 dirs
/usr/share/fonts/truetype/humor-sans: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/liberation: caching, new cache contents: 16 fonts, 0 dirs
/usr/local/share/fonts: caching, new cache contents: 0 fonts, 0 dirs
/root/.local/share/fonts: skipping, no such directory
/root/.fonts: skipping, no such directory
/usr/share/fonts/truetype: skipping, looped directory detected
/usr/share/fonts/truetype/humor-sans: skipping, looped directory detected
/usr/share/fonts/truetype/liberation: skipping, looped directory detected
/var/cache/fontconfig: cleaning cache directory
/root/.cache/fontconfig: not cleaning non-existent cache directory
/root/.fontconfig: not cleaning non-existent cache directory
fc-cache: succeeded



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=',')
#각 할인별 신청한 수강생 수 구하기
students_discounted = sparta_data.groupby('discounted')['user_id'].count()
students_discounted


#그래프 사이즈 
plt.figure(figsize=(10,5))
x_list =["1만원 쿠폰 그룹", "2만원 쿠폰 그룹", "3만원 쿠폰 그룹"]
#x,y값 설정
plt.bar(x_list, students_discounted)
#그래프 타이틀
plt.title('할인 율 별 수강 신청 자 수')
#x축 레이블
plt.xlabel('할인 적용 범위')
#y축 레이블
plt.ylabel('수업 신청한 수강생')
#그래프 보여주기
plt.show()

WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
/usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 49688 (\N{HANGUL SYLLABLE SU}) missing from current font.
  fig.canvas.print_figure(bytes_io, **kw)
/usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 50629 (\N{HANGUL SYLLABLE EOB}) missing from current font.
  fig.canvas.print_figure(bytes_io, **kw)
/usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 49888 (\N{HANGUL SYLLABLE SIN}) missing from current font.
  fig.canvas.print_figure(bytes_io, **kw)
/usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 52397 (\N{HANGUL SYLLABLE CEONG}) missing from current font.
  fig.canvas.print_figure(bytes_io, **kw)
/usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 54620 (\N{HANGUL SYLLABLE HAN}) missing from current font.
  fig.canvas.print_figure(bytes_io, **kw)
/usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 44053 (\N{HANGUL SYLLABLE GANG}) missing from current font.
  fig.canvas.print_figure(bytes_io, **kw)
/usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 49373 (\N{HANGUL SYLLABLE SAENG}) missing from current font.
  fig.canvas.print_figure(bytes_io, **kw)
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
/usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 54624 (\N{HANGUL SYLLABLE HAL}) missing from current font.
  fig.canvas.print_figure(bytes_io, **kw)
/usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 51064 (\N{HANGUL SYLLABLE IN}) missing from current font.
  fig.canvas.print_figure(bytes_io, **kw)
/usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 50984 (\N{HANGUL SYLLABLE YUL}) missing from current font.
  fig.canvas.print_figure(bytes_io, **kw)
/usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 48324 (\N{HANGUL SYLLABLE BYEOL}) missing from current font.
  fig.canvas.print_figure(bytes_io, **kw)
/usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 51088 (\N{HANGUL SYLLABLE JA}) missing from current font.
  fig.canvas.print_figure(bytes_io, **kw)
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
/usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 47564 (\N{HANGUL SYLLABLE MAN}) missing from current font.
  fig.canvas.print_figure(bytes_io, **kw)
/usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 50896 (\N{HANGUL SYLLABLE WEON}) missing from current font.
  fig.canvas.print_figure(bytes_io, **kw)
/usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 53216 (\N{HANGUL SYLLABLE KU}) missing from current font.
  fig.canvas.print_figure(bytes_io, **kw)
/usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 54256 (\N{HANGUL SYLLABLE PON}) missing from current font.
  fig.canvas.print_figure(bytes_io, **kw)
/usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 44536 (\N{HANGUL SYLLABLE GEU}) missing from current font.
  fig.canvas.print_figure(bytes_io, **kw)
/usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 47353 (\N{HANGUL SYLLABLE RUB}) missing from current font.
  fig.canvas.print_figure(bytes_io, **kw)
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
/usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 51201 (\N{HANGUL SYLLABLE JEOG}) missing from current font.
  fig.canvas.print_figure(bytes_io, **kw)
/usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 50857 (\N{HANGUL SYLLABLE YONG}) missing from current font.
  fig.canvas.print_figure(bytes_io, **kw)
/usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 48276 (\N{HANGUL SYLLABLE BEOM}) missing from current font.
  fig.canvas.print_figure(bytes_io, **kw)
/usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 50948 (\N{HANGUL SYLLABLE WI}) missing from current font.
  fig.canvas.print_figure(bytes_io, **kw)
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.



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