Skip to content
This repository was archived by the owner on Feb 2, 2024. It is now read-only.

Conversation

@densmirn
Copy link
Contributor

No description provided.

@densmirn densmirn force-pushed the feature/df_getitem_attr branch from 88facdf to b6e1dad Compare February 13, 2020 16:04
if not isinstance(obj, DataFrameType):
continue
if expr.attr in obj.columns:
getattrs.add(expr)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we won't rewrite if we didn't find valid column name, right?
This means we won't raise AttributeError as pandas does if we use an invalid attribute name. We should probably state that in limitations, or think if we can look for all_supported_dataframe_methods in this rewrite and if we actually call a method skip rewriting, which aligns to pandas behavior:

>>>df
   A  B  values
0  2 -8      -8
1  1  2       2
2  1  3       3
3  1  1       1
4  2  5       5
5  2  6       6
6  1  7       7
>>>df.values
array([[ 2, -8, -8],
       [ 1,  2,  2],
       [ 1,  3,  3],
       [ 1,  1,  1],
       [ 2,  5,  5],
       [ 2,  6,  6],
       [ 1,  7,  7]], dtype=int64)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we need to think about it, but in next PR

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now, the main issue us the case when column is named like '_data', '_columns' or '_index'. This will break all uses of dataframe

Copy link
Contributor

@kozlov-alexey kozlov-alexey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@densmirn Cool feature! 🥇 Have you felt yourself a magician during writing this?

@AlexanderKalistratov AlexanderKalistratov merged commit 225e96d into IntelPython:master Feb 14, 2020
@densmirn
Copy link
Contributor Author

@densmirn Cool feature! 🥇 Have you felt yourself a magician during writing this?

At the least I liked working on the 😄

@densmirn densmirn deleted the feature/df_getitem_attr branch June 9, 2020 12:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants