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:

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

data = pd.read_csv('intC.txt')

3 answers

  • answered 2019-08-13 03:24 Axois

    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)

  • answered 2019-08-13 04:00 wuki

    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)

  • answered 2019-08-13 04:04 wuki

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

    pd.set_option('max_colwidth', -1)