Skip to content

Commit

Permalink
Merge pull request #334 from taylorfturner/sam_comments_fix
Browse files Browse the repository at this point in the history
Quick Fixes
  • Loading branch information
ssharpe42 committed Aug 28, 2023
2 parents b9e5c56 + fab0fc3 commit 5be1ed8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions synthetic_data/distinct_generators/datetime_generator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Contains a datetime generator."""
from datetime import datetime
from typing import Optional
from typing import List, Optional

import numpy as np
import pandas as pd
Expand Down Expand Up @@ -43,7 +43,7 @@ def generate_datetime(

def random_datetimes(
rng: Generator,
format: Optional[str] = None,
format: Optional[List[str]] = None,
min: pd.Timestamp = None,
max: pd.Timestamp = None,
num_rows: int = 1,
Expand All @@ -70,6 +70,9 @@ def random_datetimes(
if not format:
format = ["%B %d %Y %H:%M:%S"]

if not isinstance(format, list):
raise Exception("format must be of type `list`")

for i in range(num_rows):
date_format = rng.choice(format)
datetime = generate_datetime(
Expand Down
2 changes: 1 addition & 1 deletion synthetic_data/generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def _generate_uncorrelated_column_data(self, num_samples):
col_["rng"] = self.rng
col_["num_rows"] = num_samples

if (generator_name == "string") or (generator_name == "text"):
if generator_name in ["string", "text"]:
if col_.get("categorical", False):
generator_name = "categorical"
total = 0
Expand Down

0 comments on commit 5be1ed8

Please sign in to comment.