Reputation: 13914
When I print a DataFrame
it displays the dimensions of the object (n rows by k columns) at the bottom of the printout. So, for example:
import pandas as pd
df = pd.DataFrame({"A": [10,20,30,40,50], "B": [20, 30, 10, 40, 50], "C": [32, 234, 23, 23, 42523]})
print(df)
will display:
A B C
0 10 20 32
1 20 30 234
2 30 10 23
3 40 40 23
4 50 50 42523
[5 rows x 3 columns]
Is there a way to turn off the display of that final line [5 rows x 3 columns]
?
Upvotes: 1
Views: 933
Reputation: 879919
Yes! Use pd.options.display.show_dimensions = False
:
Here is the original repr:
In [118]: df
Out[118]:
A B C
0 10 20 32
1 20 30 234
2 30 10 23
3 40 40 23
4 50 50 42523
[5 rows x 3 columns]
After setting show_dimensions = False:
In [119]: pd.options.display.show_dimensions = False
In [120]: df
Out[120]:
A B C
0 10 20 32
1 20 30 234
2 30 10 23
3 40 40 23
4 50 50 42523
See the pd.get_option
docstring (print(pd.get_option.__doc__)
for more on all the options.
Upvotes: 2