question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Display Pandas DataFrames

See original GitHub issue

I really like how R displays Tibbles (basically extended Data Frames) to highlight important features (such as missing values, negative values, column types), for example:

Screen Shot 2020-06-02 at 16 40 42

The same data looks much less exciting when printing the Data Frame in Pandas:

Screen Shot 2020-06-02 at 16 42 24

I was wondering if Rich could be used to create a Tibble-like representation (i.e. colorize the index column, missing values, maybe even include the dtypes for each visible column)? If so, what would be a possible approach? Would it make sense to pass the full data frame contents or just the already formatted representation (returned by the Data Frame’s __repr__ method)?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:6
  • Comments:7

github_iconTop GitHub Comments

3reactions
willmcgugancommented, Jun 8, 2020

I’m not sure about building a column hiding feature in to the Table class itself. I suspect it would be hard to capture everyones use case. I think what I’ll do is provide a way of customizing what columns are shown based on the table width. That way the developer can implement their own logic.

0reactions
markmark1commented, Aug 22, 2021

how to get table representation from the panda dataframe will?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Display the Pandas DataFrame in table style - GeeksforGeeks
In this article, we'll see how we can display a DataFrame in the form of a table with borders around rows and columns....
Read more >
Python Pandas DataFrame: load, edit, view data | Shane Lynn
The DataFrame.head() function in Pandas, by default, shows you the top 5 rows of data in the DataFrame. The opposite is DataFrame.tail(), which ......
Read more >
Pretty Printing a pandas dataframe - python - Stack Overflow
I've just found a great tool for that need, it is called tabulate. It prints tabular data and works with DataFrame .
Read more >
How to print entire DataFrame in 10 different formats [Practical ...
1. Print entire DataFrame using set_option() method ... with this method, we can display n number of rows and columns. Syntax: # display...
Read more >
Table Visualization — pandas 1.5.2 documentation - PyData |
The DataFrame.style attribute is a property that returns a Styler object. ... You do not have to overwrite your DataFrame to display it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found