'Pandas truncating display even after setting max_colwidth to -1

I am learning text mining and was working on twitter data by following code from here

Although the code is for 2.xx I have converted it to 3.xx. I have only used the code till the graph to plot the top 5 countries after which I wanted to extract english only tweets from the data and write it to a text file, which I did as follows

eng_tweets = tweets.loc[tweets['lang'] == 'en', 'text']

with open('eng.txt', 'w', encoding='utf8') as engtweets:

    print(eng_tweets, file = engtweets)

While this does provide me with the english only tweets they are truncated (with ...) after about col 150 in notepad if they are quite a bit longer. I searched on stackexchange and found the solution, to set max_colwidth to -1, which I did as follows

pd.set_option('display.max_columns', None)  
pd.set_option('display.max_rows', None)
pd.set_option('display.max_colwidth', -1)
pd.set_option('display.width', 200)
pd.set_option('display.expand_frame_repr', False)
pd.set_option('display.float_format', '{:20,.2f}'.format)

Even then the text in the .txt file is truncated. Any help would be appreciated.

This is for extracting twitter data using tweepy.

EDIT Here are the links to the full code and part of the txt file I am working with

EDIT 2 Sorry, forgot to mention here are some of the current lines of text from the file "eng.

719 Nah... I saw Gerald’s Game on @Netflix 720 RT @AnnaApp91838450: The Obamas and Netflix Just Revealed the Shows and Films They’re Working On \nPatriots Time To S…

EDIT 3 I am a doofus. The commands are all working fine and thanks for the help but when it is an extended comment

 tweet['text'] 

Does not give the complete tweet. It has to be extracted from "extended_tweet" key.



Solution 1:[1]

I had the same problem and i solved with this:

pd.set_option('display.max_column', None)
pd.set_option('display.max_rows', None)
pd.set_option('display.max_seq_items', 500)
pd.set_option('display.max_colwidth', 500)
pd.set_option('expand_frame_repr', True)

or you can just set everything as None:

pd.set_option('display.max_column', None)
pd.set_option('display.max_rows', None)
pd.set_option('display.max_seq_items', None)
pd.set_option('display.max_colwidth', None)
pd.set_option('expand_frame_repr', True)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 nauel serraino