Skip to content

Commit

Permalink
solved delimiter issue in data cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
tuonopettinato committed May 26, 2024
1 parent 4c56944 commit 110b0b2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
Binary file modified brainage/__pycache__/utils.cpython-311.pyc
Binary file not shown.
1 change: 1 addition & 0 deletions brainage/neural_net.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ def neural_net_parsing():
p_value_emp(pad_control, pad_asd)
sites_asd = get_sites(args.filename, site_col = args.site_col, group_col = args.group,
group_value = 1) # 1 is for ASD group
print(np.mean(pad_control), np.mean(pad_asd))
sites_barplot(pad_asd, sites_asd)
if args.plot:
plt.show()
Expand Down
16 changes: 6 additions & 10 deletions brainage/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def handle_spurious(df: pd.DataFrame, *args: str) -> pd.DataFrame:
if isinstance(arg, str):
df.drop(arg, axis="columns", inplace=True)
else:
print("Invalid argument!")
logger.error('Invalid argument')

# Replace -9999 with NaN
df.replace(-9999, np.nan, inplace=True)
Expand Down Expand Up @@ -370,19 +370,15 @@ def sites_barplot(numbers, sites):
plt.savefig("../plots/bar_plot.png", transparent = True)

if __name__ == "__main__":

# Uncomment for a rapid test

df = pd.read_csv('../data/abide.csv', delimiter = ';')
## First step
# check_for_spurious(df, show = True)
# check_site_correlation(df).to_csv("../data/site_correlation.csv")
## Second step
# df = handle_spurious(df, "FIQ",
# "Left-vessel_Volume_mm3",
# "Right-vessel_Volume_mm3",
# "5th-Ventricle_Volume_mm3")
# df.to_csv('../data/abide_clean.csv')
# check_site_correlation(df).to_csv("site_correlation_no_spurious.csv")
df = pd.read_csv("../data/abide.csv", delimiter = ';')
# # handle_spurious(df)
get_correlation(df)
# df.to_csv('../data/abide_clean.csv', sep=';')
# logger.info('Done')


0 comments on commit 110b0b2

Please sign in to comment.