pandas data frame display help
I am using wing 8.3.0.3. I want to view a pandas data frame as a table. I remember seeing this work in the past in wing. I put the code below into a script and set a breakpoint on the line "stop=1". In the stack data tool when I right click on variable "df" and select Show Value as Array, I get a two column table. But each row in the table is some property of the object. I was expecting to see the the data ({'col1': [1, 2], 'col2': [3, 4]}) in a tabular form in the array viewer. I'm using python 3.7.7 and pandas 1.0.3.
import pandas as pd
d = {'col1': [1, 2], 'col2': [3, 4]}
df = pd.DataFrame(data=d)
stop=1
Comments
Are you saying that it's showing something like
<typename ...>
for the items? It seems to work for me with Pandas 1.4 and Python 3.10.0 . When I debug the above code and run to the stop=1 line and then display the array view and click on df in Stack Data then I see the numbers 1 3 on row 0 and 2 4 on row 1. Pandas 1.0.3 is pretty old so that may very well explain it.OTOH, one of us is also seeing this with pandas 1.4.2 so it may be some other factor. We're not sure yet what it could be.
The display tool is showing me a 2d table (I tried to paste in a markdown table but it is re-formatting it). It looks like exactly what you would get by doing a "dir(df)" if you removed the private variables.
Yea, it's showing the dict of the instance and not the array for some reason. We've reproduced it here on one machine and will try to fix it. Oddly it's not seen on other machines and does not seem to have anything to do with pandas or Python version or the Wing preferences so we don't yet know what causes it and don't have a work-around yet. We'll post again when we have a work-around or fix. Thanks for reporting this!