{"id":22353990,"url":"https://github.com/ckyle30/pa2","last_synced_at":"2025-03-26T12:28:28.752Z","repository":{"id":275145544,"uuid":"850607478","full_name":"Ckyle30/PA2","owner":"Ckyle30","description":"De Guzman_Ckyle Ewxel Olrick_2ECEA_PA2","archived":false,"fork":false,"pushed_at":"2024-09-15T08:45:48.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-31T13:43:41.944Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Ckyle30.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-01T09:12:51.000Z","updated_at":"2024-09-15T08:45:51.000Z","dependencies_parsed_at":"2025-01-31T13:43:44.515Z","dependency_job_id":"d8aff9c5-ab5d-4179-b10d-c0e492db845b","html_url":"https://github.com/Ckyle30/PA2","commit_stats":null,"previous_names":["ckyle30/pa2"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ckyle30%2FPA2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ckyle30%2FPA2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ckyle30%2FPA2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ckyle30%2FPA2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ckyle30","download_url":"https://codeload.github.com/Ckyle30/PA2/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245652987,"owners_count":20650611,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-04T13:10:42.320Z","updated_at":"2025-03-26T12:28:28.730Z","avatar_url":"https://github.com/Ckyle30.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Python Data Preprocessing and Element-wise Operations\n## Description\nThis project includes solutions for two data preprocessing tasks using Python and NumPy. The tasks involve:\n1. Normalizing a random 5x5 NumPy ndarray.\n2. Performing element-wise operations on a 10x10 ndarray of squared integers to find numbers divisible by 3.\n\n## Tasks\n\n### 1. **Normalization Problem:**\n   Normalization is a key preprocessing technique in data analytics, used to center and scale data for various applications. In this project, normalization is performed by subtracting the mean of the data from each element and dividing by the standard deviation. The formula is given as:\n\n  ![image](https://github.com/user-attachments/assets/f49bc35d-4e95-4294-9cd2-700f83802127)\n\n\n   - A random 5x5 NumPy ndarray is created.\n   - The ndarray is normalized using the mean and standard deviation of its elements.\n   - The normalized array is saved as `X_normalized.npy`.\n*Input:*\n\n```python\n\n# Import necessary library\nimport numpy as np\n\n#  Create a random 5x5 ndarray and store it in variable X\nX = np.random.rand(5, 5)  # Creates a 5x5 array with random values between 0 and 1\n\n# Step 2: Calculate the mean and standard deviation of the array\nmean = X.mean()\nstd_dev = X.std()\n\n# Step 3: Normalize X using the Z-score formula\nX_normalized = (X - mean) / std_dev\n\n# Step 4: Save the normalized array as X_normalized.npy\nnp.save('X_normalized.npy', X_normalized)\n\n# Display the original and normalized arrays\nprint(\"Original Array:\\n\", X)\nprint(\"\\nNormalized Array:\\n\", X_normalized)\n```\n*Output:*\n\n![image](https://github.com/user-attachments/assets/332e081c-9dfe-4016-9e23-631ddbca1f59)\n\n*to verify the saved array*\n```phython\nnp.save('X_normalized.npy', X_normalized)\n```\n*Output:*\n![image](https://github.com/user-attachments/assets/030f5fb6-a821-4111-8450-3724510d9d02)\n\n### 2. **Divisible by 3 Problem:**\n   A 10x10 NumPy ndarray is created where each element represents the square of the first 100 positive integers. The goal is to:\n   - Identify all elements that are divisible by 3.\n   - Save the resulting elements into a file named `div_by_3.npy`.\n\n *Input:*\n```phython\n# Import necessary library\nimport numpy as np\n# Step 1: Create an array of the first 100 positive integers and square them\nnumbers = np.arange(1, 101)  # Array of integers from 1 to 100\nsquares = numbers ** 2       # Square each element\n# Step 2: Reshape the array into a 10x10 ndarray\nA = squares.reshape(10, 10)\n# Step 3: Find all elements in the array that are divisible by 3\ndivisible_by_3 = A[A % 3 == 0]\n# Step 4: Save the result as div_by_3.npy\nnp.save('div_by_3.npy', divisible_by_3)\n# Display the original array and elements divisible by 3\nprint(\"10x10 Array of Squares:\\n\", A)\nprint(\"\\nElements Divisible by 3:\\n\", divisible_by_3)\n```\n*Output:*\n![image](https://github.com/user-attachments/assets/bff9fb1f-fd65-4294-afa0-c6879c13ee21)\n\n\n*to verify the saved array*\n```phython\nnp.save('div_by_3.npy', divisible_by_3)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fckyle30%2Fpa2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fckyle30%2Fpa2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fckyle30%2Fpa2/lists"}