Skip to content

Commit

Permalink
[FIX] Update references to pandas index.get_values()
Browse files Browse the repository at this point in the history
This function call was deprecated with newer versions of pandas
and has been updated to address issue edickie#170
  • Loading branch information
DESm1th committed Nov 3, 2022
1 parent ce1876b commit c631502
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions ciftify/bin/ciftify_atlas_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def report_atlas_overlap(df, label_data, atlas, surf_va_LR, min_percent_overlap
# write an overlap report to the outputfile
o_col = '{}_overlap'.format(atlas['name'])
df[o_col] = ""
for pd_idx in df.index.get_values():
for pd_idx in df.index.to_numpy():
df.loc[pd_idx, o_col] = ciftify.report.get_label_overlap_summary(
pd_idx, label_data, atlas_data, atlas_dict, surf_va_LR,
min_percent_overlap = min_percent_overlap)
Expand Down Expand Up @@ -102,7 +102,7 @@ def run_ciftify_dlabel_report(arguments, tmpdir):

# calculate a column of the surface area for row ROIs
df['area'] = -999
for pd_idx in df.index.get_values():
for pd_idx in df.index.to_numpy():
df.loc[pd_idx, 'area'] = ciftify.report.calc_cluster_area(pd_idx,
label_data, surf_va_LR)

Expand Down
4 changes: 2 additions & 2 deletions ciftify/bin/ciftify_statclust_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def report_atlas_overlap(df, label_data, atlas, surf_va_LR, min_percent_overlap
# write an overlap report to the outputfile
o_col = '{}_overlap'.format(atlas['name'])
df[o_col] = ""
for pd_idx in df.index.get_values():
for pd_idx in df.index.to_numpy():
df.loc[pd_idx, o_col] = ciftify.report.get_label_overlap_summary(
pd_idx, label_data, atlas_data, atlas_dict, surf_va_LR,
min_percent_overlap = min_percent_overlap)
Expand Down Expand Up @@ -179,7 +179,7 @@ def run_ciftify_dlabel_report(arguments, tmpdir):

# calculate a column of the surface area for row ROIs
df['area'] = -999
for pd_idx in df.index.get_values():
for pd_idx in df.index.to_numpy():
df.loc[pd_idx, 'area'] = ciftify.report.calc_cluster_area(pd_idx,
label_data, surf_va_LR)

Expand Down
4 changes: 2 additions & 2 deletions ciftify/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def calc_label_to_atlas_overlap(clust_id1, clust_atlas1_data,
o_df = pd.DataFrame.from_dict(clust_atlas2_dict, orient = "index")
o_df = o_df.rename(index=str, columns={0: "clusterID"})

for idx_label2 in o_df.index.get_values():
for idx_label2 in o_df.index.to_numpy():
o_df.loc[idx_label2, 'overlap_area'] = calc_overlapping_area(clust_id1, clust_atlas1_data,
idx_label2, clust_atlas2, surf_va_array)
return(o_df)
Expand All @@ -184,7 +184,7 @@ def overlap_summary_string(overlap_df, min_percent_overlap):
rdf = overlap_df[overlap_df.overlap_percent > min_percent_overlap]
rdf = rdf.sort_values(by='overlap_percent', ascending=False)
result_string = ""
for o_label in rdf.index.get_values():
for o_label in rdf.index.to_numpy():
result_string += '{} ({:2.1f}%); '.format(rdf.loc[o_label, 'clusterID'],
rdf.loc[o_label, 'overlap_percent'])
return(result_string)
Expand Down

0 comments on commit c631502

Please sign in to comment.