Le dimanche 23 août 2015 à 21:20 -0700, Robert Smith a écrit :
> Unfortunately, when it comes to displaying the columns in a front
> -end, there are actually two real columns. For example, this is the 
> output using IJulia:
> 
> In [18]: kc.get_iopub_msg(timeout=1)
> Out[18]:
> {'buffers': [],
>  'content': {u'data': {u'text/html': u'<table class="data
> -frame"><tr><th></th><th>x</th></tr><tr><th>1</th><td>1</td></tr><tr>
> <th>2</th><td>2</td></tr><tr><th>3</th><td>3</td></tr><tr><th>4</th><
> td>4</td></tr><tr><th>5</th><td>5</td></tr><tr><th>6</th><td>6</td></
> tr><tr><th>7</th><td>7</td></tr><tr><th>8</th><td>8</td></tr><tr><th>
> 9</th><td>9</td></tr><tr><th>10</th><td>10</td></tr><tr><th>11</th><t
> d>11</td></tr><tr><th>12</th><td>12</td></tr><tr><th>13</th><td>13</t
> d></tr><tr><th>14</th><td>14</td></tr><tr><th>15</th><td>15</td></tr>
> <tr><th>16</th><td>16</td></tr><tr><th>17</th><td>17</td></tr><tr><th
> >18</th><td>18</td></tr><tr><th>19</th><td>19</td></tr><tr><th>20</th
> ><td>20</td></tr><tr><th>21</th><td>21</td></tr><tr><th>22</th><td>22
> </td></tr><tr><th>23</th><td>23</td></tr><tr><th>24</th><td>24</td></
> tr><tr><th>25</th><td>25</td></tr><tr><th>26</th><td>26</td></tr><tr>
> <th>27</th><td>27</td></tr><tr><th>28</th><td>28</td></tr><tr><th>29<
> /th><td>29</td></tr><tr><th>30</th><td>30</td></tr><tr><th>&vellip;</
> th><td>&vellip;</td></tr></table>',
>    u'text/plain': u'100x1 DataFrame\n| Row | x   |\n|-----|-----|\n| 
> 1   | 1   |\n| 2   | 2   |\n| 3   | 3   |\n| 4   | 4   |\n| 5   | 5   
> |\n| 6   | 6   |\n| 7   | 7   |\n| 8   | 8   |\n| 9   | 9   |\n| 10 
>  | 10  |\n| 11  | 11  |\n\u22ee\n| 89  | 89  |\n| 90  | 90  |\n| 91 
>  | 91  |\n| 92  | 92  |\n| 93  | 93  |\n| 94  | 94  |\n| 95  | 95 
>  |\n| 96  | 96  |\n| 97  | 97  |\n| 98  | 98  |\n| 99  | 99  |\n| 100 
> | 100 |'},
>   u'execution_count': 2,
>   u'metadata': {}},
>  'header': {u'msg_id': u'12813207-38a2-4829-8b46-54dad551de04',
>   u'msg_type': 'execute_result',
>   u'session': u'8a7e3638-2b6a-4dd4-b834-6359b2a0a7dd',
>   u'username': u'user',
>   'version': '5.0'},
>  'metadata': {},
>  'msg_id': u'12813207-38a2-4829-8b46-54dad551de04',
>  'msg_type': 'execute_result',
>  'parent_header': {u'date': datetime.datetime(2015, 8, 23, 23, 5, 18, 
> 16122),
>   u'msg_id': u'1539d729-069b-4f27-90a2-3a3b7245e563',
>   u'msg_type': u'execute_request',
>   u'session': u'8a7e3638-2b6a-4dd4-b834-6359b2a0a7dd',
>   u'username': u'user'}}
> 
> So even If I include an additional index, I'm going to get three 
> columns because I can't get rid of the first one. Is there some way 
> to prevent printing that column?
Maybe it should not be printed by default? Showing line numbers can
indeed give the false impression that they are stable row identifiers.
Better leave the first column for an actual key added by the user.

An intermediate solution would be to show row numbers by default, but
allow the user to mark one of the column as being the key. If a key is
present, it would replace the row numbers in the display.


Regards

Reply via email to