From 6c2ee13560267557daab72ee3e8dfaac7ae95496 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Mon, 3 May 2021 08:42:03 -0700 Subject: [PATCH] Rename FrameOneD to SingleColumnFrame. --- python/cudf/cudf/core/frame.py | 6 +++--- python/cudf/cudf/core/index.py | 22 +++++++++++----------- python/cudf/cudf/core/multiindex.py | 6 +++--- python/cudf/cudf/core/series.py | 8 ++++---- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/python/cudf/cudf/core/frame.py b/python/cudf/cudf/core/frame.py index c51d1a80890..4a434be42ce 100644 --- a/python/cudf/cudf/core/frame.py +++ b/python/cudf/cudf/core/frame.py @@ -3301,10 +3301,10 @@ def _reindex( return self._mimic_inplace(result, inplace=inplace) -class FrameOneD(Frame): +class SingleColumnFrame(Frame): """A one-dimensional frame. - Frames with only a single dimension share certain logic that is encoded in + Frames with only a single column share certain logic that is encoded in this class. """ @@ -3459,7 +3459,7 @@ def from_arrow(cls, array): Returns ------- - FrameOneD + SingleColumnFrame Examples -------- diff --git a/python/cudf/cudf/core/index.py b/python/cudf/cudf/core/index.py index d82b4f53e20..5f390be79e2 100644 --- a/python/cudf/cudf/core/index.py +++ b/python/cudf/cudf/core/index.py @@ -29,7 +29,7 @@ ) from cudf.core.column.string import StringMethods as StringMethods from cudf.core.dtypes import IntervalDtype -from cudf.core.frame import FrameOneD +from cudf.core.frame import SingleColumnFrame from cudf.utils import ioutils from cudf.utils.docutils import copy_docstring from cudf.utils.dtypes import ( @@ -45,7 +45,7 @@ from cudf.utils.utils import cached_property, search_range -class Index(FrameOneD, Serializable): +class Index(SingleColumnFrame, Serializable): dtype: DtypeObj @@ -1427,7 +1427,7 @@ def _from_table(cls, table): @classmethod def _from_data(cls, data, index=None): - return cls._from_table(FrameOneD(data=data)) + return cls._from_table(SingleColumnFrame(data=data)) @property def _constructor_expanddim(self): @@ -1474,7 +1474,7 @@ def __new__( if step == 0: raise ValueError("Step must not be zero.") - out = FrameOneD.__new__(cls) + out = SingleColumnFrame.__new__(cls) if isinstance(start, range): therange = start start = therange.start @@ -1827,7 +1827,7 @@ def __new__(cls, values, **kwargs): Column's name. Otherwise if this name is different from the value Column's, the values Column will be cloned to adopt this name. """ - out = FrameOneD.__new__(cls) + out = SingleColumnFrame.__new__(cls) out._initialize(values, **kwargs) return out @@ -2043,7 +2043,7 @@ class NumericIndex(GenericIndex): def __new__(cls, data=None, dtype=None, copy=False, name=None): - out = FrameOneD.__new__(cls) + out = SingleColumnFrame.__new__(cls) dtype = _index_to_dtype[cls] if copy: data = column.as_column(data, dtype=dtype).copy() @@ -2165,7 +2165,7 @@ def __new__( # pandas dtindex creation first which. For now # just make sure we handle np.datetime64 arrays # and then just dispatch upstream - out = FrameOneD.__new__(cls) + out = SingleColumnFrame.__new__(cls) if freq is not None: raise NotImplementedError("Freq is not yet supported") @@ -2420,7 +2420,7 @@ def __new__( name=None, ) -> "TimedeltaIndex": - out = FrameOneD.__new__(cls) + out = SingleColumnFrame.__new__(cls) if freq is not None: raise NotImplementedError("freq is not yet supported") @@ -2552,7 +2552,7 @@ def __new__( ) if copy: data = column.as_column(data, dtype=dtype).copy(deep=True) - out = FrameOneD.__new__(cls) + out = SingleColumnFrame.__new__(cls) kwargs = _setdefault_name(data, name=name) if isinstance(data, CategoricalColumn): data = data @@ -2778,7 +2778,7 @@ def __new__( ) -> "IntervalIndex": if copy: data = column.as_column(data, dtype=dtype).copy() - out = FrameOneD.__new__(cls) + out = SingleColumnFrame.__new__(cls) kwargs = _setdefault_name(data, name=name) if isinstance(data, IntervalColumn): data = data @@ -2851,7 +2851,7 @@ class StringIndex(GenericIndex): """ def __new__(cls, values, copy=False, **kwargs): - out = FrameOneD.__new__(cls) + out = SingleColumnFrame.__new__(cls) kwargs = _setdefault_name(values, **kwargs) if isinstance(values, StringColumn): values = values.copy(deep=copy) diff --git a/python/cudf/cudf/core/multiindex.py b/python/cudf/cudf/core/multiindex.py index 896de51f046..ca029198e52 100644 --- a/python/cudf/cudf/core/multiindex.py +++ b/python/cudf/cudf/core/multiindex.py @@ -19,7 +19,7 @@ from cudf.core._compat import PANDAS_GE_120 from cudf.core.column import column from cudf.core.column_accessor import ColumnAccessor -from cudf.core.frame import Frame, FrameOneD +from cudf.core.frame import Frame, SingleColumnFrame from cudf.core.index import Index, as_index @@ -572,7 +572,7 @@ def from_arrow(cls, table): names=['a', 'b']) """ - return super(FrameOneD, cls).from_arrow(table) + return super(SingleColumnFrame, cls).from_arrow(table) def to_arrow(self): """Convert MultiIndex to PyArrow Table @@ -606,7 +606,7 @@ def to_arrow(self): ] """ - return super(FrameOneD, self).to_arrow() + return super(SingleColumnFrame, self).to_arrow() @property def codes(self): diff --git a/python/cudf/cudf/core/series.py b/python/cudf/cudf/core/series.py index 74cb3363295..5ee40d576b6 100644 --- a/python/cudf/cudf/core/series.py +++ b/python/cudf/cudf/core/series.py @@ -38,7 +38,7 @@ from cudf.core.column.string import StringMethods from cudf.core.column.struct import StructMethods from cudf.core.column_accessor import ColumnAccessor -from cudf.core.frame import FrameOneD, _drop_rows_by_labels +from cudf.core.frame import SingleColumnFrame, _drop_rows_by_labels from cudf.core.groupby.groupby import SeriesGroupBy from cudf.core.index import Index, RangeIndex, as_index from cudf.core.indexing import _SeriesIlocIndexer, _SeriesLocIndexer @@ -61,7 +61,7 @@ ) -class Series(FrameOneD, Serializable): +class Series(SingleColumnFrame, Serializable): # The `constructor*` properties are used by `dask` (and `dask_cudf`) @property def _constructor(self): @@ -1043,9 +1043,9 @@ def __getitem__(self, arg): else: return self.loc[arg] - iteritems = FrameOneD.__iter__ + iteritems = SingleColumnFrame.__iter__ - items = FrameOneD.__iter__ + items = SingleColumnFrame.__iter__ def to_dict(self, into=dict): raise TypeError(