# numpy-ex3 **Repository Path**: arsalabangash/numpy-ex3 ## Basic Information - **Project Name**: numpy-ex3 - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 80 - **Created**: 2025-03-19 - **Last Updated**: 2025-04-10 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Exercise: Repository Metrics Analysis with NumPy ## **English Instructions** ### **Objective** Analyze repository metrics (**Stars**, **Forks**, and **Active Days**) using NumPy arrays. ### **Tasks** 1. **Data Loading** - Read your assigned country file (`pakistan-repos.csv` or `china-repos.csv`) 2. **Data Preparation** - Create a 2D NumPy array containing: - `Stars` count (integer values) - `Forks` count (integer values) - `Active Days` (days between `created_at` and `last_commit`) 3. **Statistical Analysis** For each metric (Stars/Forks/Active Days), calculate: - Mean (1 decimal place) - Median (1 decimal place) - Variance (1 decimal place) - Standard deviation (1 decimal place) 4. **Output Formatting** Print results with **exact indentation**: ``` Stars: Average: 854.2 Median: 765.0 Variance: 12345.6 Standard Deviation: 111.1 Forks: Average: 234.5 Median: 210.0 Variance: 2345.6 Standard Deviation: 48.4 Active Days: Average: 349.0 Median: 456.0 Variance: 5678.9 Standard Deviation: 75.4 ``` ### **Requirements** - Use **only NumPy functions** (no Python loops) - Calculate dates using `np.datetime64` type - Round all values to **1 decimal place** - Maintain exact indentation with 4 spaces per level --- ## **Chinese Instructions (中文说明)** ### **目标** 使用NumPy分析仓库的星标数、分支数和活跃天数 ### **任务** 1. **数据加载** - 读取分配的国家数据文件 2. **数据准备** - 创建包含以下指标的二维数组: - 星标数(整数值) - 分支数(整数值) - 活跃天数(创建时间到最后提交的天数差) 3. **统计分析** 为每个指标计算: - 平均值(保留1位小数) - 中位数(保留1位小数) - 方差(保留1位小数) - 标准差(保留1位小数) 4. **结果输出** 按严格缩进格式打印结果 ### **要求** - 仅使用NumPy函数(禁止循环) - 使用`np.datetime64`处理日期计算 - 所有数值保留1位小数 - 保持严格的4空格缩进格式 --- **Key Learning Points** 1. 时间序列数据处理 2. 使用向量化操作进行统计计算 3. 数据精度控制与格式化输出 4. NumPy结构化数组操作 **Sample Data Structure** ```csv repo_name,owner,stars,forks,language,created_at,last_commit,description ai-framework,CodeMasters,1500,450,Python,2022-01-15,2024-03-20,"Advanced machine learning platform" cloud-engine,DataWizards,890,230,Go,2023-02-28,2024-03-18,"Distributed cloud computing system" ``` *Note: Active Days = last_commit date - created_at date*