This project explores the concept of broadcasting in NumPy, which allows for performing operations on arrays with different shapes. It also demonstrates how to perform data standardization using broadcasting and conduct hypothesis testing using the Chi-squared test.
The project is structured as follows:
numpy_basics.py: Python script containing code for the NumPy tasks.requirements.txt: File specifying the required packages and their versions.
To run the project, follow these steps:
- Clone the repository:
git clone https://github.com/priyankaChandramohan/NumPy-Broadcasting-Project - Navigate to the project directory:
cd NumPy-Broadcasting-Project - Install the required packages using pip:
pip install -r requirements.txt - Run the
numpy.pyscript:python numpy.py
- Basic Broadcasting:
- Perform binary operations on an array and a scalar.
- Create a vector using the
arangefunction and perform element-wise addition with a scalar.
- Broadcasting with Matrices:
- Create a 10x10 matrix using broadcasting techniques.
- Data Standardization:
- Generate a fake dataset with 50 examples and 5 dimensions.
- Compute the mean and standard deviation of each column.
- Hypothesis Testing with Chi-squared Test:
- Analyze a survey response table using the Chi-squared test to determine if there is a relationship between age groups and movie genre inclination.
The project requires the following packages:
- NumPy (version 1.20.0 or higher)
- SciPy (version 1.6.0 or higher)
You can install the required packages using the pip install -r requirements.txt command.