ipython-sql
ipython-sql copied to clipboard
pandas dataframe display - hide index column
When displaying a pandas dataframe returned from a SQL query, the dataframe is displayed along with its index column.
It would be useful to display just the table as returned from the query, without the index column displayed.
I think this can be achieved by setting the style as follows:
df.style.set_table_styles([
{'selector': '.row_heading, .blank', 'props': [('display', 'none;')]}
])
Unfortunately, this does not seem to remove the index. Maybe I missed something?
I tried this instead and it works: print(summary_table_df.to_string(index=False))