ipython-sql icon indicating copy to clipboard operation
ipython-sql copied to clipboard

pandas dataframe display - hide index column

Open psychemedia opened this issue 7 years ago • 1 comments

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;')]}
])

psychemedia avatar Jun 13 '18 15:06 psychemedia

Unfortunately, this does not seem to remove the index. Maybe I missed something?

summary_table

I tried this instead and it works: print(summary_table_df.to_string(index=False))

ELLowe avatar Jun 10 '19 00:06 ELLowe