mirror of https://github.com/tdwg/dwc.git
Change deprecated DataFrame append statements to concat
This commit is contained in:
parent
df27999d54
commit
ce4f0342bf
|
@ -55,7 +55,8 @@ for term_list_index in range(len(term_lists)):
|
||||||
accumulated_frame = versions_df.copy()
|
accumulated_frame = versions_df.copy()
|
||||||
else:
|
else:
|
||||||
# append subsequent term lists data to the DataFrame
|
# append subsequent term lists data to the DataFrame
|
||||||
accumulated_frame = accumulated_frame.append(versions_df.copy(), sort=True)
|
#accumulated_frame = accumulated_frame.append(versions_df.copy(), sort=True)
|
||||||
|
accumulated_frame = pd.concat([accumulated_frame, versions_df], sort=True)
|
||||||
|
|
||||||
# Special procedure for obsolete terms
|
# Special procedure for obsolete terms
|
||||||
# Retrieve versions metadata
|
# Retrieve versions metadata
|
||||||
|
@ -84,7 +85,9 @@ for row_index,row in versions_df.iterrows():
|
||||||
# Add the curren term IRI list to the DataFrame as the term_iri column
|
# Add the curren term IRI list to the DataFrame as the term_iri column
|
||||||
versions_df['term_iri'] = term_iri_list
|
versions_df['term_iri'] = term_iri_list
|
||||||
# Add the obsolete terms DataFrame to the accumulated DataFrame
|
# Add the obsolete terms DataFrame to the accumulated DataFrame
|
||||||
accumulated_frame = accumulated_frame.append(versions_df.copy(), sort=True)
|
#accumulated_frame = accumulated_frame.append(versions_df.copy(), sort=True)
|
||||||
|
accumulated_frame = pd.concat([accumulated_frame, versions_df], sort=True)
|
||||||
|
|
||||||
|
|
||||||
accumulated_frame.reset_index(drop=True, inplace=True) # reset the row indices to consecutive starting with zero
|
accumulated_frame.reset_index(drop=True, inplace=True) # reset the row indices to consecutive starting with zero
|
||||||
accumulated_frame.fillna('', inplace=True) # replace all missing values with empty strings
|
accumulated_frame.fillna('', inplace=True) # replace all missing values with empty strings
|
||||||
|
@ -166,7 +169,8 @@ for qrg_index,qrg_row in qrg_df.iterrows():
|
||||||
for row_index,row in normative_doc_df.iterrows():
|
for row_index,row in normative_doc_df.iterrows():
|
||||||
if (qrg_row['recommended_term_iri'] == row['term_iri']) and (row['status'] == 'recommended'):
|
if (qrg_row['recommended_term_iri'] == row['term_iri']) and (row['status'] == 'recommended'):
|
||||||
found = True
|
found = True
|
||||||
built_rows_df = built_rows_df.append(row)
|
#built_rows_df = built_rows_df.append(row)
|
||||||
|
built_rows_df.loc[len(built_rows_df.index)] = row
|
||||||
remaining_rows_df.drop(row['iri'], axis=0, inplace=True)
|
remaining_rows_df.drop(row['iri'], axis=0, inplace=True)
|
||||||
break
|
break
|
||||||
if not found:
|
if not found:
|
||||||
|
@ -178,7 +182,8 @@ sorted_output = remaining_rows_df.iloc[remaining_rows_df.iri.str.lower().argsort
|
||||||
|
|
||||||
# Concatenate ordered terms and remaining versions
|
# Concatenate ordered terms and remaining versions
|
||||||
#normative_doc_df = built_rows_df.append(remaining_rows_df)
|
#normative_doc_df = built_rows_df.append(remaining_rows_df)
|
||||||
normative_doc_df = built_rows_df.append(sorted_output)
|
#normative_doc_df = built_rows_df.append(sorted_output)
|
||||||
|
normative_doc_df = pd.concat([built_rows_df, sorted_output])
|
||||||
|
|
||||||
# Save the normative document DataFrame as a CSV
|
# Save the normative document DataFrame as a CSV
|
||||||
normative_doc_df.to_csv('../vocabulary/term_versions.csv', index = False)
|
normative_doc_df.to_csv('../vocabulary/term_versions.csv', index = False)
|
||||||
|
|
Loading…
Reference in New Issue