Skip to content

Commit bf9fc19

Browse files
committed
make release-tag: Merge branch 'master' into stable
2 parents 3bdfe03 + 977db57 commit bf9fc19

File tree

14 files changed

+259
-12
lines changed

14 files changed

+259
-12
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.ipynb linguist-vendored

.github/ISSUE_TEMPLATE/question.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: Question
3-
about: Doubts about SDV usage
3+
about: Ask a general question about SDV usage
44
title: ''
55
labels: question, pending review
66
assignees: ''

HISTORY.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
# Release Notes
22

3+
## 0.12.1 - 2021-10-12
4+
5+
This release fixes bugs in constraints, metadata behavior, and SDV documentation. Specifically, we added
6+
proper handling of data containing null values for constraints and timeseries data, and updated the
7+
default metadata detection behavior.
8+
9+
### Bugs Fixed
10+
* ValueError: The parameter loc has invalid values - Issue [#353](https://github.com/sdv-dev/SDV/issues/353) by @fealho
11+
* Gaussian Copula is generating different data with metadata and without metadata - Issue [#576](https://github.com/sdv-dev/SDV/issues/576) by @katxiao
12+
* Make pomegranate an optional dependency - Issue [#567](https://github.com/sdv-dev/SDV/issues/567) by @katxiao
13+
* Small wording change for Question Issue Template - Issue [#571](https://github.com/sdv-dev/SDV/issues/571) by @katxiao
14+
* ConstraintsNotMetError when using GreaterThan constraint with datetime - Issue [#590](https://github.com/sdv-dev/SDV/issues/590) by @katxiao
15+
* GreaterThan constraint crashing with NaN values - Issue [#592](https://github.com/sdv-dev/SDV/issues/592) by @katxiao
16+
* Null values in GreaterThan constraint raises error - Issue [#589](https://github.com/sdv-dev/SDV/issues/589) by @katxiao
17+
* ColumnFormula raises ConstraintsNotMetError when checking NaN values - Issue [#593](https://github.com/sdv-dev/SDV/issues/593) by @katxiao
18+
* GreaterThan constraint raises TypeError when using datetime - Issue [#596](https://github.com/sdv-dev/SDV/issues/596) by @katxiao
19+
* Fix repository language - Issue [#464](https://github.com/sdv-dev/SDV/issues/464) by @fealho
20+
* Update __init__.py - Issue [#578](https://github.com/sdv-dev/SDV/issues/578) by @dyuliu
21+
* IndexingError: Unalignable boolean - Issue [#446](https://github.com/sdv-dev/SDV/issues/446) by @fealho
22+
323
## 0.12.0 - 2021-08-17
424

525
This release focuses on improving and expanding upon the existing constraints. More specifically, the users can now

conda/meta.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{% set name = 'sdv' %}
2-
{% set version = '0.12.0' %}
2+
{% set version = '0.12.1.dev1' %}
33

44
package:
55
name: "{{ name|lower }}"

sdv/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# -*- coding: utf-8 -*-
22
# configure logging for the library with a null handler (nothing is printed by default). See
3-
# http://docs.pthon-guide.org/en/latest/writing/logging/
3+
# http://docs.python-guide.org/en/latest/writing/logging/
44

55
"""Top-level package for SDV."""
66

77
__author__ = """MIT Data To AI Lab"""
88
__email__ = '[email protected]'
9-
__version__ = '0.12.0'
9+
__version__ = '0.12.1.dev1'
1010

1111
from sdv import constraints, evaluation, metadata, relational, tabular
1212
from sdv.demo import get_available_demos, load_demo

sdv/constraints/base.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,9 @@ def filter_valid(self, table_data):
342342
LOGGER.debug('%s: %s invalid rows out of %s.',
343343
self.__class__.__name__, sum(~valid), len(valid))
344344

345+
if isinstance(valid, pd.Series):
346+
return table_data[valid.values]
347+
345348
return table_data[valid]
346349

347350
@classmethod

sdv/constraints/tabular.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,10 +320,16 @@ def _validate_inputs(cls, low, high, scalar, drop):
320320
cls._validate_drop(scalar, drop)
321321
high = cls._validate_scalar(scalar_column=low, column_names=high, scalar=scalar)
322322
constraint_columns = tuple(high)
323+
if isinstance(low, pd.Timestamp):
324+
low = low.to_datetime64()
325+
323326
elif scalar == 'high':
324327
cls._validate_drop(scalar, drop)
325328
low = cls._validate_scalar(scalar_column=high, column_names=low, scalar=scalar)
326329
constraint_columns = tuple(low)
330+
if isinstance(high, pd.Timestamp):
331+
high = high.to_datetime64()
332+
327333
else:
328334
raise ValueError(f"Invalad `scalar` value: `{scalar}`. "
329335
"Use either: 'high', 'low', or None.")
@@ -436,8 +442,11 @@ def is_valid(self, table_data):
436442
"""
437443
low = self._get_value(table_data, 'low')
438444
high = self._get_value(table_data, 'high')
445+
isnull = np.logical_or(np.isnan(low), np.isnan(high))
439446

440-
return self.operator(high, low).all(axis=1)
447+
valid = np.logical_or(self.operator(high, low), isnull)
448+
449+
return valid.all(axis=1)
441450

442451
def _transform(self, table_data):
443452
"""Transform the table data.
@@ -630,7 +639,9 @@ def is_valid(self, table_data):
630639
Whether each row is valid.
631640
"""
632641
computed = self._formula(table_data)
633-
return table_data[self._column] == computed
642+
isnan = table_data[self._column].isna() & computed.isna()
643+
644+
return table_data[self._column].eq(computed) | isnan
634645

635646
def _transform(self, table_data):
636647
"""Transform the table data.

sdv/metadata/table.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,9 @@ def from_dict(cls, metadata_dict, dtype_transformers=None):
769769
entity_columns=metadata_dict.get('entity_columns') or [],
770770
context_columns=metadata_dict.get('context_columns') or [],
771771
dtype_transformers=dtype_transformers,
772+
min_value=metadata_dict.get('min_value', 'auto'),
773+
max_value=metadata_dict.get('max_value', 'auto'),
774+
rounding=metadata_dict.get('rounding', 'auto'),
772775
)
773776
instance._fields_metadata = fields
774777
return instance

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.12.0
2+
current_version = 0.12.1.dev1
33
commit = True
44
tag = True
55
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.(?P<release>[a-z]+)(?P<candidate>\d+))?

setup.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,14 @@
2020
'tqdm>=4.14,<5',
2121
'copulas>=0.5.0,<0.6',
2222
'ctgan>=0.4.3,<0.5',
23-
'deepecho>=0.2.0,<0.3',
24-
'rdt>=0.5.0,<0.6',
23+
'deepecho>=0.2.1,<0.3',
24+
'rdt>=0.5.3,<0.6',
2525
'sdmetrics>=0.3.1,<0.4',
2626
'torchvision>=0.5.0,<1',
2727
'sktime>=0.4,<0.6',
28+
]
29+
30+
pomegranate_requires = [
2831
'pomegranate>=0.13.4,<0.14.2',
2932
]
3033

@@ -93,6 +96,7 @@
9396
extras_require={
9497
'test': tests_require,
9598
'dev': development_requires + tests_require,
99+
'pomegranate': pomegranate_requires,
96100
},
97101
include_package_data=True,
98102
install_requires=install_requires,
@@ -107,6 +111,6 @@
107111
test_suite='tests',
108112
tests_require=tests_require,
109113
url='https://github.com/sdv-dev/SDV',
110-
version='0.12.0',
114+
version='0.12.1.dev1',
111115
zip_safe=False,
112116
)

0 commit comments

Comments
 (0)