First time here? Check out the FAQ!
1

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
mbibee's avatar
11
mbibee
asked 2022-04-19 15:41:41 -0500
Wingware Support's avatar
4k
Wingware Support
updated 2022-05-02 11:42:18 -0500
edit flag offensive 0 remove flag 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 -0500) 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 -0500) 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 -0500) 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 -0500) edit
add a comment see more comments

1 Answer

1

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.

Wingware Support's avatar
4k
Wingware Support
answered 2022-04-22 11:01:03 -0500, updated 2022-05-02 11:43:03 -0500
edit flag offensive 0 remove flag delete link

Comments

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

mbibee's avatar mbibee (2022-04-22 11:38:37 -0500) edit
add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer