Download example.py from vivianchen98/LearningPaper24: direct link, hf CLI and curl.
- Browser
- Download file 2.6 kB
-
https://huggingface.co/datasets/vivianchen98/LearningPaper24/resolve/main/example.py
- Command line
-
hf download hf://datasets/vivianchen98/LearningPaper24/example.py
-
curl -L -o example.py https://huggingface.co/datasets/vivianchen98/LearningPaper24/resolve/main/example.py
2.6 kB
| from datasets import load_dataset | |
| def display_dataset_statistics(dataset): | |
| """ | |
| Display overall statistics about the dataset. | |
| Args: | |
| dataset: A HuggingFace Dataset object. | |
| """ | |
| print("\n" + "=" * 50) | |
| print(f"{'DATASET STATISTICS':^50}") | |
| print("=" * 50) | |
| print(f"\n📊 Number of entries: {len(dataset):,}") | |
| # Convert to pandas for easier analysis | |
| df = dataset.to_pandas() | |
| # Count presentation types | |
| if "status" in df.columns: | |
| print("\n" + "-" * 30) | |
| print("📝 PRESENTATION TYPES") | |
| print("-" * 30) | |
| status_counts = df["status"].value_counts() | |
| for status, count in status_counts.items(): | |
| print(f" • {status}: {count:,} ({count / len(df) * 100:.1f}%)") | |
| # Count venues | |
| if "venue" in df.columns: | |
| print("\n" + "-" * 30) | |
| print("🏢 VENUES") | |
| print("-" * 30) | |
| venue_counts = df["venue"].value_counts() | |
| for venue, count in venue_counts.items(): | |
| print(f" • {venue}: {count:,} ({count / len(df) * 100:.1f}%)") | |
| # Count primary research areas | |
| if "primary_area" in df.columns: | |
| print("\n" + "-" * 30) | |
| print("🔬 TOP 10 PRIMARY RESEARCH AREAS") | |
| print("-" * 30) | |
| area_counts = df["primary_area"].value_counts().head(10) | |
| for area, count in area_counts.items(): | |
| print(f" • {area}: {count:,} ({count / len(df) * 100:.1f}%)") | |
| def display_sample_entries(dataset, n=3): | |
| """ | |
| Display sample entries from the dataset. | |
| Args: | |
| dataset: A HuggingFace Dataset object. | |
| n: Number of samples to display. | |
| """ | |
| print("\n" + "=" * 50) | |
| print(f"{'SAMPLE ENTRIES':^50}") | |
| print("=" * 50) | |
| for i in range(min(n, len(dataset))): | |
| print(f"\n📄 SAMPLE {i + 1}") | |
| print("-" * 30) | |
| print(f"🎬 Video file: video/{dataset[i].get('video_file', 'N/A')}") | |
| print(f"📝 Title: {dataset[i].get('title', 'N/A')}") | |
| print(f"💡 TL;DR: {dataset[i].get('tldr', 'N/A')}") | |
| print(f"🔬 Primary area: {dataset[i].get('primary_area', 'N/A')}") | |
| print(f"🏷️ Keywords: {dataset[i].get('keywords', 'N/A')}") | |
| print("=" * 50) | |
| if __name__ == "__main__": | |
| # Load the dataset | |
| dataset = load_dataset("vivianchen98/LearningPaper24", data_files="metadata/catalog.jsonl", split="train") | |
| print(f"Successfully loaded LearningPaper24 dataset with {len(dataset)} entries.") | |
| # Display statistics | |
| display_dataset_statistics(dataset) | |
| # Display sample entries | |
| display_sample_entries(dataset) | |