Skip to main content

Factanal

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: https://www.rdocumentation.org/packages/stats/versions/3.6.2/topics/factanal

More information on the factanal output and examples: https://data.library.virginia.edu/getting-started-with-factor-analysis/

Example

import pandas as pd
import random
from factanal.wrapper import factanal

pdf = pd.DataFrame({"v1": [random.randint(0, 100) for _ in range (30)],
                    "v2": [random.randint(0, 100) for _ in range (30)],
                    "v3": [random.randint(0, 100) for _ in range (30)],
                    "v4": [random.randint(0, 100) for _ in range (30)],
                    "v5": [random.randint(0, 100) for _ in range (30)],
                    "v6": [random.randint(0, 100) for _ in range (30)],
                    "v7": [random.randint(0, 100) for _ in range (30)],
                    "v8": [random.randint(0, 100) for _ in range (30)]})

fa_res = factanal(pdf, factors=4, scores='regression', rotation='promax', 
                  verbose=True, return_dict=True)

pd.DataFrame(fa_res["scores"])

Installation

pip install factanal

Dependencies

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: https://rpy2.github.io/doc/latest/html/index.html

Download R here: https://www.r-project.org/

Misc

Factanal for python is MIT licensed.

Download files

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

Source Distribution

factanal-0.1.8.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

factanal-0.1.8-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file factanal-0.1.8.tar.gz.

File metadata

  • Download URL: factanal-0.1.8.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200330 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for factanal-0.1.8.tar.gz
Algorithm Hash digest
SHA256 de19f18cf3eae11cd2dc77f3ea67cef071511ee626cbfd97fa8f2bdb36356afd
MD5 364567c025ef82e7ab424c7b85df50e1
BLAKE2b-256 b22c1b3a97dde23b6232813892dcda5a5079e12cc0a74ed42b388ab6daaefe73

See more details on using hashes here.

File details

Details for the file factanal-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: factanal-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200330 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for factanal-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 05f4df7af704928016492b9998fae7b31ebf4d1ccdbc35f7635ea30210524b1c
MD5 37c73500c51702f19630ad5e859e577a
BLAKE2b-256 34fb41dd5b2db671acd0cec539a8de6cc44072af622f792765ff82cc59e5b958

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page