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
2 changes: 1 addition & 1 deletion bigframes/operations/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from bigframes.core import log_adapter
import bigframes.operations as ops

_ONE_DAY = pandas.Timedelta("1d")
_ONE_DAY = pandas.Timedelta("1D")
_ONE_SECOND = pandas.Timedelta("1s")
_ONE_MICRO = pandas.Timedelta("1us")
_SUPPORTED_FREQS = ("Y", "Q", "M", "W", "D", "h", "min", "s", "ms", "us")
Expand Down
18 changes: 18 additions & 0 deletions tests/unit/test_local_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@
def test_local_data_well_formed_round_trip():
local_entry = local_data.ManagedArrowTable.from_pandas(pd_data)
result = pd.DataFrame(local_entry.itertuples(), columns=pd_data.columns)
result = result.assign(
**{
col: result[col].astype(pd_data_normalized[col].dtype)
for col in pd_data_normalized.columns
}
)
pandas.testing.assert_frame_equal(pd_data_normalized, result, check_dtype=False)


Expand Down Expand Up @@ -118,6 +124,12 @@ def test_local_data_well_formed_round_trip_chunked():
as_rechunked_pyarrow = pa.Table.from_batches(pa_table.to_batches(max_chunksize=2))
local_entry = local_data.ManagedArrowTable.from_pyarrow(as_rechunked_pyarrow)
result = pd.DataFrame(local_entry.itertuples(), columns=pd_data.columns)
result = result.assign(
**{
col: result[col].astype(pd_data_normalized[col].dtype)
for col in pd_data_normalized.columns
}
)
pandas.testing.assert_frame_equal(pd_data_normalized, result, check_dtype=False)


Expand All @@ -126,6 +138,12 @@ def test_local_data_well_formed_round_trip_sliced():
as_rechunked_pyarrow = pa.Table.from_batches(pa_table.slice(0, 4).to_batches())
local_entry = local_data.ManagedArrowTable.from_pyarrow(as_rechunked_pyarrow)
result = pd.DataFrame(local_entry.itertuples(), columns=pd_data.columns)
result = result.assign(
**{
col: result[col].astype(pd_data_normalized[col].dtype)
for col in pd_data_normalized.columns
}
)
pandas.testing.assert_frame_equal(
pd_data_normalized[0:4].reset_index(drop=True),
result.reset_index(drop=True),
Expand Down