Skip to content

Commit

Permalink
Don't let Column.name be None (#223)
Browse files Browse the repository at this point in the history
* unnunnable-ify name

* allow default empty string name

* optionality

* fixup
  • Loading branch information
MarcoGorelli committed Aug 4, 2023
1 parent e9ae6a3 commit 192901a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions spec/API_specification/dataframe_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def concat(dataframes: Sequence[DataFrame]) -> DataFrame:
"""
...

def column_from_sequence(sequence: Sequence[Any], *, name: str | None, dtype: Any) -> Column[Any]:
def column_from_sequence(sequence: Sequence[Any], *, dtype: Any, name: str = '') -> Column[Any]:
"""
Construct Column from sequence of elements.
Expand Down Expand Up @@ -109,7 +109,7 @@ def dataframe_from_dict(data: Mapping[str, Column[Any]]) -> DataFrame:
...


def column_from_1d_array(array: Any, *, name: str, dtype: Any) -> Column[Any]:
def column_from_1d_array(array: Any, *, dtype: Any, name: str = '') -> Column[Any]:
"""
Construct Column from 1D array.
Expand All @@ -123,7 +123,7 @@ def column_from_1d_array(array: Any, *, name: str, dtype: Any) -> Column[Any]:
----------
array : array
array-API compliant 1D array
name : str
name : str, optional
Name to give columns.
dtype : DType
Dtype of column.
Expand Down
4 changes: 2 additions & 2 deletions spec/API_specification/dataframe_api/column_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def column(self) -> Any:
...

@property
def name(self) -> str | None:
def name(self) -> str:
"""Return name of column."""

def __len__(self) -> int:
Expand Down Expand Up @@ -724,7 +724,7 @@ def to_array_object(self, dtype: Any) -> Any:
``array-api-compat`` package to convert it to a Standard-compliant array.
"""

def rename(self, name: str | None) -> Column[DType]:
def rename(self, name: str) -> Column[DType]:
"""
Rename column.
Expand Down

0 comments on commit 192901a

Please sign in to comment.