MaxHalford / prince

:crown: Multivariate exploratory data analysis in Python — PCA, CA, MCA, MFA, FAMD, GPA
https://maxhalford.github.io/prince
MIT License
1.27k stars 184 forks source link

'DataFrame' object has no attribute 'to_numpy' in Python 3.6 #101

Closed ftatarli closed 1 year ago

ftatarli commented 4 years ago

Hey, I was trying to run the example provided in the documentation, but I am getting the following error:

AttributeError: 'DataFrame' object has no attribute 'to_numpy'

Here is the code:

X = pd.DataFrame(
    data=[
         ['A', 'A', 'A', 2, 5, 7, 6, 3, 6, 7],
         ['A', 'A', 'A', 4, 4, 4, 2, 4, 4, 3],
         ['B', 'A', 'B', 5, 2, 1, 1, 7, 1, 1],
         ['B', 'A', 'B', 7, 2, 1, 2, 2, 2, 2],
         ['B', 'B', 'B', 3, 5, 6, 5, 2, 6, 6],
         ['B', 'B', 'A', 3, 5, 4, 5, 1, 7, 5]
     ],
     columns=['E1 fruity', 'E1 woody', 'E1 coffee',
              'E2 red fruit', 'E2 roasted', 'E2 vanillin', 'E2 woody',
              'E3 fruity', 'E3 butter', 'E3 woody'],
     index=['Wine {}'.format(i+1) for i in range(6)]
)

X['Oak type'] = [1, 2, 2, 2, 1, 1]

famd = prince.FAMD(
    n_components=2,
    n_iter=3,
    copy=True,
    check_input=True,
    engine='auto',
    random_state=42
)

famd = famd.fit(X.drop('Oak type', axis='columns'))

Has anyone faced this before?

Thanks, Filipe

MaxHalford commented 4 years ago

How about if you upgrade pandas?

ftatarli commented 4 years ago

Perfect, thanks for that!