The thing is that whenever I print a dataframe with a big amount of columns, visual studio decides to split them in two even tho they dont even fill half of the screen width. How can I stop it from doing this?
Thanks!
The thing is that whenever I print a dataframe with a big amount of columns, visual studio decides to split them in two even tho they dont even fill half of the screen width. How can I stop it from doing this?
Thanks!
This is not an "issue" of VisualStudio, but rather a feature of pandas.
You can use to_string
:
print(df.to_string())
Or increase the display.width
option:
pd.set_option('display.width', 500)
print(df)
Example:
col1 col2 col3 col4 col5 col6 col7 col8 col9 col10 col11 col12 col13 col14 col15 col16 col17 col18 col19 col20 col21 col22 col23 col24 col25 col26 col27 col28 col29 col30
0 abcdefghijkl abcdefghijkl abcdefghijkl abcdefghijkl abcdefghijkl abcdefghijkl abcdefghijkl abcdefghijkl abcdefghijkl abcdefghijkl abcdefghijkl abcdefghijkl abcdefghijkl abcdefghijkl abcdefghijkl abcdefghijkl abcdefghijkl abcdefghijkl abcdefghijkl abcdefghijkl abcdefghijkl abcdefghijkl abcdefghijkl abcdefghijkl abcdefghijkl abcdefghijkl abcdefghijkl abcdefghijkl abcdefghijkl abcdefghijkl
1 mnopqrstuvw mnopqrstuvw mnopqrstuvw mnopqrstuvw mnopqrstuvw mnopqrstuvw mnopqrstuvw mnopqrstuvw mnopqrstuvw mnopqrstuvw mnopqrstuvw mnopqrstuvw mnopqrstuvw mnopqrstuvw mnopqrstuvw mnopqrstuvw mnopqrstuvw mnopqrstuvw mnopqrstuvw mnopqrstuvw mnopqrstuvw mnopqrstuvw mnopqrstuvw mnopqrstuvw mnopqrstuvw mnopqrstuvw mnopqrstuvw mnopqrstuvw mnopqrstuvw mnopqrstuvw
Used input:
df = pd.DataFrame({f'col{i+1}': ['abcdefghijkl', 'mnopqrstuvw']
for i in range(20)})