How to see more than five columns of a data frame output in PyCharm run window
已回答
Although I have some experience using R and RStudio for Data Science analysis, I am an absolute beginner with Python and PyCharm. In my work, I need to handle large data frame objects with 50 to 70 columns whose visualisation is very important. PyCharm run window allows for the visualization of just five columns and forces a page break making it difficult to see a larger number of columns side by side. At the same time, it leaves empty most of the right side of the window. I was not not able to work out a way to display columns all over the full width of the run window. I would be grateful if you guys could give me a hint to solve the this problem. Thank you.
请先登录再写评论。
import pandas as pd
import numpy as np
desired_width=320
pd.set_option('display.width', desired_width)
np.set_printoption(linewidth=desired_width)
pd.set_option('display.max_columns',10)
I found this info. from below.
https://stackoverflow.com/questions/25628496/getting-wider-output-in-pycharms-built-in-console
Also, if you use:
print(poke.to_string()) instead of print(poke.head(300)) , the whole data frame will be in the output. It is a pandas specific.
Hi! Instead of printing dataframe to console you can use "View as DataFrame" feature of PyCharm debugger.
"View as DataFrame" action is available in right-click menu from variables panel in debugger toolwindow if you select any dataframe. If you are not familiar with debugging in PyCharm please check this articles:
1) https://www.jetbrains.com/help/pycharm/2016.2/debugging.html
2) https://www.jetbrains.com/help/pycharm/2016.2/debug-tool-window-variables.html
yes Mr Happy2017mj This works good . There is minor typo maybe in the above code.
Here is the corrected one!
np.set_printoptions(linewidth=desired_width)
Hello,
It seems like only in debugging mode.
Please see: Viewing as array or DataFrame https://www.jetbrains.com/help/pycharm/viewing-as-array.html#view-as-array
or you can simply put
print(poke.head(300).to_string())
Hi is there some setting in PyCharm to print all data instead of "..."? I copy my python and run in cmd, it prints all data. But in PyCharm run window, it prints five columns and there is "..." in middle of columns. By the way I'm not using pandas or numpy, so I can't set_option() or something.
@Bejond
Please provide screenshot and code snippet to better demonstrate what you're talking about. For now I can assume you're executing the code in python console or with debugger, and it does shorten long dataframes.
And how to see more then 10 raws?