Issue
When I input a name of dataframe in jupyter-notebook, it prints a pretty table:
fail_data
It can even recognize the TeX notation.
But when I need to print the data in the cycle, the output looks not so good:
fail_data_gr = fail_data.groupby('test_name')
for k, v in fail_data_gr:
print(v)
How to make this output looking like the first one?
Solution
Displaying in jupyter notebooks delegate to the IPython.display
module. When printing inside a loop, print
dumps the __str__
representation of the DataFrame, which does no special rendering.
So, in summary, change
for k, v in fail_data_gr:
print(v)
to
from IPython.display import display
for k, v in fail_data_gr:
display(v)
Answered By - cs95
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.