We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ColumnFormula
Conditioning on the constraint column when using the ColumnFormula constraint causes the following error:
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) /var/folders/3p/f4b70gn5165464cqyvg157qw0000gn/T/ipykernel_42215/2787579389.py in <module> ----> 1 samples = model.sample(10, conditions={'b': 1}) 2 samples ~/Desktop/SDV/sdv/tabular/base.py in sample(self, num_rows, max_retries, max_rows_multiplier, conditions, float_rtol, graceful_reject_sampling) 471 else: 472 transformed_conditions_in_group = transformed_conditions.loc[condition_indices] --> 473 transformed_groups = transformed_conditions_in_group.groupby(transformed_columns) 474 for transformed_group, transformed_dataframe in transformed_groups: 475 if not isinstance(transformed_group, tuple): ~/opt/anaconda3/envs/test/lib/python3.8/site-packages/pandas/core/frame.py in groupby(self, by, axis, level, as_index, sort, group_keys, squeeze, observed, dropna) 6513 axis = self._get_axis_number(axis) 6514 -> 6515 return DataFrameGroupBy( 6516 obj=self, 6517 keys=by, ~/opt/anaconda3/envs/test/lib/python3.8/site-packages/pandas/core/groupby/groupby.py in __init__(self, obj, keys, axis, level, grouper, exclusions, selection, as_index, sort, group_keys, squeeze, observed, mutated, dropna) 523 from pandas.core.groupby.grouper import get_grouper 524 --> 525 grouper, exclusions, obj = get_grouper( 526 obj, 527 keys, ~/opt/anaconda3/envs/test/lib/python3.8/site-packages/pandas/core/groupby/grouper.py in get_grouper(obj, key, axis, level, sort, observed, mutated, validate, dropna) 819 820 if len(groupings) == 0 and len(obj): --> 821 raise ValueError("No group keys passed!") 822 elif len(groupings) == 0: 823 groupings.append(Grouping(Index([], dtype="int"), np.array([], dtype=np.intp))) ValueError: No group keys passed!
Code to reproduce it:
import pandas as pd from sdv.constraints import * from sdv.tabular import * ones = [1 for i in range(10)] data = pd.DataFrame({ 'a': ones, 'b': ones, 'c': ones }) def formula(data): return data['a'] constraint = ColumnFormula( column='b', formula=formula ) model = GaussianCopula(constraints=[constraint]) model.fit(data) samples = model.sample(10, conditions={'b': 1}) samples
The text was updated successfully, but these errors were encountered:
katxiao
Successfully merging a pull request may close this issue.
Conditioning on the constraint column when using the
ColumnFormula
constraint causes the following error:Code to reproduce it:
The text was updated successfully, but these errors were encountered: