A Python tool for analyzing Cloudflare speed test results stored in CSV format. This modular analyzer extracts and processes download speed data for 10MB tests, converting from bits per second (bps) to megabits per second (Mbps) for easy interpretation.
- 📊 Analyze Cloudflare Speed Test CSV Files: Process speed test results from Cloudflare's speed testing tool
- 🎯 10MB Download Focus: Specifically extracts and analyzes 10MB (10,000,000 bytes) download test data
- 📈 Speed Conversion: Automatically converts from bps to Mbps for readable results
- 🔧 Modular Design: Reusable
SpeedAnalyzerclass for flexible usage - 📁 Batch Processing: Analyze single files or multiple files at once
- 🛡️ Error Handling: Graceful handling of missing files and invalid data
- 📋 Detailed Reports: Shows individual test speeds, averages, and custom statistics
- Clone or download this repository
- Ensure Python 3.6+ is installed on your system
- No external dependencies required - uses only Python standard library
git clone <repository-url>
cd SpeedTest_AnalyzerSpeedTest_Analyzer/
├── speed_analyzer.py # Main SpeedAnalyzer class
├── analyze_all_files.py # Batch processing script
├── example_usage.py # Usage examples
├── README.md # This file
└── test_speed_data/ # Directory for CSV files
├── test_speed_1.csv
├── test_speed_2.csv
└── ...
from speed_analyzer import SpeedAnalyzer
analyzer = SpeedAnalyzer()
results = analyzer.analyze_single_file("test_speed_data/test_speed_1.csv")
analyzer.display_results(results)Output:
==================================================
File: test_speed_1
==================================================
Number of 10MB download tests: 6
Download speeds (Mbps):
Test 1: 21.90 Mbps
Test 2: 19.38 Mbps
Test 3: 15.40 Mbps
Test 4: 11.63 Mbps
Test 5: 18.39 Mbps
Test 6: 19.01 Mbps
Average speed: 17.62 Mbps
from speed_analyzer import SpeedAnalyzer
analyzer = SpeedAnalyzer()
files_to_analyze = [
"test_speed_data/test_speed_1.csv",
"test_speed_data/test_speed_2.csv",
"test_speed_data/test_speed_3.csv"
]
analyzer.analyze_multiple_files(files_to_analyze)# Run the batch processing script
python analyze_all_files.pyfrom speed_analyzer import SpeedAnalyzer
analyzer = SpeedAnalyzer()
results = analyzer.analyze_single_file("test_speed_data/test_speed_1.csv")
if results:
speeds = results['speeds_mbps']
min_speed = min(speeds)
max_speed = max(speeds)
speed_range = max_speed - min_speed
print(f"Minimum speed: {min_speed:.2f} Mbps")
print(f"Maximum speed: {max_speed:.2f} Mbps")
print(f"Speed range: {speed_range:.2f} Mbps")The analyzer expects CSV files with the following structure from Cloudflare speed tests:
time,direction,bytes,latency,bps,duration,serverTime,responseSize,loadedLatencies
1752605755529,download,10000000,30.500023,21899266.259138077,3653.2000229284745,98.999977,10000300,69.09999402384186...
1752605759716,download,10000000,33.999954,19383713.539181642,4127.2999540715255,52.000046,10000300,26.000109000000002...Key Fields:
direction: Must be "download" for analysisbytes: Must be exactly 10,000,000 (10MB) for extractionbps: Download speed in bits per second (converted to Mbps)
The core module containing the SpeedAnalyzer class with methods:
read_csv_file(): Safely read CSV filesextract_download_speeds(): Filter 10MB download entriesbps_to_mbps(): Convert speed unitsanalyze_single_file(): Complete analysis of one fileanalyze_multiple_files(): Batch processingdisplay_results(): Formatted output
Batch processing script that:
- Finds all CSV files in the
test_speed_datadirectory - Analyzes each file using the
SpeedAnalyzerclass - Displays comprehensive results for all files
Demonstration script showing:
- Single file analysis
- Multiple file analysis
- Custom analysis with additional statistics
You can modify the target directory by changing the SPEED_TESTING_DIR constant in each script:
SPEED_TESTING_DIR = "test_speed_data" # Change this to your directory- Python 3.6+
- Standard Library Only:
csv,os,pathlib,glob,typing
The analyzer gracefully handles:
- Missing or non-existent files
- Invalid CSV data
- Files without 10MB download entries
- Corrupted or incomplete data rows
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is open source and available under the MIT License.
Here's what you can expect when analyzing different proxy providers' speed test results:
File: Webshare - Data Center Proxies
==================================================
Number of 10MB download tests: 6
Download speeds (Mbps):
Test 1: 45.87 Mbps
Test 2: 173.99 Mbps
Test 3: 167.33 Mbps
Test 4: 152.27 Mbps
Test 5: 134.71 Mbps
Test 6: 134.68 Mbps
Average speed: 134.81 Mbps
If you encounter any issues or have questions:
- Check the existing issues in the repository
- Create a new issue with detailed information about your problem
- Include sample CSV data (anonymized) if relevant
Happy analyzing! 🚀