<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 In this particular dataset, there are long (sometimes HTML) descriptions of objects. We're caching these locally in the JSON results from the API requests to Open Context. However, for our purposes of making analysis friendly dataframes, we don't need these long free-text attributes. So we'll drop them from the dataframe.
Step1:  Using the already cached JSON obtained from the Open Context API, we can make a second dataframe that is "wider" (has many more columns"). This wide dataframe will express multiple values for "Motif", "Decorative Technique", and "Fabric Category" in different columns. We set the dictioary oc_api.multi_value_handle_keyed_attribs to do this.
Step2:  The df_wide dataframe handles multiple values for some attributes by making many boolean columns, with each column noting the presense of a given attribute value on a row for an artifact. For example, True values on the column "Motif 
<ASSISTANT_TASK:>
Python Code:
# Define a list of columns to drop.
drop_cols = [
    'Fragment Noted',
    'Depth Notes',
    'Supplement Note',
    'Fabric Description',
    'Description',
    'Size',
]
df.drop(columns=drop_cols, inplace=True)
# The API returns 'False' if a citation URI is not defined, it's better 
# practice to make this a null.
df.loc[(df['citation uri'] == False), 'citation uri'] = np.nan 
import os
# Now save the results of all of this as a CSV file.
repo_path = os.path.dirname(os.path.abspath(os.getcwd()))
csv_path = os.path.join(
    repo_path, 
    'files',
    'oc-api-murlo-objects-multivalue-as-json.csv'
)
df.to_csv(csv_path, index=False)
print('Saved this example as a CSV table at: {}'.format(csv_path))
Explanation: In this particular dataset, there are long (sometimes HTML) descriptions of objects. We're caching these locally in the JSON results from the API requests to Open Context. However, for our purposes of making analysis friendly dataframes, we don't need these long free-text attributes. So we'll drop them from the dataframe.
End of explanation
oc_api.multi_value_handle_non_number = 'concat'
oc_api.multi_value_handle_keyed_attribs = {
    'Motif': 'column_val',
    'Decorative Technique': 'column_val',
    'Fabric Category': 'column_val',
}
df_wide = oc_api.url_to_dataframe(url, attribs_for_records)
Explanation: Using the already cached JSON obtained from the Open Context API, we can make a second dataframe that is "wider" (has many more columns"). This wide dataframe will express multiple values for "Motif", "Decorative Technique", and "Fabric Category" in different columns. We set the dictioary oc_api.multi_value_handle_keyed_attribs to do this.
End of explanation
df_wide.drop(columns=drop_cols, inplace=True)
# The API returns 'False' if a citation URI is not defined, it's better 
# practice to make this a null.
df_wide.loc[(df_wide['citation uri'] == False), 'citation uri'] = np.nan 
csv_wide_path = os.path.join(
    repo_path, 
    'files',
    'oc-api-murlo-objects-multivalue-as-cols.csv'
)
df_wide.to_csv(csv_wide_path, index=False)
print('Saved this example wide as a CSV table at: {}'.format(csv_wide_path))
Explanation: The df_wide dataframe handles multiple values for some attributes by making many boolean columns, with each column noting the presense of a given attribute value on a row for an artifact. For example, True values on the column "Motif :: Panther"" indicate the presense of a "Panther" motif observed on an artifact, and True valeus of the column "Motif :: Potnia Theron" indicate a "Potnia Theron" motif on an artifact.
End of explanation
<END_TASK>