Beispiel #1
0
 def __init__(self, kdf: DataFrame, scol: Optional[spark.Column] = None) -> None:
     assert len(kdf._internal._index_map) == 1
     if scol is None:
         IndexOpsMixin.__init__(
             self, kdf._internal.copy(scol=kdf._internal.index_scols[0]), kdf)
     else:
         IndexOpsMixin.__init__(self, kdf._internal.copy(scol=scol), kdf)
Beispiel #2
0
 def __init__(self, kdf: DataFrame):
     assert len(kdf._internal._index_map) > 1
     scol = F.struct(kdf._internal.index_scols)
     data_columns = kdf._sdf.select(scol).columns
     internal = kdf._internal.copy(scol=scol,
                                   column_index=[(col, None) for col in data_columns],
                                   column_index_names=None)
     IndexOpsMixin.__init__(self, internal, kdf)
Beispiel #3
0
 def __init__(self, kdf: DataFrame, scol: Optional[spark.Column] = None) -> None:
     if scol is None:
         scol = kdf._internal.index_scols[0]
     internal = kdf._internal.copy(scol=scol,
                                   data_columns=kdf._internal.index_columns,
                                   column_index=kdf._internal.index_names,
                                   column_index_names=None)
     IndexOpsMixin.__init__(self, internal, kdf)
Beispiel #4
0
 def __init__(self, kdf: DataFrame, scol: Optional[spark.Column] = None):
     assert len(kdf._internal._index_map) > 1
     self._kdf = kdf
     if scol is None:
         IndexOpsMixin.__init__(self, kdf._internal.copy(
             scol=F.struct(self._kdf._internal.index_scols)), kdf)
     else:
         IndexOpsMixin.__init__(self, kdf._internal.copy(scol=scol), kdf)
Beispiel #5
0
 def __init__(self, data: Union[DataFrame, list], dtype=None, name=None,
              scol: Optional[spark.Column] = None) -> None:
     if isinstance(data, DataFrame):
         assert dtype is None
         assert name is None
         kdf = data
     else:
         assert scol is None
         kdf = DataFrame(index=pd.Index(data=data, dtype=dtype, name=name))
     if scol is None:
         scol = kdf._internal.index_scols[0]
     internal = kdf._internal.copy(scol=scol,
                                   column_index=kdf._internal.index_names,
                                   column_scols=kdf._internal.index_scols,
                                   column_index_names=None)
     IndexOpsMixin.__init__(self, internal, kdf)