0

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)
2
  • The ellipses seems to suggest it's not showing the full dataset. Are you sure the all the data isn't there? Commented Aug 13, 2019 at 3:24
  • all the data is in the original file. the first print statement prints the entire intC.txt output; no idea why read_csv on that same file is not showing the full output. Further, i converted the text file to a csv file and executed read_csv directly on the converted file; no dice. However if i open the csv file on Excel spreadsheet, it has all the dataset. The question really is why read_csv isn't displaying the full dataset. I'm trying to sort the output by the 'RXBS' column so it's important I have everything printed and displayed properly. Commented Aug 13, 2019 at 3:27

3 Answers 3

1

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)
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks: where do i add the line? I added it just before this: data = pd.read_csv('intC.txt') No dice.
@wuki Is this on jupyter notebook or cmd?
0

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)

Comments

0

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

pd.set_option('max_colwidth', -1)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.