CoolFace
Apppublic

Nagendra18/NumPY

sourceHugging Faceupdated 2y agoView on Hugging Face
1likes
app.py98 linesDownload Raw Back to root
1import streamlit as st2import numpy as np3import matplotlib.pyplot as plt4 5 6st.title(":blue[Welcome to the NumPy ]")7st.markdown("""8<style>9@keyframes pulse {10  0% { background-color: #ff0000; }11  50% { background-color: #ffff00; }12  100% { background-color: #ff0000; }13}14hr.pulse {15  border: none;16  height: 5px;17  background-color: #ff0000;18  animation: pulse 2s infinite;19}20</style>21<hr class="pulse">22""", unsafe_allow_html=True)23 24 25 26st.subheader("What is NumPy?")27st.write(28    "NumPy, short for Numerical Python, is a fundamental package for scientific computing in Python. "29    "It provides support for large multi-dimensional arrays and matrices, along with a collection "30    "of mathematical functions to operate on these arrays."31)32 33st.write(34    "With NumPy, you can perform operations on arrays efficiently, enabling fast mathematical "35    "computations and data manipulations. It is a powerful tool for data analysis, machine learning, "36    "and scientific research."37)38 39 40st.subheader("Key Features of NumPy")41st.write("- **N-dimensional Arrays**: Efficiently handles large datasets with N-dimensional arrays.")42st.write("- **Mathematical Functions**: Provides numerous mathematical functions for operations.")43st.write("- **Linear Algebra**: Supports linear algebra operations, Fourier transforms, and random number generation.")44st.write("- **Interoperability**: Works seamlessly with other libraries like Pandas, Matplotlib, and SciPy.")45 46 47st.subheader("NumPy Array Visualization")48 49 50array_size = st.slider("Select array size:", 1, 100, 50)  51data = np.random.randn(array_size) 52 53fig, ax = plt.subplots()54ax.hist(data, bins=20, color='skyblue', edgecolor='black')55ax.set_title('Histogram of Randomly Generated Data')56ax.set_xlabel('Value')57ax.set_ylabel('Frequency')58 59 60st.pyplot(fig)61 62 63st.subheader("Creating and Manipulating Arrays")64 65 66st.write("### Create a NumPy array:")67array_example = np.array([1, 2, 3, 4, 5])68st.write(array_example)69 70 71reshaped_array = array_example.reshape((1, 5))  # Reshape to 1 row and 5 columns72st.write("### Reshaped array to 1x5:")73st.write(reshaped_array)74 75reshaped_array_2 = array_example.reshape((5, 1))  # Reshape to 5 rows and 1 column76st.write("### Reshaped array to 5x1:")77st.write(reshaped_array_2)78 79st.write("### Perform mathematical operations:")80st.write("Add 5 to each element:")81st.write(array_example + 5)82 83 84st.subheader("Learn More about NumPy")85st.write(86    "To explore more functionalities and features of NumPy, visit the official documentation at: "87    "[NumPy Documentation](https://numpy.org/doc/stable/)"88)89 90st.write("Happy coding with NumPy!")91 92 93 94 95 96 97 98