I have a dataframe of ones and zeros which act as metadata to describe the properties of some features of the main dataset. As part of a data exploration I was running the following code on the dataframe, to express those features tags into a 2D plot.
mca = prince.MCA()
mca_mtx = mca.fit(tags_df).transform(tags_df)
But I am getting during the fit the following error:
array must not contain infs or nans
After inspecting the dataframe I see there are no infs or nans in the entire dataset. So the problem must be something else.
Anyone idea how to solve this?
Apparently it is a known bug. The problem is in the values of the dataframe
tags_df, since1.0and0.0are producinginfornanduring themcaalgorithm.I tried changing those
1.0and0.0byTrueandFalse(bool type) without success. However, the string version did the trick, that is"True"and"False". So the following line solved my problem: