Home > Software design >  How do i stop Vscode from truncating output of python dataframe column
How do i stop Vscode from truncating output of python dataframe column

Time:05-24

I've tried to mention pandas setting and set display width to no avail. I just want vscode to show me the full output. Some other posts said there was a setting called 'Data Science'. I could not find that anywhere in vscode.

This was a .py file it was running some other code which contain s3 bucket URLs which is why I refrained from showing the original code.

Nevertheless I can emulate the same in this simpler code snippet on another file which creates a dataframe as so.

import pandas as pd

df_col1 = [12132432432423432,32423432432534523,34354354353454333,44353453453453454,53454353453453453]
df_col2 = ['test_url_thats_too_big_to_display_here'   str(i) for I in df_col1]
df = pd.DataFrame(list(zip(df_col1, df_col2)), columns = ['a', 'b'])

print(df)

The above code creates 2 columns one with an id number and the other with an id appended with the URL. Below is the output of the code.

Original Code Output

CodePudding user response:

There is no reason to make data casting or novel series conversions. You can change pandas' configurations.

Check the documentation Output of changed print method

  • Related