Skip to content

Commit

Permalink
Improve handling of 'int' columns in 'sumstats.py qc' procedure
Browse files Browse the repository at this point in the history
  • Loading branch information
ofrei committed Aug 2, 2017
1 parent 2a145c1 commit 36285c1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sumstats.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,12 +453,14 @@ def make_qc(args, log):
for col in args.fix_dtype_cols:
if col in sumstats:
log.log('Set column {} dtype to {}'.format(col, cols_type_map[col]))
if cols_type_map[col] == float or cols_type_map[col] == np.float64:
if cols_type_map[col] in [float, np.float64, int]:
sumstats[col] = pd.to_numeric(sumstats[col], errors='coerce')
if col in args.dropna_cols:
sumstats_len = len(sumstats)
sumstats.dropna(subset=[col], inplace=True)
if len(sumstats) != sumstats_len: log.log('Drop {} markers after dtype conversion'.format(sumstats_len - len(sumstats)))
if cols_type_map[col] == int:
sumstats[col] = sumstats[col].astype(int)
else:
sumstats[col] = sumstats[col].astype(cols_type_map[col])
for range in exclude_ranges:
Expand Down

0 comments on commit 36285c1

Please sign in to comment.