---
# System prepended metadata

title: 小火

---

# 小火
## 資料整理
```python
import pandas as pd
import numpy as np
```


```python
tb = pd.read_excel('./score.xlsx', sheet_name=None)
tb.pop('工作表1')
tb.keys()
tb['湘婷']
```




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>Unnamed: 0</th>
      <th>得分</th>
      <th>Unnamed: 2</th>
      <th>Unnamed: 3</th>
      <th>Unnamed: 4</th>
      <th>Unnamed: 5</th>
      <th>Unnamed: 6</th>
      <th>加權分數</th>
      <th>Unnamed: 8</th>
      <th>Unnamed: 9</th>
      <th>Unnamed: 10</th>
      <th>Unnamed: 11</th>
      <th>Unnamed: 12</th>
      <th>Unnamed: 13</th>
      <th>Unnamed: 14</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>NaN</td>
      <td>Aday</td>
      <td>祖愷</td>
      <td>花栗</td>
      <td>晉豪</td>
      <td>滿分</td>
      <td>NaN</td>
      <td>Aday</td>
      <td>祖愷</td>
      <td>花栗</td>
      <td>晉豪</td>
      <td>總分</td>
      <td>NaN</td>
      <td>等第</td>
      <td>分數</td>
    </tr>
    <tr>
      <th>1</th>
      <td>招式</td>
      <td>21</td>
      <td>20</td>
      <td>25</td>
      <td>25</td>
      <td>35</td>
      <td>NaN</td>
      <td>7</td>
      <td>0</td>
      <td>19.444444</td>
      <td>15.909091</td>
      <td>42.353535</td>
      <td>NaN</td>
      <td>1.512626</td>
      <td>10.588384</td>
    </tr>
    <tr>
      <th>2</th>
      <td>肢體</td>
      <td>15</td>
      <td>16</td>
      <td>18</td>
      <td>16</td>
      <td>25</td>
      <td>NaN</td>
      <td>6.25</td>
      <td>10.714286</td>
      <td>13.888889</td>
      <td>6.25</td>
      <td>37.103175</td>
      <td>NaN</td>
      <td>1.855159</td>
      <td>9.275794</td>
    </tr>
    <tr>
      <th>3</th>
      <td>編排</td>
      <td>15</td>
      <td>16</td>
      <td>15</td>
      <td>13</td>
      <td>20</td>
      <td>NaN</td>
      <td>6.666667</td>
      <td>6.666667</td>
      <td>10</td>
      <td>5</td>
      <td>28.333333</td>
      <td>NaN</td>
      <td>1.770833</td>
      <td>7.083333</td>
    </tr>
    <tr>
      <th>4</th>
      <td>服裝</td>
      <td>7</td>
      <td>8</td>
      <td>7</td>
      <td>8</td>
      <td>10</td>
      <td>NaN</td>
      <td>4</td>
      <td>5</td>
      <td>3.333333</td>
      <td>3.333333</td>
      <td>15.666667</td>
      <td>NaN</td>
      <td>1.958333</td>
      <td>3.916667</td>
    </tr>
    <tr>
      <th>5</th>
      <td>台風</td>
      <td>6</td>
      <td>7</td>
      <td>6</td>
      <td>7</td>
      <td>10</td>
      <td>NaN</td>
      <td>3.333333</td>
      <td>3.333333</td>
      <td>0</td>
      <td>2.5</td>
      <td>9.166667</td>
      <td>NaN</td>
      <td>1.145833</td>
      <td>2.291667</td>
    </tr>
    <tr>
      <th>6</th>
      <td>失誤</td>
      <td>2</td>
      <td>2</td>
      <td>2</td>
      <td>2</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>7</th>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>8</th>
      <td>總分</td>
      <td>62</td>
      <td>65</td>
      <td>69</td>
      <td>67</td>
      <td>NaN</td>
      <td>合計</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>9</th>
      <td>加權總分</td>
      <td>4.545455</td>
      <td>3.125</td>
      <td>10.15625</td>
      <td>6.818182</td>
      <td>NaN</td>
      <td>24.644886</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
  </tbody>
</table>
</div>



進行資料整理，整理完後輸出檢查


```python
for nn in tb.keys():
    i = 6
    while i <= 14:
        if i == 7:
            i += 1
            continue
        k = 'Unnamed: ' + str(i)
        try:
            tb[nn] = tb[nn].drop(columns=[k])
        except:
            i
        i += 1
    try:
        tb[nn] = tb[nn].drop(columns="加權分數")
        tb[nn] = tb[nn].drop([0, 7, 9])
        tb[nn] = tb[nn].rename(columns={'Unnamed: 0':'項目', '得分':'Aday', 'Unnamed: 2':'祖愷', 'Unnamed: 3':'花栗', 'Unnamed: 4': '晉豪', 'Unnamed: 5':'滿分'})
    except:
        print(f"{nn} error")
    tb[nn] = tb[nn].reset_index(drop=True)
    tb[nn] = tb[nn].T
    tb[nn] = tb[nn].reset_index()
    tb[nn] = tb[nn].rename(columns={'index': '評審', 0: '招式', 1: '肢體', 2: '編排', 3: '服裝', 4: '台風', 5: '失誤', 6: '總分'})
    tb[nn] = tb[nn].drop(0)
    tb[nn] = tb[nn].reset_index(drop=True)
    tb[nn] = tb[nn].rename(index={0: 'Aday', 1:'祖愷', 2: '花栗', 3: '晉豪', 4: '滿分'})
    tb[nn] = tb[nn].drop(columns=["評審"])
    tb[nn] = tb[nn].T
    tb[nn]["滿分"].astype(str)
    # tb[nn] = tb[nn].fillna(0)

tb['湘婷']

```




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>Aday</th>
      <th>祖愷</th>
      <th>花栗</th>
      <th>晉豪</th>
      <th>滿分</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>招式</th>
      <td>21</td>
      <td>20</td>
      <td>25</td>
      <td>25</td>
      <td>35</td>
    </tr>
    <tr>
      <th>肢體</th>
      <td>15</td>
      <td>16</td>
      <td>18</td>
      <td>16</td>
      <td>25</td>
    </tr>
    <tr>
      <th>編排</th>
      <td>15</td>
      <td>16</td>
      <td>15</td>
      <td>13</td>
      <td>20</td>
    </tr>
    <tr>
      <th>服裝</th>
      <td>7</td>
      <td>8</td>
      <td>7</td>
      <td>8</td>
      <td>10</td>
    </tr>
    <tr>
      <th>台風</th>
      <td>6</td>
      <td>7</td>
      <td>6</td>
      <td>7</td>
      <td>10</td>
    </tr>
    <tr>
      <th>失誤</th>
      <td>2</td>
      <td>2</td>
      <td>2</td>
      <td>2</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>總分</th>
      <td>62</td>
      <td>65</td>
      <td>69</td>
      <td>67</td>
      <td>NaN</td>
    </tr>
  </tbody>
</table>
</div>



這邊新增一個平均的 column


```python
for nn in tb.keys():
    tmp = tb[nn].iloc[:, 0:4].mean(1, skipna=True)
    tb[nn] = tb[nn].assign(平均=tmp)
```


往下四格，分別去搜集每個評審對於每位參賽者的評分


```python
aday = pd.DataFrame()
for nn in tb.keys():
    tmp = tb[nn].loc[:, "Aday"].copy()
    aday.loc[:, nn] = tmp
tmp = tb['湘婷'].loc[:, "滿分"]
aday.loc[:, "滿分"] = tmp
aday = aday.drop(index=['失誤', '總分'])
aday = aday.T
aday = aday.reset_index()
aday = aday.rename(columns={'index':'參賽者'})
aday
```




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>參賽者</th>
      <th>招式</th>
      <th>肢體</th>
      <th>編排</th>
      <th>服裝</th>
      <th>台風</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>湘婷</td>
      <td>21</td>
      <td>15</td>
      <td>15</td>
      <td>7</td>
      <td>6</td>
    </tr>
    <tr>
      <th>1</th>
      <td>秉宸</td>
      <td>29</td>
      <td>17</td>
      <td>18</td>
      <td>5</td>
      <td>10</td>
    </tr>
    <tr>
      <th>2</th>
      <td>家燦</td>
      <td>26</td>
      <td>18</td>
      <td>18</td>
      <td>6</td>
      <td>7</td>
    </tr>
    <tr>
      <th>3</th>
      <td>暄芳</td>
      <td>28</td>
      <td>18</td>
      <td>18</td>
      <td>7</td>
      <td>9</td>
    </tr>
    <tr>
      <th>4</th>
      <td>語萱</td>
      <td>21</td>
      <td>15</td>
      <td>15</td>
      <td>6</td>
      <td>4</td>
    </tr>
    <tr>
      <th>5</th>
      <td>意雯</td>
      <td>21</td>
      <td>14</td>
      <td>13</td>
      <td>6</td>
      <td>5</td>
    </tr>
    <tr>
      <th>6</th>
      <td>韋德</td>
      <td>23</td>
      <td>14</td>
      <td>16</td>
      <td>6</td>
      <td>6</td>
    </tr>
    <tr>
      <th>7</th>
      <td>灝維</td>
      <td>25</td>
      <td>18</td>
      <td>18</td>
      <td>10</td>
      <td>9</td>
    </tr>
    <tr>
      <th>8</th>
      <td>楷翔</td>
      <td>29</td>
      <td>18</td>
      <td>19</td>
      <td>6</td>
      <td>8</td>
    </tr>
    <tr>
      <th>9</th>
      <td>偉博</td>
      <td>27</td>
      <td>16</td>
      <td>15</td>
      <td>5</td>
      <td>6</td>
    </tr>
    <tr>
      <th>10</th>
      <td>旻萱</td>
      <td>19</td>
      <td>16</td>
      <td>18</td>
      <td>9</td>
      <td>7</td>
    </tr>
    <tr>
      <th>11</th>
      <td>滿分</td>
      <td>35</td>
      <td>25</td>
      <td>20</td>
      <td>10</td>
      <td>10</td>
    </tr>
  </tbody>
</table>
</div>




```python
zu = pd.DataFrame()
for nn in tb.keys():
    tmp = tb[nn].loc[:, "祖愷"].copy()
    zu.loc[:, nn] = tmp
tmp = tb['湘婷'].loc[:, "滿分"]
zu.loc[:, "滿分"] = tmp
zu = zu.drop(index=['失誤', '總分'])
zu = zu.T
zu = zu.reset_index()
zu = zu.rename(columns={'index':'參賽者'})
zu
```




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>參賽者</th>
      <th>招式</th>
      <th>肢體</th>
      <th>編排</th>
      <th>服裝</th>
      <th>台風</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>湘婷</td>
      <td>20</td>
      <td>16</td>
      <td>16</td>
      <td>8</td>
      <td>7</td>
    </tr>
    <tr>
      <th>1</th>
      <td>秉宸</td>
      <td>29</td>
      <td>19</td>
      <td>17</td>
      <td>8</td>
      <td>9</td>
    </tr>
    <tr>
      <th>2</th>
      <td>家燦</td>
      <td>23</td>
      <td>18</td>
      <td>16</td>
      <td>8</td>
      <td>8</td>
    </tr>
    <tr>
      <th>3</th>
      <td>暄芳</td>
      <td>20</td>
      <td>14</td>
      <td>15</td>
      <td>8</td>
      <td>7</td>
    </tr>
    <tr>
      <th>4</th>
      <td>語萱</td>
      <td>26</td>
      <td>14</td>
      <td>16</td>
      <td>8</td>
      <td>7</td>
    </tr>
    <tr>
      <th>5</th>
      <td>意雯</td>
      <td>20</td>
      <td>14</td>
      <td>16</td>
      <td>7</td>
      <td>6</td>
    </tr>
    <tr>
      <th>6</th>
      <td>韋德</td>
      <td>25</td>
      <td>13</td>
      <td>16</td>
      <td>7</td>
      <td>8</td>
    </tr>
    <tr>
      <th>7</th>
      <td>灝維</td>
      <td>30</td>
      <td>20</td>
      <td>18</td>
      <td>9</td>
      <td>9</td>
    </tr>
    <tr>
      <th>8</th>
      <td>楷翔</td>
      <td>30</td>
      <td>20</td>
      <td>17</td>
      <td>7</td>
      <td>9</td>
    </tr>
    <tr>
      <th>9</th>
      <td>偉博</td>
      <td>22</td>
      <td>15</td>
      <td>16</td>
      <td>7</td>
      <td>7</td>
    </tr>
    <tr>
      <th>10</th>
      <td>旻萱</td>
      <td>20</td>
      <td>15</td>
      <td>17</td>
      <td>9</td>
      <td>8</td>
    </tr>
    <tr>
      <th>11</th>
      <td>滿分</td>
      <td>35</td>
      <td>25</td>
      <td>20</td>
      <td>10</td>
      <td>10</td>
    </tr>
  </tbody>
</table>
</div>




```python
hao = pd.DataFrame()
for nn in tb.keys():
    tmp = tb[nn].loc[:, "晉豪"].copy()
    hao.loc[:, nn] = tmp
tmp = tb['湘婷'].loc[:, "滿分"]
hao.loc[:, "滿分"] = tmp
hao = hao.drop(index=['失誤', '總分'])
hao = hao.T
hao = hao.reset_index()
hao = hao.rename(columns={'index':'參賽者'})
hao
```




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>參賽者</th>
      <th>招式</th>
      <th>肢體</th>
      <th>編排</th>
      <th>服裝</th>
      <th>台風</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>湘婷</td>
      <td>25</td>
      <td>16</td>
      <td>13</td>
      <td>8</td>
      <td>7</td>
    </tr>
    <tr>
      <th>1</th>
      <td>秉宸</td>
      <td>29</td>
      <td>19</td>
      <td>15</td>
      <td>9</td>
      <td>10</td>
    </tr>
    <tr>
      <th>2</th>
      <td>家燦</td>
      <td>25</td>
      <td>15</td>
      <td>12</td>
      <td>7</td>
      <td>7</td>
    </tr>
    <tr>
      <th>3</th>
      <td>暄芳</td>
      <td>23</td>
      <td>14</td>
      <td>12</td>
      <td>9</td>
      <td>7</td>
    </tr>
    <tr>
      <th>4</th>
      <td>語萱</td>
      <td>21</td>
      <td>15</td>
      <td>13</td>
      <td>7</td>
      <td>7</td>
    </tr>
    <tr>
      <th>5</th>
      <td>意雯</td>
      <td>21</td>
      <td>14</td>
      <td>11</td>
      <td>7</td>
      <td>6</td>
    </tr>
    <tr>
      <th>6</th>
      <td>韋德</td>
      <td>28</td>
      <td>18</td>
      <td>14</td>
      <td>8</td>
      <td>7</td>
    </tr>
    <tr>
      <th>7</th>
      <td>灝維</td>
      <td>31</td>
      <td>22</td>
      <td>18</td>
      <td>10</td>
      <td>10</td>
    </tr>
    <tr>
      <th>8</th>
      <td>楷翔</td>
      <td>30</td>
      <td>21</td>
      <td>16</td>
      <td>7</td>
      <td>9</td>
    </tr>
    <tr>
      <th>9</th>
      <td>偉博</td>
      <td>27</td>
      <td>15</td>
      <td>14</td>
      <td>7</td>
      <td>8</td>
    </tr>
    <tr>
      <th>10</th>
      <td>旻萱</td>
      <td>20</td>
      <td>20</td>
      <td>19</td>
      <td>9</td>
      <td>8</td>
    </tr>
    <tr>
      <th>11</th>
      <td>滿分</td>
      <td>35</td>
      <td>25</td>
      <td>20</td>
      <td>10</td>
      <td>10</td>
    </tr>
  </tbody>
</table>
</div>




```python
li = pd.DataFrame()
for nn in tb.keys():
    tmp = tb[nn].loc[:, "花栗"].copy()
    li.loc[:, nn] = tmp
tmp = tb['湘婷'].loc[:, "滿分"]
li.loc[:, "滿分"] = tmp
li = li.drop(index=['失誤', '總分'])
li = li.T
li = li.reset_index()
li = li.rename(columns={'index':'參賽者'})
li
```




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>參賽者</th>
      <th>招式</th>
      <th>肢體</th>
      <th>編排</th>
      <th>服裝</th>
      <th>台風</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>湘婷</td>
      <td>25</td>
      <td>18</td>
      <td>15</td>
      <td>7</td>
      <td>6</td>
    </tr>
    <tr>
      <th>1</th>
      <td>秉宸</td>
      <td>31</td>
      <td>21</td>
      <td>18</td>
      <td>7</td>
      <td>7</td>
    </tr>
    <tr>
      <th>2</th>
      <td>家燦</td>
      <td>21</td>
      <td>18</td>
      <td>15</td>
      <td>8</td>
      <td>7</td>
    </tr>
    <tr>
      <th>3</th>
      <td>暄芳</td>
      <td>25</td>
      <td>21</td>
      <td>17</td>
      <td>7</td>
      <td>7</td>
    </tr>
    <tr>
      <th>4</th>
      <td>語萱</td>
      <td>19</td>
      <td>15</td>
      <td>12</td>
      <td>6</td>
      <td>6</td>
    </tr>
    <tr>
      <th>5</th>
      <td>意雯</td>
      <td>19</td>
      <td>15</td>
      <td>15</td>
      <td>7</td>
      <td>7</td>
    </tr>
    <tr>
      <th>6</th>
      <td>韋德</td>
      <td>24</td>
      <td>13</td>
      <td>12</td>
      <td>6</td>
      <td>6</td>
    </tr>
    <tr>
      <th>7</th>
      <td>灝維</td>
      <td>33</td>
      <td>21</td>
      <td>17</td>
      <td>8</td>
      <td>9</td>
    </tr>
    <tr>
      <th>8</th>
      <td>楷翔</td>
      <td>31</td>
      <td>19</td>
      <td>17</td>
      <td>6</td>
      <td>8</td>
    </tr>
    <tr>
      <th>9</th>
      <td>偉博</td>
      <td>27</td>
      <td>16</td>
      <td>15</td>
      <td>6</td>
      <td>7</td>
    </tr>
    <tr>
      <th>10</th>
      <td>旻萱</td>
      <td>15</td>
      <td>22</td>
      <td>16</td>
      <td>9</td>
      <td>8</td>
    </tr>
    <tr>
      <th>11</th>
      <td>滿分</td>
      <td>35</td>
      <td>25</td>
      <td>20</td>
      <td>10</td>
      <td>10</td>
    </tr>
  </tbody>
</table>
</div>




```python
import matplotlib.pyplot as plt
%matplotlib inline
plt.rcParams['font.sans-serif']=['SimHei']
plt.rcParams['font.family']='sans-serif' 
plt.rcParams['axes.unicode_minus'] = False

```

## 給分範圍分析

以下圖表目的是為了瞭解評審給予分數的範圍，由圖中可以發現，即便給予較大範圍的評分上下限，給分的範圍也沒有大幅度的增長


```python
# 1. 起始狀態
# 不需要做任何事情

# 2. 選則想要繪製的圖表
# 這個範例中我們繪製折線圖
plt.figure(figsize=(10, 10))

# 3. (可跳過) 設定圖表的圖例
# 這個範例中我們設定折線圖顏色為紅色且名稱為 my line

# 設定顏色, 折線名稱, 資料點外觀
color = 'red'              
label = 'my line'          
marker = 'o'
# 變更資料點外觀請參閱: https://matplotlib.org/stable/api/markers_api.html

# 4. 輸入資料

# 準備 x 軸資料
x = []
for i in range(11):
  for t in aday.columns[1:]:
    x.append(t)
# 準備 y 軸資料
yaday = aday.iloc[0:11, 1:]      
yhao = hao.iloc[0:11, 1:]      
yli = li.iloc[0:11, 1:]      
yzu = zu.iloc[0:11, 1:]      

plt.subplot(2, 2, 1)
plt.scatter(x, yaday)
plt.title('Aday')
plt.subplot(2, 2, 2)
plt.scatter(x, yzu)
plt.title('祖愷')
plt.subplot(2, 2, 3)
plt.scatter(x, yli)
plt.title('花栗')
plt.subplot(2, 2, 4)
plt.scatter(x, yhao)
plt.title('晉豪')
# target_plot(
#     # 輸入資料給折線圖
#     x,             
#     # 輸入資料給折線圖
#     y,             
#     # 設定顏色
#     color=color,   
#     # 設定折線名稱
#     label=label,   
#     # 設定資料點外觀
#     marker=marker
# ㄟ 

# 5. 執行 matplotlib.pyplot.show() 繪製圖表

# 如果有使用圖例, 則必須呼叫 matplotlib.pyplot.legend
                           
# 繪製圖表
plt.show()                 
```

![](https://i.imgur.com/ofpFrQh.png)


## 參賽者比較

這邊以參賽者為主體，搜集每位評審對於這位參賽者的給分，並且繪製成折線圖，當中包含平均分跟最高分兩條額外的線


```python
tbt = dict(tb)
for nn in tbt.keys():
  tbt[nn] = tbt[nn].T
  tbt[nn] = tbt[nn].reset_index()
  tbt[nn] = tbt[nn].rename(columns={'index':'評審'})

meanpoint = [(aday.loc[:11, '招式'].mean() + zu.loc[:11, '招式'].mean() + li.loc[:11, '招式'].mean() + hao.loc[:11, '招式'].mean())/4]
meanpoint.append((aday.loc[:11, '肢體'].mean() + zu.loc[:11, '肢體'].mean() + li.loc[:11, '肢體'].mean() + hao.loc[:11, '肢體'].mean())/4)
meanpoint.append((aday.loc[:11, '編排'].mean() + zu.loc[:11, '編排'].mean() + li.loc[:11, '編排'].mean() + hao.loc[:11, '編排'].mean())/4)
meanpoint.append((aday.loc[:11, '服裝'].mean() + zu.loc[:11, '服裝'].mean() + li.loc[:11, '服裝'].mean() + hao.loc[:11, '服裝'].mean())/4)
meanpoint.append((aday.loc[:11, '台風'].mean() + zu.loc[:11, '台風'].mean() + li.loc[:11, '台風'].mean() + hao.loc[:11, '台風'].mean())/4)

```


```python
count = 1
for nn in tbt.keys():
  plt.figure(figsize=(10, 10))
  x = tbt[nn].columns[1:-2]
  y1 = tbt[nn].iloc[0, 1:-2]
  y2 = tbt[nn].iloc[1, 1:-2]
  y3 = tbt[nn].iloc[2, 1:-2]
  y4 = tbt[nn].iloc[3, 1:-2]
  y5 = tbt[nn].iloc[4, 1:-2]
  y6 = meanpoint

  # plt.subplot(11, 1, count)
  count += 1

  plt.plot(x, y1)
  plt.plot(x, y2)
  plt.plot(x, y3)
  plt.plot(x, y4)
  plt.plot(x, y5, linestyle='--')
  plt.plot(x, y6, linestyle='--')

  plt.title(nn)
  nnn = tbt[nn].loc[:, '評審']
  nnn = nnn.replace('平均', '總體平均')
  plt.legend(nnn)
  plt.show()

```


### 湘婷
![](https://i.imgur.com/g4ZZ5Xn.png)
### 秉辰
![](https://i.imgur.com/vWKDdgV.png)
### 家燦
![](https://i.imgur.com/oba2BMD.png)
### 暄芳
![](https://i.imgur.com/QVUpk1O.png)
### 語萱
![](https://i.imgur.com/NmMFx42.png)
### 意雯
![](https://i.imgur.com/5j0sJH8.png)
### 韋德
![](https://i.imgur.com/eWgKNkK.png)
### 灝維
![](https://i.imgur.com/ydY68Io.png)
### 楷翔
![](https://i.imgur.com/aMmyHlA.png)
### 偉博
![](https://i.imgur.com/J2oRiDI.png)
### 旻萱
![](https://i.imgur.com/eHD8fGZ.png)


## 項目百分比

這邊以個別項目獲取分數在總體上的百分比來進行排名，並最後繪製成折線圖


```python
skill = dict()
body = dict()
alloc = dict()
cloth = dict()
stage = dict()
for nn in tb.keys():
    skill[nn] = tb[nn].iloc[0, 0:4].sum()
    body[nn] = tb[nn].iloc[1, 0:4].sum()
    alloc[nn] = tb[nn].iloc[2, 0:4].sum()
    cloth[nn] = tb[nn].iloc[3, 0:4].sum()
    stage[nn] = tb[nn].iloc[4, 0:4].sum()
    
total = pd.DataFrame(data={'招式':skill, '肢體': body, '編排': alloc, '服裝': cloth, '台風': stage})
skill = total['招式'].rank(ascending=True, pct=True)
skill = skill[:] * 100
skill = skill.sort_values(ascending=False)
body = total['肢體'].rank(ascending=True, pct=True)
body = body[:] * 100
body = body.sort_values(ascending=False)
alloc = total['編排'].rank(ascending=True, pct=True)
alloc = alloc[:] * 100
alloc = alloc.sort_values(ascending=False)
cloth = total['服裝'].rank(ascending=True, pct=True)
cloth = cloth[:] * 100
cloth = cloth.sort_values(ascending=False)
stage = total['台風'].rank(ascending=True, pct=True)
stage = stage[:] * 100
stage = stage.sort_values(ascending=False)
wholetmp = skill+body+alloc+cloth+stage
wholetmp.sort_values(ascending=False)
```




    灝維    490.909091
    秉宸    386.363636
    楷翔    372.727273
    旻萱    336.363636
    暄芳    318.181818
    家燦    277.272727
    湘婷    218.181818
    偉博    209.090909
    韋德    181.818182
    語萱    122.727273
    意雯     86.363636
    dtype: float64




```python
skill = pd.DataFrame(data={'招式':skill})
body = pd.DataFrame(data={'肢體':body})
alloc = pd.DataFrame(data={'編排':alloc})
cloth = pd.DataFrame(data={'服裝':cloth})
stage = pd.DataFrame(data={'台風':stage})
```


```python
x = ['招式', '肢體', '編排', '服裝', '台風']
plt.figure(figsize=(10, 10))
for i in stage.index:
  y = [skill.loc[i, skill.keys()]]
  y.append(body.loc[i, body.keys()])
  y.append(alloc.loc[i, alloc.keys()])
  y.append(cloth.loc[i, cloth.keys()])
  y.append(stage.loc[i, stage.keys()])
  plt.plot(x, y)

plt.legend(stage.index)

plt.show()
```

![](https://i.imgur.com/XRvnqmj.png)


## 排名方式計算

這邊以獲取分數的排名進行加總(算是模擬以分級制度來說的評分方式)，來進行排名。


```python
skill = total['招式'].rank(ascending=False)
# skill = pd.DataFrame(data={'招式':skill})
body = total['肢體'].rank(ascending=False)
# body = pd.DataFrame(data={'肢體':body})
alloc = total['編排'].rank(ascending=False)
# alloc = pd.DataFrame(data={'編排':alloc})
cloth = total['服裝'].rank(ascending=False)
# cloth = pd.DataFrame(data={'服裝':cloth})
stage = total['台風'].rank(ascending=False)
# stage = pd.DataFrame(data={'台風':stage})
skill = skill + body+alloc+cloth+stage
skill = skill.sort_values(ascending=True)
skill = pd.DataFrame(data={'rank':skill})
skill

```




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>rank</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>灝維</th>
      <td>6.0</td>
    </tr>
    <tr>
      <th>秉宸</th>
      <td>17.5</td>
    </tr>
    <tr>
      <th>楷翔</th>
      <td>19.0</td>
    </tr>
    <tr>
      <th>旻萱</th>
      <td>23.0</td>
    </tr>
    <tr>
      <th>暄芳</th>
      <td>25.0</td>
    </tr>
    <tr>
      <th>家燦</th>
      <td>29.5</td>
    </tr>
    <tr>
      <th>湘婷</th>
      <td>36.0</td>
    </tr>
    <tr>
      <th>偉博</th>
      <td>37.0</td>
    </tr>
    <tr>
      <th>韋德</th>
      <td>40.0</td>
    </tr>
    <tr>
      <th>語萱</th>
      <td>46.5</td>
    </tr>
    <tr>
      <th>意雯</th>
      <td>50.5</td>
    </tr>
  </tbody>
</table>
</div>

## 給分範圍映射

這邊是將評審給的分數，以最低分 map 到 0 ，最高分 map 到最大值的方式重新計算選手獲得的分數。


```python
adaymax = aday.iloc[:11, 1:].max()
adaymin = aday.iloc[:11, 1:].min() 
adaycut =  aday.iloc[11, 1:]/(adaymax - adaymin)
tmpaday = (aday.iloc[:11, 1:] - adaymin) * adaycut
tmpaday.insert(0, '參賽者', aday.iloc[:, 0])
haomax = hao.iloc[:11, 1:].max()
haomin = hao.iloc[:11, 1:].min() 
haocut =  hao.iloc[11, 1:]/(haomax - haomin)
tmphao = (hao.iloc[:11, 1:] - haomin) * haocut
tmphao.insert(0, '參賽者', hao.iloc[:, 0])
limax = li.iloc[:11, 1:].max()
limin = li.iloc[:11, 1:].min() 
licut =  li.iloc[11, 1:]/(limax - limin)
tmpli = (li.iloc[:11, 1:] - limin) * licut
tmpli.insert(0, '參賽者', li.iloc[:, 0])
zumax = zu.iloc[:11, 1:].max()
zumin = zu.iloc[:11, 1:].min() 
zucut =  zu.iloc[11, 1:]/(zumax - zumin)
tmpzu = (zu.iloc[:11, 1:] - zumin) * zucut
tmpzu.insert(0, '參賽者', zu.iloc[:, 0])
```


```python
totaltmp = tmpzu.iloc[:, 1:]+tmpaday.iloc[:, 1:]+tmphao.iloc[:, 1:]+tmpli.iloc[:, 1:]
totaltmp.insert(0, '參賽者', tmpaday.iloc[:, 0])
totaltmp = totaltmp.assign(總分=totaltmp.iloc[:, 1:].sum(1))
totaltmp.loc[:, '平均'] = totaltmp.loc[:, '總分'] / 4
totaltmp.sort_values('總分', ascending=False)
```




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>參賽者</th>
      <th>招式</th>
      <th>肢體</th>
      <th>編排</th>
      <th>服裝</th>
      <th>台風</th>
      <th>總分</th>
      <th>平均</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>7</th>
      <td>灝維</td>
      <td>126.0</td>
      <td>97.222222</td>
      <td>70.833333</td>
      <td>36.666667</td>
      <td>38.333333</td>
      <td>369.055556</td>
      <td>92.263889</td>
    </tr>
    <tr>
      <th>8</th>
      <td>楷翔</td>
      <td>132.929293</td>
      <td>88.541667</td>
      <td>62.5</td>
      <td>2.0</td>
      <td>30.833333</td>
      <td>316.804293</td>
      <td>79.201073</td>
    </tr>
    <tr>
      <th>1</th>
      <td>秉宸</td>
      <td>126.247475</td>
      <td>78.025794</td>
      <td>60.0</td>
      <td>15.0</td>
      <td>33.333333</td>
      <td>312.606602</td>
      <td>78.151650</td>
    </tr>
    <tr>
      <th>2</th>
      <td>家燦</td>
      <td>62.575758</td>
      <td>59.871032</td>
      <td>35.833333</td>
      <td>13.666667</td>
      <td>17.5</td>
      <td>189.446789</td>
      <td>47.361697</td>
    </tr>
    <tr>
      <th>10</th>
      <td>旻萱</td>
      <td>0.0</td>
      <td>63.392857</td>
      <td>63.333333</td>
      <td>34.666667</td>
      <td>23.333333</td>
      <td>184.726190</td>
      <td>46.181548</td>
    </tr>
    <tr>
      <th>3</th>
      <td>暄芳</td>
      <td>60.489899</td>
      <td>50.793651</td>
      <td>35.833333</td>
      <td>19.0</td>
      <td>17.5</td>
      <td>183.616883</td>
      <td>45.904221</td>
    </tr>
    <tr>
      <th>9</th>
      <td>偉博</td>
      <td>80.606061</td>
      <td>31.10119</td>
      <td>30.833333</td>
      <td>0.0</td>
      <td>15.0</td>
      <td>157.540584</td>
      <td>39.385146</td>
    </tr>
    <tr>
      <th>0</th>
      <td>湘婷</td>
      <td>42.353535</td>
      <td>37.103175</td>
      <td>28.333333</td>
      <td>15.666667</td>
      <td>9.166667</td>
      <td>132.623377</td>
      <td>33.155844</td>
    </tr>
    <tr>
      <th>6</th>
      <td>韋德</td>
      <td>74.454545</td>
      <td>12.5</td>
      <td>24.166667</td>
      <td>5.333333</td>
      <td>12.5</td>
      <td>128.954545</td>
      <td>32.238636</td>
    </tr>
    <tr>
      <th>4</th>
      <td>語萱</td>
      <td>38.959596</td>
      <td>18.501984</td>
      <td>18.333333</td>
      <td>7.0</td>
      <td>5.833333</td>
      <td>88.628247</td>
      <td>22.157062</td>
    </tr>
    <tr>
      <th>5</th>
      <td>意雯</td>
      <td>17.959596</td>
      <td>9.126984</td>
      <td>16.666667</td>
      <td>5.333333</td>
      <td>5.0</td>
      <td>54.086580</td>
      <td>13.521645</td>
    </tr>
  </tbody>
</table>
</div>



全部做完之後，可以發現，除了最後一種將評審給分進行映射的方式之外，前五名的人選基本沒有變動，所以也可以表示說，不論今天的評分方式是什麼，基本上都可以最大程度的去反映出評審對於表演的看法與想法。

## 依據給分範圍映射分別對選手進行分析

```python
tmpaday = tmpaday.set_index(tmpaday.loc[:, '參賽者'].values)
tmpaday = tmpaday.drop(columns=["參賽者"])
tmpaday = tmpaday.T
tmphao = tmphao.set_index(tmphao.loc[:, '參賽者'].values)
tmphao = tmphao.drop(columns=["參賽者"])
tmphao = tmphao.T
tmpli = tmpli.set_index(tmpli.loc[:, '參賽者'].values)
tmpli = tmpli.drop(columns=["參賽者"])
tmpli = tmpli.T
tmpzu = tmpzu.set_index(tmpzu.loc[:, '參賽者'].values)
tmpzu = tmpzu.drop(columns=["參賽者"])
tmpzu = tmpzu.T

meanpoint = (tmpaday.mean(1) + tmpli.mean(1) + tmphao.mean(1) + tmpzu.mean(1)) / 4

for nn in tbt.keys():
    plt.figure(figsize=(10, 10))
    x = tmpzu.index
    y1 = tmpaday.loc[:, nn]
    y2 = tmpzu.loc[:, nn]
    y3 = tmpli.loc[:, nn]
    y4 = tmphao.loc[:, nn]
    y5 = [35, 25, 20, 10, 10]
    y6 = meanpoint
    plt.plot(x, y1)
    plt.plot(x, y2)
    plt.plot(x, y3)
    plt.plot(x, y4)
    plt.plot(x, y5, linestyle='--')
    plt.plot(x, y6, linestyle='--')
    plt.title(nn)
    plt.legend(['Aday', '祖愷', '花栗', '晉豪', '最高', '平均'])
    plt.show()
```
### 湘婷
![](https://i.imgur.com/9IvheZ2.png)
### 秉辰
![](https://i.imgur.com/UPhbGCR.png)
### 家燦
![](https://i.imgur.com/hWNRFpR.png)
### 暄芳
![](https://i.imgur.com/VzTK0LB.png)
### 語萱
![](https://i.imgur.com/piJCdZB.png)
### 意雯
![](https://i.imgur.com/3duxtqv.png)
### 韋德
![](https://i.imgur.com/ASTdJYG.png)
### 灝維
![](https://i.imgur.com/FDNdAew.png)
### 楷翔
![](https://i.imgur.com/4gew5zB.png)
### 偉博
![](https://i.imgur.com/62QMYlv.png)
### 旻萱
![](https://i.imgur.com/yBuqoOc.png)