0

I have a long dataframe which I want to send to a Gmail user. The method I´ve used is with pd.to_html(). Though I've been successful, the table is really long and not very readable. For one, with so many rows and columns (is a multi column levels table), the index and column names disappear and you are no longer able to know where each column comes from. Besides, I miss the possibility to filter further the table depending on what I'm looking for.

I've seen something like this http://tablefilter.free.fr to add to your html table, but I don't know how to make this work with my script, as it would probably be visualized on a gmail account rather than on a browser (perhaps the solution is sending a html file instead of the table embeded.

Also, I would like t make the index and column static s if I scroll down or sideways I can still be able to see them.

How can this be implemented?

EDIT: I've found this thread, which more or less does what I'm looking for. Still, I have no idea how to implement this on pd.to_html() Table header to stay fixed at the top when user scrolls it out of view with jQuery

EDIT 2: I did finalframe.to_html() and here there is a tiny part of the string, which includes the header and the first row of data.

'<table border="1" class="dataframe">\n  <thead>\n    <tr>\n      <th>generales</th>\n      <th>fecha</th>\n      <th>competicion</th>\n      <th>local</th>\n      <th>visitante</th>\n      <th>tracker</th>\n      <th colspan="44" halign="left">local</th>\n      <th colspan="44" halign="left">visitante</th>\n      <th>Predicciones</th>\n    </tr>\n    <tr>\n      <th>h/a o totales</th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th colspan="22" halign="left">h/a</th>\n      <th colspan="22" halign="left">totales</th>\n      <th colspan="22" halign="left">h/a</th>\n      <th colspan="22" halign="left">totales</th>\n      <th></th>\n    </tr>\n    <tr>\n      <th>tipo de dato</th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th colspan="14" halign="left">medias</th>\n      <th colspan="8" halign="left">porcentajes</th>\n      <th colspan="14" halign="left">medias</th>\n      <th colspan="8" halign="left">porcentajes</th>\n      <th colspan="14" halign="left">medias</th>\n      <th colspan="8" halign="left">porcentajes</th>\n      <th colspan="14" halign="left">medias</th>\n      <th colspan="8" halign="left">porcentajes</th>\n      <th></th>\n    </tr>\n    <tr>\n      <th>dato</th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th>partidos</th>\n      <th>puntos por partido</th>\n      <th>Goles a favor</th>\n      <th>desv GAF</th>\n      <th>Goles en contra</th>\n      <th>desv GEC</th>\n      <th>Goles HT favor</th>\n      <th>desv GHTF</th>\n      <th>Goles HT contra</th>\n      <th>desv GHTC</th>\n      <th>Corner a favor</th>\n      <th>desv CAF</th>\n      <th>Corner en contra</th>\n      <th>desv CEC</th>\n      <th>o2,5</th>\n      <th>o3,5</th>\n      <th>Gol al HT a favor</th>\n      <th>Gol al HT en contra</th>\n      <th>Gol al HT</th>\n      <th>fts</th>\n      <th>cs</th>\n      <th>bts</th>\n      <th>partidos</th>\n      <th>puntos por partido</th>\n      <th>Goles a favor</th>\n      <th>desv GAF</th>\n      <th>Goles en contra</th>\n      <th>desv GEC</th>\n      <th>Goles HT favor</th>\n      <th>desv GHTF</th>\n      <th>Goles HT contra</th>\n      <th>desv GHTC</th>\n      <th>Corner a favor</th>\n      <th>desv CAF</th>\n      <th>Corner en contra</th>\n      <th>desv CEC</th>\n      <th>o2,5</th>\n      <th>o3,5</th>\n      <th>Gol al HT a favor</th>\n      <th>Gol al HT en contra</th>\n      <th>Gol al HT</th>\n      <th>fts</th>\n      <th>cs</th>\n      <th>bts</th>\n      <th>partidos</th>\n      <th>puntos por partido</th>\n      <th>Goles a favor</th>\n      <th>desv GAF</th>\n      <th>Goles en contra</th>\n      <th>desv GEC</th>\n      <th>Goles HT favor</th>\n      <th>desv GHTF</th>\n      <th>Goles HT contra</th>\n      <th>desv GHTC</th>\n      <th>Corner a favor</th>\n      <th>desv CAF</th>\n      <th>Corner en contra</th>\n      <th>desv CEC</th>\n      <th>o2,5</th>\n      <th>o3,5</th>\n      <th>Gol al HT a favor</th>\n      <th>Gol al HT en contra</th>\n      <th>Gol al HT</th>\n      <th>fts</th>\n      <th>cs</th>\n      <th>bts</th>\n      <th>partidos</th>\n      <th>puntos por partido</th>\n      <th>Goles a favor</th>\n      <th>desv GAF</th>\n      <th>Goles en contra</th>\n      <th>desv GEC</th>\n      <th>Goles HT favor</th>\n      <th>desv GHTF</th>\n      <th>Goles HT contra</th>\n      <th>desv GHTC</th>\n      <th>Corner a favor</th>\n      <th>desv CAF</th>\n      <th>Corner en contra</th>\n      <th>desv CEC</th>\n      <th>o2,5</th>\n      <th>o3,5</th>\n      <th>Gol al HT a favor</th>\n      <th>Gol al HT en contra</th>\n      <th>Gol al HT</th>\n      <th>fts</th>\n      <th>cs</th>\n      <th>bts</th>\n      <th>Poisson o25</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>2018/08/28 10:30</td>\n      <td>ALG U21</td>\n      <td>CS Constantine U21</td>\n      <td>JS Saoura U21</td>\n      <td>1611191</td>\n      <td>1</td>\n      <td>3.000000</td>\n      <td>2.000000</td>\n      <td>0.000000</td>\n      <td>1.000000</td>\n      <td>0.000000</td>\n      <td>1.000000</td>\n      <td>0.000000</td>\n      <td>1.000000</td>\n      <td>0.000000</td>\n      <td>2.000000</td>\n      <td>0.000000</td>\n      <td>4.000000</td>\n      <td>0.000000</td>\n      <td>1.000000</td>\n      <td>0.000000</td>\n      <td>1.000000</td>\n      <td>1.000000</td>\n      <td>1.000000</td>\n      <td>0.000000</td>\n      <td>0.000000</td>\n      <td>1.000000</td>\n      <td>1</td>\n      <td>3.000000</td>\n      <td>2.000000</td>\n      <td>0.000000</td>\n      <td>1.000000</td>\n      <td>0.000000</td>\n      <td>1.000000</td>\n      <td>0.000000</td>\n      <td>1.000000</td>\n      <td>0.000000</td>\n      <td>2.000000</td>\n      <td>0.000000</td>\n      <td>4.000000</td>\n      <td>0.000000</td>\n      <td>1.000000</td>\n      <td>0.000000</td>\n      <td>1.000000</td>\n      <td>1.000000</td>\n      <td>1.000000</td>\n      <td>0.000000</td>\n      <td>0.000000</td>\n      <td>1.000000</td>\n      <td>1</td>\n      <td>0.000000</td>\n      <td>0.000000</td>\n      <td>0.000000</td>\n      <td>3.000000</td>\n      <td>0.000000</td>\n      <td>0.00</td>\n      <td>0.000000</td>\n      <td>2.000000</td>\n      <td>0.000000</td>\n      <td>6.000000</td>\n      <td>0.000000</td>\n      <td>1.000000</td>\n      <td>0.000000</td>\n      <td>1.000000</td>\n      <td>0.000000</td>\n      <td>0.000000</td>\n      <td>1.000000</td>\n      <td>1.000000</td>\n      <td>1.000000</td>\n      <td>0.000000</td>\n      <td>0.000000</td>\n      <td>2</td>\n      <td>1.500000</td>\n      <td>1.000000</td>\n      <td>1.000000</td>\n      <td>1.500000</td>\n      <td>1.500000</td>\n      <td>1.000000</td>\n      <td>1.000000</td>\n      <td>1.000000</td>\n      <td>1.000000</td>\n      <td>4.500000</td>\n      <td>1.500000</td>\n      <td>2.500000</td>\n      <td>1.500000</td>\n      <td>0.500000</td>\n      <td>0.000000</td>\n      <td>0.500000</td>\n      <td>0.500000</td>\n      <td>1.000000</td>\n      <td>0.50</td>\n      <td>0.500000</td>\n      <td>0.000000</td>\n      <td>0.576810</td>\n    </tr>\n'
puppet
  • 707
  • 3
  • 16
  • 33
  • Can you please provide examples? How does your input look? What do you want the output to look like? – Vivek Kalyanarangan Aug 28 '18 at 10:06
  • I'll try this night. But it is just a 300x90 matrix, and when you scroll down columns stop being on sight, and the same goes for indexes when scrolling right. What I want is, with `to_html()` or with other ways, be able to filter the table as the table in the link I provided does, and to have both columns and indexes visible all time, more or less like you can do with an Excel table. – puppet Aug 28 '18 at 15:40
  • I just provided extra information – puppet Aug 28 '18 at 21:05

0 Answers0