Skip to content

Commit

Permalink
Fixed a few more redundancies.
Browse files Browse the repository at this point in the history
  • Loading branch information
vyasr committed Apr 27, 2021
1 parent 0329ad5 commit 51e6bea
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 17 deletions.
4 changes: 1 addition & 3 deletions python/cudf/cudf/core/column/column.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,16 +323,14 @@ def to_arrow(self) -> pa.Array:
4
]
"""
result = libcudf.interop.to_arrow(
return libcudf.interop.to_arrow(
libcudf.table.Table(
cudf.core.column_accessor.ColumnAccessor({"None": self})
),
[["None"]],
keep_index=False,
)["None"].chunk(0)

return result

@classmethod
def from_arrow(cls, array: pa.Array) -> ColumnBase:
"""
Expand Down
11 changes: 4 additions & 7 deletions python/cudf/cudf/core/column/datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,12 @@ def to_pandas(
# https://issues.apache.org/jira/browse/ARROW-9772

# Pandas supports only `datetime64[ns]`, hence the cast.
pd_series = pd.Series(
self.astype("datetime64[ns]").to_array("NAT"), copy=False
return pd.Series(
self.astype("datetime64[ns]").to_array("NAT"),
copy=False,
index=index,
)

if index is not None:
pd_series.index = index

return pd_series

def get_dt_field(self, field: str) -> ColumnBase:
return libcudf.datetime.extract_datetime_component(self, field)

Expand Down
8 changes: 1 addition & 7 deletions python/cudf/cudf/core/column/string.py
Original file line number Diff line number Diff line change
Expand Up @@ -4788,13 +4788,7 @@ def to_arrow(self) -> pa.Array:
pa.null(), len(self), [pa.py_buffer((b""))]
)
else:
return libcudf.interop.to_arrow(
libcudf.table.Table(
cudf.core.column_accessor.ColumnAccessor({"None": self})
),
[["None"]],
keep_index=False,
)["None"].chunk(0)
return super().to_arrow()

def sum(
self, skipna: bool = None, dtype: Dtype = None, min_count: int = 0
Expand Down

0 comments on commit 51e6bea

Please sign in to comment.