Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add 'df' as alias for pd.DataFrame in options #1533

Closed
fzumstein opened this issue Mar 3, 2021 · 4 comments
Closed

add 'df' as alias for pd.DataFrame in options #1533

fzumstein opened this issue Mar 3, 2021 · 4 comments
Milestone

Comments

@fzumstein
Copy link
Member

Reading can be a bit verbose for something so basic. Instead of:

df = mysheet['A1'].expand().options(pd.DataFrame).value

or

df = mysheet['A1'].options(pd.DataFrame, expand='table').value

You could do:

df = mysheet['A1'].options('df', expand='table').value

Maybe it should even default to expand='table' which would simplify things to:

df = mysheet['A1'].options('df').value

The behavior of pd.DataFrame could be left as-is to be backward compatible.

Opinions?

@fzumstein fzumstein added this to the 0.22.4 milestone Mar 3, 2021
@ericbmoreira
Copy link

I like the idea but I had a bunch of issues with expand='table', so I'm not sure if I like that as a default. Maybe I am an outlier.

Thanks.

@fzumstein
Copy link
Member Author

thanks @ericbmoreira, have you ever tried to use current_region instead of the expand option to see if that would solve your issues? It's not exactly the same though, see: See: https://docs.xlwings.org/en/stable/api.html#xlwings.Range.current_region

mysheet['A1'].current_region.options(pd.DataFrame).value

@ericbmoreira
Copy link

Thank you for that. I have a note in my code about the closed bug #1164. I believe my issues was having UDF's referencing other UDF's that used the expand='table'. If I ever revisit my code I might try it again or this method.

@fzumstein
Copy link
Member Author

Ah ok in the context of UDFs that makes sense and you can ignore the current_region comment.

@fzumstein fzumstein modified the milestones: 0.23.1, 0.23.2 Apr 6, 2021
@fzumstein fzumstein modified the milestones: 0.23.2, 0.23.3 May 6, 2021
@fzumstein fzumstein modified the milestones: 0.23.3, 0.23.4 May 17, 2021
@fzumstein fzumstein modified the milestones: 0.23.4, 0.23.5, 0.23.6 Jun 14, 2021
@fzumstein fzumstein modified the milestones: 0.24.1, 0.24.2, 0.24.3 Jun 27, 2021
@fzumstein fzumstein modified the milestones: 0.24.3, 0.24.4, 0.24.6 Jul 14, 2021
@fzumstein fzumstein modified the milestones: 0.24.6, 0.24.7, 0.24.8 Jul 27, 2021
@fzumstein fzumstein modified the milestones: 0.24.8, 0.24.9 Aug 5, 2021
@fzumstein fzumstein modified the milestones: 0.24.9, 0.24.10, 0.24.8 Aug 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants