0

Using mca package in Python

Hello, I would like to do a Multiple Correspondence Analysis (MCA) in one of the python files called "Train" following the example of the link in the first line of the code. The file gives me a matrix but I would like to display it in a graph because the matrix does not give any indication on what percentage each variable explains the pattern. So when I get to the second part with ax I only have errors, can you help me? Code: #https://stackoverflow.com/questions/48521740/using-mca-package-in-python import pandas as pd import prince X=Train[Train.columns[10:54]] mca=prince.MCA() mca = mca.fit(X) mca = mca.transform(X) ax = mca.plot_coordinates( X=X, ax=None, figsize=(6, 6), show_row_points=True, row_points_size=10, show_row_labels=False, show_column_points=True, column_points_size=30, show_column_labels=False, legend_n_cols=1 ) ax.get_figure().savefig('images/mca_coordinates.svg')

3rd Oct 2022, 10:32 AM
Storm
1 Antwort
0
Are you sure it’s the prince module you want? Because when I tried it in the code playground, it returned an error saying it wasn’t found.
5th Oct 2023, 11:59 PM
Annihilate
Annihilate - avatar