Skip to content
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
19 changes: 10 additions & 9 deletions modin/backends/pandas/query_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ def to_pandas(self):
self.dtypes
)
else:
df = pandas.DataFrame(index=self.index)
df = pandas.DataFrame(columns=self.columns, index=self.index)
else:
ErrorMessage.catch_bugs_and_request_email(
len(df.index) != len(self.index) or len(df.columns) != len(self.columns)
Expand Down Expand Up @@ -1848,22 +1848,23 @@ def tail(self, n):
# See head for an explanation of the transposed behavior
if n < 0:
n = max(0, len(self.index) + n)
if n == 0:
index = pandas.Index([])
else:
index = self.index[-n:]
if self._is_transposed:
result = self.__constructor__(
self.data.transpose().take(1, -n).transpose(),
index,
index[:-n],
self.columns,
self._dtype_cache,
)
result._is_transposed = True
else:
result = self.__constructor__(
self.data.take(0, -n), index, self.columns, self._dtype_cache
)
if n == 0:
result = self.__constructor__(
self.data.take(0, 0), self.index[:0], self.columns, self._dtype_cache
)
else:
result = self.__constructor__(
self.data.take(0, -n), self.index[-n:], self.columns, self._dtype_cache
)

return result

Expand Down
2 changes: 2 additions & 0 deletions modin/pandas/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2915,6 +2915,7 @@ def to_numpy(self, dtype=None, copy=False):
"""
return self._default_to_pandas("to_numpy", dtype=dtype, copy=copy)

# TODO(williamma12): When this gets implemented, have the series one call this.
def to_period(self, freq=None, axis=0, copy=True): # pragma: no cover
return self._default_to_pandas("to_period", freq=freq, axis=axis, copy=copy)

Expand Down Expand Up @@ -3003,6 +3004,7 @@ def to_sql(
method=method,
)

# TODO(williamma12): When this gets implemented, have the series one call this.
def to_timestamp(self, freq=None, how="start", axis=0, copy=True):
return self._default_to_pandas(
"to_timestamp", freq=freq, how=how, axis=axis, copy=copy
Expand Down
6 changes: 6 additions & 0 deletions modin/pandas/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -1620,6 +1620,9 @@ def to_parquet(
**kwargs
)

def to_period(self, freq=None, axis=0, copy=True): # pragma: no cover
return super(DataFrame, self).to_period(freq=freq, axis=axis, copy=copy)

def to_records(
self, index=True, convert_datetime64=None, column_dtypes=None, index_dtypes=None
):
Expand Down Expand Up @@ -1658,6 +1661,9 @@ def to_stata(
convert_strl=convert_strl,
)

def to_timestamp(self, freq=None, how="start", axis=0, copy=True):
return super(DataFrame, self).to_timestamp(freq=freq, how=how, axis=axis, copy=copy)

def truediv(self, other, axis="columns", level=None, fill_value=None):
if isinstance(other, Series):
other = other._to_pandas()
Expand Down
14 changes: 14 additions & 0 deletions modin/pandas/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,13 @@ def to_list(self):

tolist = to_list

# TODO(williamma12): When we implement to_timestamp, have this call the version
# in base.py
def to_period(self, freq=None, copy=True):
return self._default_to_pandas(
"to_period", freq=freq, copy=copy
)

def to_string(
self,
buf=None,
Expand All @@ -980,6 +987,13 @@ def to_string(
max_rows=max_rows,
)

# TODO(williamma12): When we implement to_timestamp, have this call the version
# in base.py
def to_timestamp(self, freq=None, how="start", copy=True):
return self._default_to_pandas(
"to_timestamp", freq=freq, how=how, copy=copy
)

def transpose(self, *args, **kwargs):
return self

Expand Down
Loading