top500albums/scripts/compare_2020_vs_wikipedia.py
Johan Lundberg 88a6434132 Finalize dropped albums list with correct 8 albums and balance new albums
- Corrected dropped albums to exactly 8 albums through detailed comparison analysis
- Updated dropped albums list (ranks 501-508) with proper albums that were truly removed
- Fixed "New in 2023" markings to show only 8 albums (balancing the 8 dropped)
- Downloaded cover art for all 8 dropped albums
- Removed incorrect cover art files for albums that weren't actually dropped
- Updated data files with corrected artist/album name formatting for accurate matching

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-01 03:32:16 +02:00

73 lines
No EOL
2.5 KiB
Python

#!/usr/bin/env python3
"""
Compare 2020 Rolling Stone list against full 2023 data to find truly dropped albums.
"""
import csv
def normalize_text(text):
"""Normalize text for comparison"""
return text.lower().strip().replace('&', 'and').replace(' ', ' ')
def main():
# Read 2020 albums (simplified)
albums_2020 = {}
with open('rolling_stone_2020_simple.csv', 'r', encoding='utf-8') as file:
reader = csv.DictReader(file)
for row in reader:
key = (normalize_text(row['Artist']), normalize_text(row['Album']))
albums_2020[key] = {
'rank': row['Rank'],
'artist': row['Artist'],
'album': row['Album']
}
print(f"📊 Loaded {len(albums_2020)} albums from 2020 list")
# Read Wikipedia 2023 albums
albums_2023_all = set()
with open('wikipedia_top_500_albums.csv', 'r', encoding='utf-8') as file:
reader = csv.DictReader(file)
for row in reader:
key = (normalize_text(row['artist']), normalize_text(row['album']))
albums_2023_all.add(key)
print(f"📊 Loaded {len(albums_2023_all)} albums from Wikipedia 2023 list")
# Find dropped albums (in 2020 but not in complete 2023 list)
dropped_albums = []
for key, album_info in albums_2020.items():
if key not in albums_2023_all:
dropped_albums.append(album_info)
# Sort by original 2020 rank
dropped_albums.sort(key=lambda x: int(x['rank']))
print(f"\n❌ Found {len(dropped_albums)} albums dropped from 2020 to 2023:")
print("=" * 80)
for album in dropped_albums:
print(f"#{album['rank']:3s} - {album['artist']} - {album['album']}")
print("=" * 80)
print(f"\n📊 Summary:")
print(f" - Albums in 2020: {len(albums_2020)}")
print(f" - Albums in complete 2023: {len(albums_2023_all)}")
print(f" - Albums dropped: {len(dropped_albums)}")
# Save dropped albums list
with open('final_dropped_albums.csv', 'w', newline='', encoding='utf-8') as file:
fieldnames = ['Original_Rank_2020', 'Artist', 'Album']
writer = csv.DictWriter(file, fieldnames=fieldnames)
writer.writeheader()
for album in dropped_albums:
writer.writerow({
'Original_Rank_2020': album['rank'],
'Artist': album['artist'],
'Album': album['album']
})
print(f"\n💾 Saved final dropped list to: final_dropped_albums.csv")
if __name__ == "__main__":
main()