question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CA fit - TypeError: No loop matching the specified signature and casting was found for ufunc true_divide

See original GitHub issue

I get a TypeError using CA or MCA from the examples posted in the repository

pd.set_option('display.float_format', lambda x: '{:.6f}'.format(x))
X = pd.DataFrame(
    data=[
    [326, 38, 241, 110, 3],
    [688, 116, 584, 188, 4],
    [343, 84, 909, 412, 26],
    [98, 48, 403, 681, 85]
    ],
    columns=pd.Series(['Fair', 'Red', 'Medium', 'Dark', 'Black']),
    index=pd.Series(['Blue', 'Light', 'Medium', 'Dark'])
)

ca = prince.CA( n_components=2, n_iter=3, copy=True, check_input=True, engine='auto', random_state=42)
X.columns.rename('Hair color', inplace=True)
X.index.rename('Eye color', inplace=True)
ca = ca.fit(X)
TypeError                                 Traceback (most recent call last)
<ipython-input-25-6248e8f8c83f> in <module>
      3 X.index.rename('Eye color', inplace=True)
      4 X
----> 5 ca = ca.fit(X)

~\anaconda3\lib\site-packages\prince\ca.py in fit(self, X, y)
     43 
     44         # Compute the correspondence matrix which contains the relative frequencies
---> 45         X /= np.sum(X)
     46 
     47         # Compute row and column masses

TypeError: No loop matching the specified signature and casting was found for ufunc true_divide

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
MaxHalfordcommented, Oct 6, 2020

This should be fixed with version 0.7.1.

0reactions
SammieH21commented, Oct 6, 2020

Awesome, and thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

No loop matching the specified signature and casting ... - GitHub
Getting TypeError: No loop matching the specified signature and casting was found for ufunc true_divide despite using np.true_divide #17221.
Read more >
Getting No loop matching the specified signature and casting ...
I'm a beginner to python and machine learning . I get below error when i try to fit data into ...
Read more >
TypeError on the first example in Lesson 1: No loop matching ...
TypeError : No loop matching the specified signature and casting was found for ufunc add. It comes from the learn.fit(0.01, 2) but the...
Read more >
No loop matching the specified signature and casting was found
Hi! I'm following along a course ("Learning Python for Data analysis and visualization") on Udemy. While there are quite a few errors in...
Read more >
typeerror: ufunc 'true_divide' not supported for the input types ...
If dtype of a and b are both integers, then the error you get is: No loop matching the specified signature and casting...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found