print_all_characters_in_a_cell
print all characters in a cell
Issue: pandas does not print lengthy strings. Instead, it abbreviates them with '…'
Solution:
pd.set_option('max_colwidth', None)
Example:
Default behavior:
$ ipython Python 3.10.8 | packaged by conda-forge | (main, Nov 24 2022, 14:07:00) [MSC v.1916 64 bit (AMD64)] IPython 8.7.0 -- An enhanced Interactive Python. Type '?' for help. In [1]: import pandas as pd df = pd.DataFrame(['one', 'two', 'This is very long string very long string very long string veryvery long string']) print(df) 0 0 one 1 two 2 This is very long string very long string very...
When max_colwidth option is set to None
In [2]: pd.set_option('max_colwidth', None) print(df) 0 0 one 1 two 2 This is very long string very long string very long string veryvery long string
Ref:-
- https://pandas.pydata.org/docs/user_guide/options.html#available-options → search for max_colwidth
print_all_characters_in_a_cell.txt · Last modified: 2023/01/23 22:56 by admin