Feature Type

  • [ ] Adding new functionality to pandas

  • [x] Changing existing functionality in pandas

  • [ ] Removing existing functionality in pandas

Problem Description

The method of obtaining a certain cell or slice of the dataframe is confusing and unclear, such as using loc, iloc, at, iat, and the operator [], etc. For example, df.loc[row_label, col_label] and df.iloc[row_index, col_index]. If loc is a property, it is better to be a variable but now it is a verb or something rather than a df buffer. The user wants to take the cell value, so the behavior of loc is like a member function and the () operator should be used to pass parameters. However, you are using the operator [], but the object of the operator [] is usually an instance, which is a confusing place.

And when taking two columns or slices at the same time, for example, taking one column and one row, the expression value = df.loc[1, 'B'], where the operator [] represents the horizontal and vertical coordinate information, and taking two columns and one row, row_data = df.loc['row_label', ['col1', 'col2']], where the second operator [] has both vertical coordinate information but behaves like a list or tuple instead of the former, this is another confusing aspect.

In mathematics, the coordinate values such as (3, 4) represent the horizontal and vertical coordinates respectively, as well as the () operator. I hope that the operation rules you define should conform to common customs or competition analysis or benchmarking such as numpy. thank you.

Feature Description

n/a

Alternative Solutions

n/a

Additional Context

No response

Comment From: DarthKitten2130

Eh, this is reaching at best. If it ain't broke don't fix it

Comment From: Delengowski

This is the sort of stuff that would have been discussed in the earlier stages of a project but pandas in far too deep. Adding call syntax to _Loc is probably not gonna happen as it's a common complaint that the API is already way too verbose with choices.