Ask Your Question
1

pandas data frame display help

asked 2022-04-19 15:41:41 -0600

mbibee's avatar

updated 2022-05-02 11:42:18 -0600

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
edit retag flag offensive close merge delete

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.

Wingware Support's avatar Wingware Support  ( 2022-04-20 14:16:35 -0600 )edit

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.

Wingware Support's avatar Wingware Support  ( 2022-04-20 15:00:26 -0600 )edit

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.

| Array | Text       |
|-------|------------|
| T     | <property> |
| at    | <property> |
| attrs | <property> |
| axes  | <property> |
mbibee's avatar mbibee  ( 2022-04-21 12:59:51 -0600 )edit

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!

Wingware Support's avatar Wingware Support  ( 2022-04-21 14:00:38 -0600 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2022-04-22 11:01:03 -0600

updated 2022-05-02 11:43:03 -0600

It works if Resolve Properties is checked on the Debugger > Introspection page in the Preference dialog. It's a bug that it doesn't work if Resolve Properties is unchecked; this bug should be fixed in 8.3.1, when it becomes available.

edit flag offensive delete link more

Comments

I never would have found that. Works just like I remember it. Thanks!

mbibee's avatar mbibee  ( 2022-04-22 11:38:37 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2022-04-19 15:41:41 -0600

Seen: 100 times

Last updated: May 02