This Python script generates a frequency table showing the number of YouTube videos by publication year. It reads a classified YouTube video dataset, summarizes the distribution of publication years, displays the results, and saves the frequency table for further analysis.
The script uses pandas for reading and summarizing the CSV dataset and os for managing output file paths.
The input and output locations are defined at the beginning of the program. The input file contains classified YouTube video records, and the output folder is used to store the generated frequency table.
The program reads the classified YouTube video CSV file into a pandas DataFrame. It also displays the column names to help verify the structure of the dataset before analysis.
The script creates a frequency table using the PublicationYear variable. It:
The generated frequency table is displayed in the console and saved as:
This script provides a simple quality-control and exploratory analysis step. The publication-year frequency table helps researchers examine the temporal distribution of collected YouTube videos before conducting additional analysis.
This script demonstrates a basic Python data-processing workflow: importing a CSV dataset, summarizing categorical information, creating a frequency table, and exporting the results for later use.