Skip to main content

A python wrapper for the R function factanal.

Project description


Python wrapper replicating the known factor analysis output from the factanal R function. The only supported input is a pandas data frame. Formulas as input are currently not supported. A covariance matrix is always computed from the input data frame. Setting control variables for maximum likelihood estimation is currently not supported.

Further information on R's factanal function for factor analysis:

More information on the factanal output and examples:


import pandas as pd
from R.wrapper import factanal

df = pd.DataFrame({"v1": [1,1,1,1,1,1,1,1,1,1,3,3,3,3,3,4,5,6],
                   "v2": [1,2,1,1,1,1,2,1,2,1,3,4,3,3,3,4,6,5],
                   "v3": [3,3,3,3,3,1,1,1,1,1,1,1,1,1,1,5,4,6],
                   "v4": [3,3,4,3,3,1,1,2,1,1,1,1,2,1,1,5,6,4],
                   "v5": [1,1,1,1,1,3,3,3,3,22,1,1,1,322,1,6,4,5],
                   "v6": [1,1,2,1,1,3,3,3,3,22,1,1,1,322,1,6,4,5],
                   "v7": [1,1,4,1,1,3,3,3,3,3,1,2,1,1,1,6,4,5],
                   "v8": [1,1,5,2,1,3,3,3,4,3,1,2,1,2,1,6,5,4]})

fa_res = factanal(pdf, factors=5, scores='regression', rotation='varimax', 
                  verbose=True, return_dict=True)



pip install factanal


The only dependency is the rpy2 library.

In addition to that, R must be installed on your system and accessible to rpy2.

More information on rpy2:

Download R here:


Factanal for python is MIT licensed.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for factanal, version 0.1.6
Filename, size File type Python version Upload date Hashes
Filename, size factanal-0.1.6-py3-none-any.whl (3.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size factanal-0.1.6.tar.gz (2.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page