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

Support multiple subscript operator in proxified PyObjects. #101

Open
antl3x opened this issue Oct 21, 2023 · 3 comments
Open

Support multiple subscript operator in proxified PyObjects. #101

antl3x opened this issue Oct 21, 2023 · 3 comments

Comments

@antl3x
Copy link

antl3x commented Oct 21, 2023

The following way to use multiple values below work:

df.item(['Age', 'Fare']).median().type
'Series'

Is possible to support something without relying in manual calling the .item() ?

This works:

df['Age'].median().type
'numpy.float64'

This is wrong (since should be a Series, and not a float value):

df['Age', 'Fare'].median().type
'numpy.float64'

This does not work:

df[['Age', 'Fare']].median().type
Uncaught TypeError: Cannot read properties of undefined (reading 'median')
@mmomtchev
Copy link
Owner

Not really. item() exists for a reason. In JavaScript the subscript operator is much more limited. It accepts only scalars.

For example this:

p['a', 'b']

is functionally equivalent to

p['b']

'a', 'b' evaluated in a scalar context is 'b'.

There are cases where using [] works, but it is not supported and you are on your own risk. Only a function as .item() can accept all the values that Python can accept.

@mmomtchev
Copy link
Owner

In case you haven't seen my profile, I am currently living on social welfare because an ex-employer is extorting me with the help of the French police and the French judiciary over a series of false judicial proceedings, including some very serious allegations, in order to cover up his intimate personal problem. In order to further intimidate me, people are simultaneously posting on my projects. Yours is one, it is posted simultaneously with a StackOverflow issue with similar content. You don't happen to know anything about this affair?

@antl3x
Copy link
Author

antl3x commented Oct 21, 2023

Not really. item() exists for a reason. In JavaScript the subscript operator is much more limited. It accepts only scalars.

For example this:

p['a', 'b']

is functionally equivalent to

p['b']

'a', 'b' evaluated in a scalar context is 'b'.

There are cases where using [] works, but it is not supported and you are on your own risk. Only a function as .item() can accept all the values that Python can accept.

Got it. Thanks for clarifying.

In case you haven't seen my profile, I am currently living on social welfare because an ex-employer is extorting me with the help of the French police and the French judiciary over a series of false judicial proceedings, including some very serious allegations, in order to cover up his intimate personal problem. In order to further intimidate me, people are simultaneously posting on my projects. Yours is one, it is posted simultaneously with a StackOverflow issue with similar content. You don't happen to know anything about this affair?

I'm sorry, I don't know what you are talking about. I hope you stay well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants