# \[Resolved\] TypeError: ufunc 'isinf' not supported for the input types

**URL:** <https://forum.datacebo.com/t/resolved-typeerror-ufunc-isinf-not-supported-for-the-input-types/133>\
**Category:** Synthetic Data Creation\
**Tags:** data-integration\
**Created:** [February 20, 2024, 12:18pm UTC](https://forum.datacebo.com/t/resolved-typeerror-ufunc-isinf-not-supported-for-the-input-types/133 "2024-02-20T12:18:46Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![anna.popovychenko](https://avatars.discourse-cdn.com/v4/letter/a/919ad9/32.png) [@anna.popovychenko](https://forum.datacebo.com/u/anna.popovychenko)\
**Post date:** [February 20, 2024, 12:18pm UTC](https://forum.datacebo.com/t/resolved-typeerror-ufunc-isinf-not-supported-for-the-input-types/133/1 "2024-02-20T12:18:46Z")

</div>

Hello,  
I get bellow error during hsasynthesizer.fit():  
Traceback (most recent call last):  
File “C:\Users\anna.popovychenko\project\sdv\_trial\gen.py”, line 74, in   
synthesizer.fit(real\_data)  
File “C:\Users\anna.popovychenko.pyenv\pyenv-win\versions\3.9.13\lib\site-packages\sdv\multi\_table\base.py”, line 364, in fit  
processed\_data = self.preprocess(data)  
File “packaging\sdv\_enterprise\sdv\multi\_table\hsa\hsa.pyx”, line 75, in sdv\_enterprise.sdv.multi\_table.hsa.hsa.expirable.wrapper  
File “packaging\sdv\_enterprise\sdv\multi\_table\hsa\hsa.pyx”, line 161, in sdv\_enterprise.sdv.multi\_table.hsa.hsa.HSASynthesizer.preprocess  
File “C:\Users\anna.popovychenko.pyenv\pyenv-win\versions\3.9.13\lib\site-packages\sdv\multi\_table\base.py”, line 319, in preprocess  
self.\_assign\_table\_transformers(synthesizer, table\_name, table\_data)  
File “C:\Users\anna.popovychenko.pyenv\pyenv-win\versions\3.9.13\lib\site-packages\sdv\multi\_table\base.py”, line 233, in \_assign\_table\_transformers  
synthesizer.auto\_assign\_transformers(table\_data)  
File “C:\Users\anna.popovychenko.pyenv\pyenv-win\versions\3.9.13\lib\site-packages\sdv\single\_table\base.py”, line 277, in auto\_assign\_transformers  
self.\_data\_processor.prepare\_for\_fitting(data)  
File “C:\Users\anna.popovychenko.pyenv\pyenv-win\versions\3.9.13\lib\site-packages\sdv\data\_processing\data\_processor.py”, line 721, in prepare\_for\_fitting  
self.\_fit\_formatters(data)  
File “C:\Users\anna.popovychenko.pyenv\pyenv-win\versions\3.9.13\lib\site-packages\sdv\data\_processing\data\_processor.py”, line 696, in \_fit\_formatters  
self.formatters[column\_name].learn\_format(data[column\_name])  
File “C:\Users\anna.popovychenko.pyenv\pyenv-win\versions\3.9.13\lib\site-packages\sdv\data\_processing\numerical\_formatter.py”, line 95, in learn\_format  
self.\_rounding\_digits = self.\_learn\_rounding\_digits(column)  
File “C:\Users\anna.popovychenko.pyenv\pyenv-win\versions\3.9.13\lib\site-packages\sdv\data\_processing\numerical\_formatter.py”, line 59, in \_learn\_rounding\_digits  
roundable\_data = data[~(np.isinf(data) | pd.isna(data))]  
TypeError: ufunc ‘isinf’ not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ‘‘safe’’

I added debug logs and found out column name. Column type is int, no null values. What can be reason?

---

<div class="post-metadata">

**Author:** ![Plamen](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.datacebo.com/plamen/32/33_2.png) [@Plamen](https://forum.datacebo.com/u/Plamen)\
**Post date:** [February 20, 2024, 1:11pm UTC](https://forum.datacebo.com/t/resolved-typeerror-ufunc-isinf-not-supported-for-the-input-types/133/2 "2024-02-20T13:11:56Z")

</div>

Hello @anna.popovychenko , Could you make sure that the column is of dtype `float` or `int`. I believe that it could be that the column contains either an element or something that is not supposed to be numerical and therefore the pandas function is not able to cast it.

I would suggest you to cast it to `float` or `int` and see if you get any errors before fitting the model, for example:

```python
data[column_name] = data[column_name].astype(float)
or
data[column_name] = data[column_name].astype(int)

```

If none of those two work, please feel free to provide the `pandas.dtype` and `sdtype` of the column so we can assist you.

---

<div class="post-metadata">

**Author:** ![anna.popovychenko](https://avatars.discourse-cdn.com/v4/letter/a/919ad9/32.png) [@anna.popovychenko](https://forum.datacebo.com/u/anna.popovychenko)\
**Post date:** [February 20, 2024, 1:26pm UTC](https://forum.datacebo.com/t/resolved-typeerror-ufunc-isinf-not-supported-for-the-input-types/133/3 "2024-02-20T13:26:38Z")

</div>

Thanks @Plamen  
Already solved

---

<div class="post-metadata">

**Author:** ![Plamen](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.datacebo.com/plamen/32/33_2.png) [@Plamen](https://forum.datacebo.com/u/Plamen)\
**Post date:** [February 20, 2024, 3:01pm UTC](https://forum.datacebo.com/t/resolved-typeerror-ufunc-isinf-not-supported-for-the-input-types/133/4 "2024-02-20T15:01:18Z")

</div>

@anna.popovychenko, we appreciate your assistance! Could you kindly share additional context regarding the resolution of the issue? Specifically:

1. How was the dataframe loaded? (e.g., using `pandas.read_csv` or any alternative methods)
2. What was the data type of the column before casting it to `int` or `float`?
3. Did the casting operation resolve the issue, or were there additional steps taken to rectify the problem?

We appreciate you for your collaboration.

---

<div class="post-metadata">

**Author:** ![anna.popovychenko](https://avatars.discourse-cdn.com/v4/letter/a/919ad9/32.png) [@anna.popovychenko](https://forum.datacebo.com/u/anna.popovychenko)\
**Post date:** [February 21, 2024, 6:59am UTC](https://forum.datacebo.com/t/resolved-typeerror-ufunc-isinf-not-supported-for-the-input-types/133/5 "2024-02-21T06:59:49Z")

</div>

astype(int) fixed issue. Before cast it was Int64

---

<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:** [February 21, 2024, 5:25pm UTC](https://forum.datacebo.com/t/resolved-typeerror-ufunc-isinf-not-supported-for-the-input-types/133/6 "2024-02-21T17:25:11Z")

</div>

Hi @anna.popovychenko, I wonder if the root cause of this is the same as [the other thread](https://forum.datacebo.com/t/inequality-constraint-for-2-datetime-columns/135/3).

Assuming that you currently have the following code:

```python
real_data = pd.read_csv("file.csv")
real_data= real_data.convert_dtypes()

```

I would recommend removing the second line (`convert_dtypes` command). And perhaps loading multiple CSVs at once for convenience.

```python
from sdv.datasets.local import load_csvs

# load multiple CSV files from within a folder
real_data = load_csvs(folder_name='my_folder/')

# the data is ready for training
# no modifications should be needed

```

---

<div class="post-metadata">

**Author:** ![anna.popovychenko](https://avatars.discourse-cdn.com/v4/letter/a/919ad9/32.png) [@anna.popovychenko](https://forum.datacebo.com/u/anna.popovychenko)\
**Post date:** [February 22, 2024, 9:28am UTC](https://forum.datacebo.com/t/resolved-typeerror-ufunc-isinf-not-supported-for-the-input-types/133/7 "2024-02-22T09:28:32Z")

</div>

Hi @neha , thank you. Yes, indeed, this issue comes from `convert_dtypes`

---

<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:** [April 29, 2024, 10:52pm UTC](https://forum.datacebo.com/t/resolved-typeerror-ufunc-isinf-not-supported-for-the-input-types/133/8 "2024-04-29T22:52:57Z")

</div>

Just an update to everyone on this issue: The team is actively looking into dtypes to expand support.

Until then, we recommend keeping the original numpy sdtypes and not trying to do any other optimization. SDV is designed to work best after simply reading your data from its original source (CSV, etc.).

Closing this issue out since it has been resolved. But please feel free to start a new topic (perhaps a feature request) for supporting additional sdtypes specifically.

---

<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:** [April 29, 2024, 10:53pm UTC](https://forum.datacebo.com/t/resolved-typeerror-ufunc-isinf-not-supported-for-the-input-types/133/9 "2024-04-29T22:53:01Z")

</div>


