From e492cafd589c4123518ad0b9a596dab18a1d78e0 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 19 Mar 2013 09:04:30 -0400 Subject: [PATCH] pca.py: Add ability to drop columns (questions) from input data --- posts/Factor_analysis/pca.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/posts/Factor_analysis/pca.py b/posts/Factor_analysis/pca.py index 03d1639..0e8aaaf 100755 --- a/posts/Factor_analysis/pca.py +++ b/posts/Factor_analysis/pca.py @@ -597,6 +597,9 @@ if __name__ == '__main__': parser.add_argument( '-u', dest='unitary', default=False, action='store_const', const=True, help='use unitary eigenvalues for factor loading') + parser.add_argument( + '-d', dest='drop', type=int, action='append', + help='drop a column from the analysis') parser.add_argument( 'path', help='path to the tab-delimited data file to analyze') @@ -604,4 +607,6 @@ if __name__ == '__main__': args = parser.parse_args() scores = _numpy.genfromtxt(fname=args.path, delimiter='\t') + if args.drop: + scores = _numpy.delete(scores, args.drop, axis=1) analyze(scores=scores, output_dim=args.output_dim, unitary=args.unitary) -- 2.26.2