Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# ---------------------------------------------------------------------
# Append parametric columns
stats.loc[:, 'Parametric'] = parametric
# Reorder and drop empty columns
stats = stats[np.array(col_order)[np.isin(col_order, stats.columns)]]
stats = stats.dropna(how='all', axis=1)
# Rename Time columns
if (contrast in ['multiple_within', 'multiple_between', 'within_between']
and interaction):
stats['Time'].fillna('-', inplace=True)
stats.rename(columns={'Time': factors[0]}, inplace=True)
if export_filename is not None:
_export_table(stats, export_filename)
return stats
# Standardize correlation coefficients (Fisher z-transformation)
stats['z'] = np.round(np.arctanh(stats['r'].values), 3)
col_order = ['X', 'Y', 'method', 'tail', 'n', 'outliers', 'r', 'CI95%',
'r2', 'adj_r2', 'z', 'p-unc', 'p-corr', 'p-adjust',
'BF10', 'power']
# Reorder columns and remove empty ones
stats = stats.reindex(columns=col_order).dropna(how='all', axis=1)
# Add covariates names if present
if covar is not None:
stats.insert(loc=3, column='covar', value=str(covar))
if export_filename is not None:
_export_table(stats, export_filename)
return stats