Skip to content

Rename get_column_names to column_names and make property #254

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

Merged
merged 3 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions spec/API_specification/dataframe_api/dataframe_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def insert_column(self, column: Column[Any]) -> DataFrame:
.. code-block:: python
new_column = df.get_column_by_name('a') + 1
new_columns_names = ['a_plus_1'] + df.get_column_names()
new_columns_names = ['a_plus_1'] + df.column_names
df = df.insert_column(new_column.rename('a_plus_1'))
df = df.select(new_column_names)
Expand Down Expand Up @@ -268,7 +268,8 @@ def rename_columns(self, mapping: Mapping[str, str]) -> DataFrame:
"""
...

def get_column_names(self) -> list[str]:
@property
def column_names(self) -> list[str]:
"""
Get column names.
Expand Down
2 changes: 1 addition & 1 deletion spec/purpose_and_scope.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def my_dataframe_agnostic_function(df):
mask = df.get_column_by_name('species') != 'setosa'
df = df.filter(mask)

for column_name in df.get_column_names():
for column_name in df.column_names
if column_name == 'species':
continue
new_column = df.get_column_by_name(column_name)
Expand Down