I have two lists that I am trying to zip. I would like to zip them so that they match by their id value. So, for row, the id would be 'Video ID' and for founded_evideo, the id would be 'post_id'. I would like to zip so that the ids match.
I have tried sorting the panda frame first using sort_values function, but this doesn't seem to have an effect on the zip function. Ex:
Code
founded_edvideos_list = find_matching_posts_forupdate(video_id_list, stop_at_page=stop_at_page)
founded_edvideos_df = pd.DataFrame(founded_edvideos_list)
founded_edvideos_df = founded_edvideos_df.sort_values(by=['post_id'], ascending=True)
founded_edvideos_df = founded_edvideos_df.where(pd.notnull(founded_edvideos_df), None)
excel_data = file_as_df[file_as_df['Video ID'].isin(founded_edvideos_df['post_id'])]
excel_data = excel_data.copy()
excel_data['Video ID'] = excel_data['Video ID'].astype("category")
excel_data['Video ID'].cat.set_categories(file_as_df['Video ID'].to_list(), inplace=True)
excel_data.sort_values(["Video ID"])
excel_data = excel_data.to_dict('r')
for (row,founded_evideo) in zip(excel_data,founded_edvideos_list):
more code
row example
{
'Video ID': 12894,
'Title': 'Trailblazer Melba Pattillo Beals',
'Excerpt': 'Meet Melba Pattillo Beals PhD., member of the Little Rock Nine, and trailblazer for civil rights.',
'Video Description': 'Meet Melba Pattillo Beals PhD., member of the Little Rock Nine, and trailblazer for civil rights.',
'Quick Ideas for Using the Video': '',
'Video URL': 'https://vimeo.com/32351',
'Keywords': "African American History, African American Studies, America and Civil Rights"
}
founded_evideo example
{
'post_id': 12994,
'title': 'Trailblazer Melba Pattillo Beals',
'video_page_description': 'Meet Melba Pattillo Beals PhD., member of the Little Rock Nine, and trailblazer for civil rights.',
'content': '<p>Meet Melba Pattillo Beals PhD., member of the Little Rock Nine, and trailblazer for civil rights.</p>\n',
'quick_ideas': '',
'video_url': 'https://vimeo.com/3242',
'keywords': ''
}