Skip to content

Commit 0899376

Browse files
committed
Update docstrings and inferred max value for DecimalType columns
1 parent 2e5afe7 commit 0899376

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

dbldatagen/data_analyzer.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def _addMeasureToSummary(
125125
:param dfData: Source ``DataFrame`` to summarize
126126
:param rowLimit: Number of rows to use for ``DataFrame`` summarization
127127
:param dfSummary: Summary metrics ``DataFrame``
128-
:return: Summary metrics ``DataFrame`` with the added measure
128+
:returns: Summary metrics ``DataFrame`` with the added measure
129129
"""
130130
if dfData is None:
131131
raise ValueError("Input DataFrame `dfData` must be supplied when adding measures to a summary")
@@ -384,10 +384,9 @@ def _generatorDefaultAttributesFromType(
384384
elif sqlType == types.DateType():
385385
result = """expr='current_date()'"""
386386

387-
elif isinstance(sqlType, types.DecimalType):
388-
max_decimal_value = 10**(sqlType.precision - sqlType.scale) - 10**(-1 * sqlType.scale)
387+
elif sqlType == types.DecimalType():
389388
min_value = cls._valueFromSummary(dataSummary, colName, "min", defaultValue=0)
390-
max_value = cls._valueFromSummary(dataSummary, colName, "max", defaultValue=max_decimal_value)
389+
max_value = cls._valueFromSummary(dataSummary, colName, "max", defaultValue=1000000.0)
391390
result = f"""minValue={min_value}, maxValue={max_value}"""
392391

393392
elif sqlType in [types.FloatType(), types.DoubleType()]:

dbldatagen/text_generator_plugins.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ def fakerText(mname: str, *args, _lib: str | None = None, _rootClass: str | None
445445
446446
:param mname: Method name to invoke
447447
:param args: Positional argumentss to pass to the Faker text generation method
448-
:param _lib: Optional import alias of Faker library (dfault is ``"faker"``)
448+
:param _lib: Optional import alias of Faker library (default is ``"faker"``)
449449
:param _rootClass: Optional name of the root object class (default is ``"Faker"``)
450450
:returns : ``PyfuncText`` for use with Faker
451451
"""

0 commit comments

Comments
 (0)