---
# System prepended metadata

title: 測試取出分數級距分布資料畫Line Chart 第二版

---

# 測試取出分數級距分布資料畫Line Chart 第二版
```
# -*- coding: UTF-8 -*-

import pandas as pd

import matplotlib.pyplot as plt


dict_year = {}

temp04 = []
temp01 = []
temp02 = None


myfile = './學習紀錄.csv'
data = pd.read_csv(myfile, encoding='utf-8')
col_names = data.columns.values.tolist()
# print(col_names)
# print(len(col_names))
lists = data.values.tolist()
rows_num = len(lists)
# print(rows_num)
for i in range(rows_num):
    temp01.append(lists[i][0])
    temp02 = set(temp01)

temp01 = list(temp02)

print(temp01)
print(lists)
for year in temp01:
    temp03 = []
    for i in range(rows_num):
        myyears = lists[i][0]
        if myyears == year:
            temp03.append(lists[i][0:])

    dict_year[year] = temp03

print(dict_year)

years_len = len(dict_year[108])
# col_lens = len(col_names)
# print(col_lens)


for string01 in col_names[17:]:
    print(string01.split('.')[1][2:-3])
    temp04.append(string01.split('.')[1][2:-3])

for allyear in range(years_len):

    # print(col_names[6])
    # print(dict_year[108][allyear][6])
    # print(col_names[17:-1])
    # print(dict_year[108][allyear][17:-1])
    # print(len(col_names[17:-1]))
    # print(len(dict_year[108][allyear][17:-1]))
    plt.rcParams['font.sans-serif'] = ['Taipei Sans TC Beta']
    plt.plot(temp04, dict_year[108][allyear][17:],
             linestyle='--', marker='o', color='b')
    plt.title(dict_year[108][allyear][6]+'-' +
              str(dict_year[108][allyear][0])+'('+str(dict_year[108][allyear][1])+') 科目')
    plt.ylabel('比例')
    plt.xticks(rotation=90)
    plt.xlabel('本科目分數級距分布')
    plt.show()
```