Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop VS Code from truncating Python data in the console?

I'm opening a csv file in VS Code with Python. Your basic csv import. I know the complete csv data is reading properly because it's printing to macOS Terminal via Anaconda iPython as expected.

However, when I print the csv data to VS Code Interactive Window or VS Code iPython Window VS Code is truncating the data. It's not printing the csv header row and it's also truncating the length of the rest of the csv data and/or it starts the data output at some deep row like around row 1000.

The issue is not in code because it's printing fine in Terminal/iPython.

Naturally, I'm using the standard Microsoft Python extension and the iPython extension. The problem persists even when disabling one of them.

Is this a VS Code default preference issue?

VS Code Interactive Window
No header and following data is truncated both at beginning and end.
enter image description here
VS Code iPython Truncation
Again, no header, plus truncation.
enter image description here
Terminal/Conda iPython all good. Header and following data.
enter image description here

like image 436
Edison Avatar asked Dec 17 '22 15:12

Edison


1 Answers

You need to go to the Settings of the Python extension in VSCode and locate this setting:

Python › Data Science: Text Output Limit
Limit the amount of text in Python Interactive cell text output to this value. 0 to allow any amount of characters.

By default (for whatever reason) that is set to 2000. Change it to 0 to allow any number of characters showing in the output.

like image 193
universality Avatar answered Dec 22 '22 01:12

universality