# \[Resolved\] HSASynthesizer FutureWarning

**URL:** <https://forum.datacebo.com/t/resolved-hsasynthesizer-futurewarning/177>\
**Category:** Synthetic Data Creation\
**Tags:** bug\
**Created:** [May 8, 2024, 3:32am UTC](https://forum.datacebo.com/t/resolved-hsasynthesizer-futurewarning/177 "2024-05-08T03:32:28Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![yuntien.lee](https://avatars.discourse-cdn.com/v4/letter/y/7ba0ec/32.png) [@yuntien.lee](https://forum.datacebo.com/u/yuntien.lee)\
**Post date:** [May 8, 2024, 3:32am UTC](https://forum.datacebo.com/t/resolved-hsasynthesizer-futurewarning/177/1 "2024-05-08T03:32:28Z")

</div>

Hi Support,  
Using HMASynthesizer our data passed through but the error messages showed up using HSASynthesizer. Can you help? Thanks.

C:\Users\YunTien.Lee\Anaconda3\envs\python312\Lib\site-packages\sdv\multi\_table\base.py:375: FutureWarning: ChainedAssignmentError: behaviour will change in pandas 3.0!  
You are setting values through chained assignment. Currently this works in certain cases, but when using Copy-on-Write (which will become the default behaviour in pandas 3.0) this will never work to update the original DataFrame or Series, because the intermediate object on which we are setting values will behave as a copy.  
A typical example is when you are setting values in a column of a DataFrame, like:

df[“col”][row\_indexer] = value

Use `df.loc[row_indexer, "col"] = values` instead, to perform the assignment in a single step and ensure this keeps updating the original `df`.

See the caveats in the documentation: [Indexing and selecting data — pandas 3.0.0 documentation](https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy)

augmented\_data = self.\_augment\_tables(processed\_data)  
C:\Users\YunTien.Lee\Anaconda3\envs\python312\Lib\site-packages\sdv\multi\_table\base.py:375: FutureWarning: ChainedAssignmentError: behaviour will change in pandas 3.0!  
You are setting values through chained assignment. Currently this works in certain cases, but when using Copy-on-Write (which will become the default behaviour in pandas 3.0) this will never work to update the original DataFrame or Series, because the intermediate object on which we are setting values will behave as a copy.  
A typical example is when you are setting values in a column of a DataFrame, like:

df[“col”][row\_indexer] = value

Use `df.loc[row_indexer, "col"] = values` instead, to perform the assignment in a single step and ensure this keeps updating the original `df`.

See the caveats in the documentation: [Indexing and selecting data — pandas 3.0.0 documentation](https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy)

augmented\_data = self.\_augment\_tables(processed\_data)  
C:\Users\YunTien.Lee\Anaconda3\envs\python312\Lib\site-packages\sdv\multi\_table\base.py:375: FutureWarning: ChainedAssignmentError: behaviour will change in pandas 3.0!  
You are setting values through chained assignment. Currently this works in certain cases, but when using Copy-on-Write (which will become the default behaviour in pandas 3.0) this will never work to update the original DataFrame or Series, because the intermediate object on which we are setting values will behave as a copy.  
A typical example is when you are setting values in a column of a DataFrame, like:

df[“col”][row\_indexer] = value

Use `df.loc[row_indexer, "col"] = values` instead, to perform the assignment in a single step and ensure this keeps updating the original `df`.

See the caveats in the documentation: [Indexing and selecting data — pandas 3.0.0 documentation](https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy)

augmented\_data = self.\_augment\_tables(processed\_data)  
C:\Users\YunTien.Lee\Anaconda3\envs\python312\Lib\site-packages\sdv\multi\_table\base.py:375: FutureWarning: ChainedAssignmentError: behaviour will change in pandas 3.0!  
You are setting values through chained assignment. Currently this works in certain cases, but when using Copy-on-Write (which will become the default behaviour in pandas 3.0) this will never work to update the original DataFrame or Series, because the intermediate object on which we are setting values will behave as a copy.  
A typical example is when you are setting values in a column of a DataFrame, like:

df[“col”][row\_indexer] = value

Use `df.loc[row_indexer, "col"] = values` instead, to perform the assignment in a single step and ensure this keeps updating the original `df`.

See the caveats in the documentation: [Indexing and selecting data — pandas 3.0.0 documentation](https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy)

augmented\_data = self.\_augment\_tables(processed\_data)

---

<div class="post-metadata">

**Author:** ![neha](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.datacebo.com/neha/32/15_2.png) [@neha](https://forum.datacebo.com/u/neha)\
**Post date:** [May 8, 2024, 3:10pm UTC](https://forum.datacebo.com/t/resolved-hsasynthesizer-futurewarning/177/2 "2024-05-08T15:10:02Z")

</div>

Hi @yuntien.lee, appreciate you providing the full details.

Based on the output that I am seeing printed, it appears that this message is a _warning_ only, and not an error. There is a key difference here, because if it’s a warning, you should be able to **continue using the SDV without any issue**. So I would recommend you continue to sample synthetic data from the HSASynthesizer.

# What is this warning tell us?

As you mention, pandas is warning that some internal functionality we are using in SDV will not be compatible with future versions of pandas. Do note that pandas 3.0 is [still in development](https://pandas.pydata.org/docs/dev/whatsnew/v3.0.0.html) and has not yet been released. So currently, the SDV code is ok.

Rest assured hat I have surfaced this to the team and we will make sure to update SDV by the time that pandas 3.0 is out.

Let us know if you have any questions.

---

<div class="post-metadata">

**Author:** ![yuntien.lee](https://avatars.discourse-cdn.com/v4/letter/y/7ba0ec/32.png) [@yuntien.lee](https://forum.datacebo.com/u/yuntien.lee)\
**Post date:** [May 8, 2024, 3:31pm UTC](https://forum.datacebo.com/t/resolved-hsasynthesizer-futurewarning/177/3 "2024-05-08T15:31:35Z")

</div>

Great. Thanks.

---

<div class="post-metadata">

**Author:** ![neha](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.datacebo.com/neha/32/15_2.png) [@neha](https://forum.datacebo.com/u/neha)\
**Post date:** [May 13, 2024, 5:24pm UTC](https://forum.datacebo.com/t/resolved-hsasynthesizer-futurewarning/177/4 "2024-05-13T17:24:07Z")

</div>

Hi @yuntien.lee, good news is that the team is actively looking into this now and hope to have this fixed soon.

To help us be confident that this will fix what you’re seeing, could you be able to share some code that may help us to replicate the issue? For example, are you using HSA with any customizations, constraints, etc.

And also, could you confirm which version of SDV you are using? (Both public and enterprise)

```python
import sdv

print('SDV Enterprise version', sdv.version.enterprise)
print('SDV Public version', sdv.version.public)

```

---

<div class="post-metadata">

**Author:** ![yuntien.lee](https://avatars.discourse-cdn.com/v4/letter/y/7ba0ec/32.png) [@yuntien.lee](https://forum.datacebo.com/u/yuntien.lee)\
**Post date:** [May 13, 2024, 6:14pm UTC](https://forum.datacebo.com/t/resolved-hsasynthesizer-futurewarning/177/5 "2024-05-13T18:14:48Z")

</div>

**metadata**

> > > metadata  
> > > {  
> > > “tables”: {  
> > > “mem”: {  
> > > “columns”: {  
> > > “Member\_ID”: {  
> > > “sdtype”: “id”  
> > > },  
> > > “DOB”: {  
> > > “sdtype”: “datetime”  
> > > },  
> > > “Gender”: {  
> > > “sdtype”: “categorical”  
> > > },  
> > > “Exposure\_Months”: {  
> > > “sdtype”: “numerical”  
> > > }  
> > > },  
> > > “primary\_key”: “Member\_ID”  
> > > },  
> > > “med”: {  
> > > “columns”: {  
> > > “Member\_ID”: {  
> > > “sdtype”: “id”  
> > > },  
> > > “ClaimID”: {  
> > > “sdtype”: “unknown”,  
> > > “pii”: true  
> > > },  
> > > “FromDate”: {  
> > > “sdtype”: “datetime”  
> > > },  
> > > “ToDate”: {  
> > > “sdtype”: “datetime”  
> > > },  
> > > “PaidDate”: {  
> > > “sdtype”: “datetime”  
> > > },  
> > > “ICDDiag01”: {  
> > > “sdtype”: “categorical”  
> > > },  
> > > “ICDDiag02”: {  
> > > “sdtype”: “categorical”  
> > > },  
> > > “ICDDiag03”: {  
> > > “sdtype”: “categorical”  
> > > },  
> > > “ICDDiag04”: {  
> > > “sdtype”: “categorical”  
> > > },  
> > > “ICDDiag05”: {  
> > > “sdtype”: “categorical”  
> > > },  
> > > “ICDDiag06”: {  
> > > “sdtype”: “categorical”  
> > > },  
> > > “ICDDiag07”: {  
> > > “sdtype”: “categorical”  
> > > },  
> > > “ICDDiag08”: {  
> > > “sdtype”: “categorical”  
> > > },  
> > > “ICDDiag09”: {  
> > > “sdtype”: “categorical”  
> > > },  
> > > “ICDDiag10”: {  
> > > “sdtype”: “categorical”  
> > > },  
> > > “ICDDiag11”: {  
> > > “sdtype”: “categorical”  
> > > },  
> > > “ICDDiag12”: {  
> > > “sdtype”: “categorical”  
> > > },  
> > > “ICDDiag13”: {  
> > > “sdtype”: “categorical”  
> > > },  
> > > “ICDDiag14”: {  
> > > “sdtype”: “categorical”  
> > > },  
> > > “ICDDiag15”: {  
> > > “sdtype”: “categorical”  
> > > },  
> > > “ICDDiag16”: {  
> > > “sdtype”: “categorical”  
> > > },  
> > > “ICDDiag17”: {  
> > > “sdtype”: “categorical”  
> > > },  
> > > “ICDDiag18”: {  
> > > “sdtype”: “categorical”  
> > > },  
> > > “ICDDiag19”: {  
> > > “sdtype”: “categorical”  
> > > },  
> > > “ICDDiag20”: {  
> > > “sdtype”: “categorical”  
> > > },  
> > > “ICDDiag21”: {  
> > > “sdtype”: “categorical”  
> > > },  
> > > “ICDDiag22”: {  
> > > “sdtype”: “categorical”  
> > > },  
> > > “ICDDiag23”: {  
> > > “sdtype”: “categorical”  
> > > },  
> > > “ICDDiag24”: {  
> > > “sdtype”: “categorical”  
> > > },  
> > > “ICDDiag25”: {  
> > > “sdtype”: “categorical”  
> > > },  
> > > “ICDDiag26”: {  
> > > “sdtype”: “categorical”  
> > > },  
> > > “ICDDiag27”: {  
> > > “sdtype”: “categorical”  
> > > },  
> > > “ICDDiag28”: {  
> > > “sdtype”: “categorical”  
> > > },  
> > > “ICDDiag29”: {  
> > > “sdtype”: “categorical”  
> > > },  
> > > “ICDDiag30”: {  
> > > “sdtype”: “categorical”  
> > > },  
> > > “ProcCode”: {  
> > > “sdtype”: “categorical”  
> > > },  
> > > “POS”: {  
> > > “sdtype”: “categorical”  
> > > },  
> > > “MR\_Allowed”: {  
> > > “sdtype”: “numerical”  
> > > },  
> > > “MR\_Paid”: {  
> > > “sdtype”: “numerical”  
> > > }  
> > > }  
> > > },  
> > > “pharm”: {  
> > > “columns”: {  
> > > “Member\_ID”: {  
> > > “sdtype”: “id”  
> > > },  
> > > “NDC”: {  
> > > “sdtype”: “categorical”  
> > > },  
> > > “ClaimID”: {  
> > > “sdtype”: “unknown”,  
> > > “pii”: true  
> > > },  
> > > “FillDate”: {  
> > > “sdtype”: “datetime”  
> > > },  
> > > “ProviderID”: {  
> > > “sdtype”: “categorical”  
> > > },  
> > > “MR\_Allowed”: {  
> > > “sdtype”: “numerical”  
> > > },  
> > > “MR\_Paid”: {  
> > > “sdtype”: “numerical”  
> > > },  
> > > “Days\_Supplied”: {  
> > > “sdtype”: “numerical”  
> > > },  
> > > “Qty\_Dispensed”: {  
> > > “sdtype”: “numerical”  
> > > }  
> > > }  
> > > }  
> > > },  
> > > “relationships”: [  
> > > {  
> > > “parent\_table\_name”: “mem”,  
> > > “child\_table\_name”: “pharm”,  
> > > “parent\_primary\_key”: “Member\_ID”,  
> > > “child\_foreign\_key”: “Member\_ID”  
> > > },  
> > > {  
> > > “parent\_table\_name”: “mem”,  
> > > “child\_table\_name”: “med”,  
> > > “parent\_primary\_key”: “Member\_ID”,  
> > > “child\_foreign\_key”: “Member\_ID”  
> > > }  
> > > ],  
> > > “METADATA\_SPEC\_VERSION”: “MULTI\_TABLE\_V1”  
> > > }

**code snippet**  
metadata = MultiTableMetadata()  
metadata.detect\_from\_dataframes(data = all\_data)  
all\_data = poc.drop\_unknown\_references(metadata, all\_data)

synthesizer = HSASynthesizer(metadata)

for table\_name in all\_data.keys():  
synthesizer.set\_table\_parameters(  
table\_name=table\_name,  
table\_synthesizer=‘GaussianCopulaSynthesizer’,  
table\_parameters={  
#‘enforce\_min\_max\_values’: True,  
#‘default\_distribution’: ‘truncnorm’})  
‘default\_distribution’: ‘norm’})

synthesizer.fit(all\_data)  
f = open(‘hsa\_syn.pickle’, ‘wb’)  
pickle.dump(synthesizer, f)  
f.close()

---

<div class="post-metadata">

**Author:** ![yuntien.lee](https://avatars.discourse-cdn.com/v4/letter/y/7ba0ec/32.png) [@yuntien.lee](https://forum.datacebo.com/u/yuntien.lee)\
**Post date:** [May 13, 2024, 6:15pm UTC](https://forum.datacebo.com/t/resolved-hsasynthesizer-futurewarning/177/6 "2024-05-13T18:15:38Z")

</div>

SDV Enterprise version 0.12.1  
SDV Public version 1.12.1

---

<div class="post-metadata">

**Author:** ![neha](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.datacebo.com/neha/32/15_2.png) [@neha](https://forum.datacebo.com/u/neha)\
**Post date:** [May 14, 2024, 8:35pm UTC](https://forum.datacebo.com/t/resolved-hsasynthesizer-futurewarning/177/7 "2024-05-14T20:35:51Z")

</div>

Thanks @yuntien.lee. Unfortunately, the eng team is telling me that they are unable to trigger that exact warning message but we will keep trying.

One thing might be that you have an older version of pandas installed. This library is a dependency for using SDV so may be worth checking which version you’re on. Could you let us know what’s printed out if you run the code below?

```python
import pandas as pd

print('pandas version:', pd. __version__ )

```

---

<div class="post-metadata">

**Author:** ![yuntien.lee](https://avatars.discourse-cdn.com/v4/letter/y/7ba0ec/32.png) [@yuntien.lee](https://forum.datacebo.com/u/yuntien.lee)\
**Post date:** [May 15, 2024, 3:19pm UTC](https://forum.datacebo.com/t/resolved-hsasynthesizer-futurewarning/177/8 "2024-05-15T15:19:05Z")

</div>

pandas version: 2.2.1

---

<div class="post-metadata">

**Author:** ![neha](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.datacebo.com/neha/32/15_2.png) [@neha](https://forum.datacebo.com/u/neha)\
**Post date:** [May 24, 2024, 7:17pm UTC](https://forum.datacebo.com/t/resolved-hsasynthesizer-futurewarning/177/9 "2024-05-24T19:17:30Z")

</div>

Hi @yuntien.lee, appreciate all the info you were able to share.

Our team was able to replicate this and the fix is now available in the latest SDV Enterprise version (0.13.0), released earlier this week on May 21. If you upgrade your SDV version, the warning messages should now be fixed. Try it out and let us know if you’re still having problems.

Resource:

- **[Upgrading SDV Enterprise](https://docs.sdv.dev/sdv-enterprise/sdv-enterprise/installation#downloading-and-installing-using-license-keys)**
- **[SDV Enterprise 0.13.0 Release Notes](https://docs.sdv.dev/sdv-enterprise/sdv-enterprise/release-notes#version-0.13.0-may-21-2024)**

---

<div class="post-metadata">

**Author:** ![neha](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.datacebo.com/neha/32/15_2.png) [@neha](https://forum.datacebo.com/u/neha)\
**Post date:** [May 30, 2024, 9:48pm UTC](https://forum.datacebo.com/t/resolved-hsasynthesizer-futurewarning/177/10 "2024-05-30T21:48:49Z")

</div>


