Vino
Vino

Reputation: 13

Output Truncation in Google colab

[1]In google colab, While viewing the variable, it always truncates after a certain limit in the output screen

Colab, I tried to print the string as whole even characters but at the end it prints as (...)

import pandas as pd 
d = {'Title': ["Hello, hope you are doing good, every one is fine in your place"]}
m = pd.DataFrame(d)
m['Title']

output:

0 Hello, hope you are doing good, every one is f...

I need to view the full output as the whole string.

[Output is truncated] [1]: https://i.sstatic.net/ZZ7pJ.jpg

Upvotes: 1

Views: 15707

Answers (1)

Bob Smith
Bob Smith

Reputation: 38579

You're observing a 'feature' of Pandas wherein it truncates long strings when formatting DataFrame objects.

To configure the truncation limit, use:

pd.set_option('display.max_colwidth',1000)

(Of course, you can adjust the value 1000 to whatever you prefer.)

Afterward, your example will produce the expected output like so:

enter image description here

Upvotes: 7

Related Questions