wuki
wuki

Reputation: 109

CSV file missing some fields when opening with pandas read_csv

when opening csv file with pandas read_csv, I noticed missing text from the output. See screen shot of the what the CSV file looks like when opened normally and also when opened using pandas read_csv:

enter image description here

I tried to execute csv_read on the csv file instead of the txt file but I'm getting the same results.

with open('intC.txt', 'w') as f:
    for line in output:
        f.write(line)

with open('intC.txt', 'r') as f1:
    for line in f1:
        print(line)

data = pd.read_csv('intC.txt')
print('\n')
print(data)

Upvotes: 0

Views: 336

Answers (3)

wuki
wuki

Reputation: 109

Actually tried running it with just this line and it also worked:

pd.set_option('max_colwidth', -1)

Upvotes: 0

wuki
wuki

Reputation: 109

pd.set_option('display.expand_frame_repr', False) alone didn't work; these three lines together work - i find that weird:

pd.set_option('display.max_columns', None)  
pd.set_option('display.expand_frame_repr', False)
pd.set_option('max_colwidth', -1)

Upvotes: 0

Axois
Axois

Reputation: 2061

They are not "missing", this just basically mean that they are too long to be printed in full. You can edit panda's settings by displaying all using the following

pd.set_option('display.expand_frame_repr', False)

Upvotes: 1

Related Questions