#!/usr/bin/env python3 """ Add the remaining dropped albums to complete the list of 89 total dropped albums. We already have 7, so we need to add 82 more. """ import csv # Albums already in our dropped list (501-507) already_added = { ("The Rolling Stones", "Exile on Main Street"), ("David Bowie", "The Rise and Fall of Ziggy Stardust and the Spiders From Mars"), ("Prince", "Sign O' the Times"), ("Eric B. and Rakim", "Paid in Full"), ("Metallica", "Metallica (Black Album)"), ("Weezer", "Weezer (Blue Album)"), ("Sonic Youth", "Goo") } def main(): # Read the complete dropped albums list all_dropped = [] with open('truly_dropped_albums.csv', 'r', encoding='utf-8') as file: reader = csv.DictReader(file) for row in reader: all_dropped.append({ 'rank_2020': row['Original_Rank_2020'], 'artist': row['Artist'], 'album': row['Album'] }) print(f"šŸ“Š Total dropped albums from 2020→2023: {len(all_dropped)}") # Filter out the ones we've already added to_add = [] for album in all_dropped: key = (album['artist'], album['album']) # Check variations if key not in already_added: # Also check without parentheses for Black Album alt_album = album['album'].replace(' (The Black Album)', '').replace(' (Blue Album)', '') alt_key = (album['artist'], alt_album) if alt_key not in already_added: to_add.append(album) print(f"šŸ“Š Already added as dropped: {len(already_added)}") print(f"šŸ“Š Need to add: {len(to_add)}") # Read current CSV albums = [] with open('top_500_albums_2023.csv', 'r', encoding='utf-8') as file: reader = csv.DictReader(file) for row in reader: albums.append(row) current_max_rank = max(int(album['Rank']) for album in albums) next_rank = current_max_rank + 1 # Get info/descriptions from 2020 data info_desc_2020 = {} with open('rolling_stone_top_500_albums_2020.csv', 'r', encoding='utf-8') as file: reader = csv.DictReader(file) for row in reader: key = (row['Artist'], row['Album']) info_desc_2020[key] = { 'info': row.get('Info', ''), 'description': row.get('Description', '') } # Add remaining dropped albums added_count = 0 for album in to_add: key = (album['artist'], album['album']) info_data = info_desc_2020.get(key, {'info': '', 'description': ''}) albums.append({ 'Rank': str(next_rank), 'Artist': album['artist'], 'Album': album['album'], 'Status': f"Dropped (was #{album['rank_2020']} in 2020)", 'Info': info_data['info'], 'Description': info_data['description'] }) next_rank += 1 added_count += 1 if added_count <= 10: print(f"āœ“ Added: #{album['rank_2020']} - {album['artist']} - {album['album']}") if added_count > 10: print(f"... and {added_count - 10} more") # Write updated CSV with open('top_500_albums_2023.csv', 'w', newline='', encoding='utf-8') as file: fieldnames = ['Rank', 'Artist', 'Album', 'Status', 'Info', 'Description'] writer = csv.DictWriter(file, fieldnames=fieldnames) writer.writeheader() writer.writerows(albums) print(f"\nāœ… Added {added_count} dropped albums") print(f"šŸ“Š Total albums now: {len(albums)}") print(f"šŸ“Š Total dropped albums: {len([a for a in albums if 'Dropped' in a['Status']])}") if __name__ == "__main__": main()