我有一个Pandas数据框,经过一些清理后看起来像这样。
In [363]: treasury_yields_df
Out[363]:
1 1 mo 3 mo 6 mo 1 yr 2 yr 3 yr 5 yr 7 yr 10 yr 20 yr 30 yr
Date
2015-07-01 0.01 0.01 0.13 0.28 0.69 1.08 1.70 2.14 2.43 2.92 3.20
2015-07-02 0.01 0.01 0.10 0.26 0.64 1.01 1.64 2.09 2.40 2.90 3.19
2015-07-06 0.01 0.02 0.09 0.26 0.60 0.95 1.56 2.00 2.30 2.78 3.08
2015-07-07 0.02 0.02 0.08 0.25 0.58 0.96 1.55 1.98 2.27 2.74 3.04
2015-07-08 0.02 0.02 0.08 0.24 0.55 0.91 1.50 1.92 2.22 2.69 2.99
2015-07-09 0.02 0.03 0.08 0.25 0.60 0.95 1.58 2.01 2.32 2.80 3.11
2015-07-10 0.01 0.01 0.09 0.28 0.65 1.04 1.68 2.12 2.42 2.91 3.20
2015-07-13 0.02 0.02 0.10 0.28 0.69 1.06 1.71 2.14 2.44 2.92 3.21
2015-07-14 0.03 0.01 0.10 0.27 0.66 1.03 1.67 2.10 2.41 2.90 3.20
2015-07-15 0.03 0.02 0.11 0.28 0.64 1.00 1.63 2.05 2.36 2.83 3.13
我使用此数据框打印pandas to_html
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th>1</th>
<th>1 mo</th>
<th>3 mo</th>
<th>6 mo</th>
<th>1 yr</th>
<th>2 yr</th>
<th>3 yr</th>
<th>5 yr</th>
<th>7 yr</th>
<th>10 yr</th>
<th>20 yr</th>
<th>30 yr</th>
</tr>
<tr>
<th>Date</th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<th>2015-07-01</th>
<td>0.01</td>
<td>0.01</td>
<td>0.13</td>
<td>0.28</td>
<td>0.69</td>
<td>1.08</td>
<td>1.70</td>
<td>2.14</td>
<td>2.43</td>
<td>2.92</td>
<td>3.20</td>
</tr>
<tr>
<th>2015-07-02</th>
<td>0.01</td>
<td>0.01</td>
<td>0.10</td>
<td>0.26</td>
<td>0.64</td>
<td>1.01</td>
<td>1.64</td>
<td>2.09</td>
<td>2.40</td>
<td>2.90</td>
<td>3.19</td>
</tr>
<tr>
<th>2015-07-06</th>
<td>0.01</td>
<td>0.02</td>
<td>0.09</td>
<td>0.26</td>
<td>0.60</td>
<td>0.95</td>
<td>1.56</td>
<td>2.00</td>
<td>2.30</td>
<td>2.78</td>
<td>3.08</td>
</tr>
<tr>
<th>2015-07-07</th>
<td>0.02</td>
<td>0.02</td>
<td>0.08</td>
<td>0.25</td>
<td>0.58</td>
<td>0.96</td>
<td>1.55</td>
<td>1.98</td>
<td>2.27</td>
<td>2.74</td>
<td>3.04</td>
</tr>
<tr>
<th>2015-07-08</th>
<td>0.02</td>
<td>0.02</td>
<td>0.08</td>
<td>0.24</td>
<td>0.55</td>
<td>0.91</td>
<td>1.50</td>
<td>1.92</td>
<td>2.22</td>
<td>2.69</td>
<td>2.99</td>
</tr>
<tr>
<th>2015-07-09</th>
<td>0.02</td>
<td>0.03</td>
<td>0.08</td>
<td>0.25</td>
<td>0.60</td>
<td>0.95</td>
<td>1.58</td>
<td>2.01</td>
<td>2.32</td>
<td>2.80</td>
<td>3.11</td>
</tr>
<tr>
<th>2015-07-10</th>
<td>0.01</td>
<td>0.01</td>
<td>0.09</td>
<td>0.28</td>
<td>0.65</td>
<td>1.04</td>
<td>1.68</td>
<td>2.12</td>
<td>2.42</td>
<td>2.91</td>
<td>3.20</td>
</tr>
<tr>
<th>2015-07-13</th>
<td>0.02</td>
<td>0.02</td>
<td>0.10</td>
<td>0.28</td>
<td>0.69</td>
<td>1.06</td>
<td>1.71</td>
<td>2.14</td>
<td>2.44</td>
<td>2.92</td>
<td>3.21</td>
</tr>
<tr>
<th>2015-07-14</th>
<td>0.03</td>
<td>0.01</td>
<td>0.10</td>
<td>0.27</td>
<td>0.66</td>
<td>1.03</td>
<td>1.67</td>
<td>2.10</td>
<td>2.41</td>
<td>2.90</td>
<td>3.20</td>
</tr>
<tr>
<th>2015-07-15</th>
<td>0.03</td>
<td>0.02</td>
<td>0.11</td>
<td>0.28</td>
<td>0.64</td>
<td>1.00</td>
<td>1.63</td>
<td>2.05</td>
<td>2.36</td>
<td>2.83</td>
<td>3.13</td>
</tr>
</tbody>
</table>
我的问题是我不希望索引列标题上方的'1',我不知道如何访问该值以摆脱它。
理想情况下,我非常希望索引标题与HTML输出中的其他列标题一致,但这并非绝对必要。