Skip to content

Commit

Permalink
Fixes flaky test - assign random dates before converting DF to a dask…
Browse files Browse the repository at this point in the history
… dataframe, otherwise the map is lazy-evaluated. (#2232)

Co-authored-by: Daniel Treiman <daniel@predibase.com>
  • Loading branch information
dantreiman and dantreiman committed Jul 6, 2022
1 parent 5d6a970 commit 61a72a0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/ludwig/data/test_split.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,6 @@ def test_datetime_split(df_engine):
npartitions = 10

df = pd.DataFrame(np.random.randint(0, 100, size=(nrows, 3)), columns=["A", "B", "C"])
if isinstance(df_engine, DaskEngine):
df = df_engine.df_lib.from_pandas(df, npartitions=npartitions)

def random_date(*args, **kwargs):
start = datetime.strptime("1/1/1990 1:30 PM", "%m/%d/%Y %I:%M %p")
Expand All @@ -181,6 +179,9 @@ def random_date(*args, **kwargs):

df["date_col"] = df["C"].map(random_date)

if isinstance(df_engine, DaskEngine):
df = df_engine.df_lib.from_pandas(df, npartitions=npartitions)

probs = (0.7, 0.1, 0.2)
split_params = {
"type": "datetime",
Expand Down

0 comments on commit 61a72a0

Please sign in to comment.