🚀 Day 42 of My Python Full Stack Journey 💡 Topic: NumPy Methods — The Powerhouse of Data Handling in Python! Today, I explored one of the most powerful libraries in Python — NumPy (Numerical Python). It’s the backbone of data science, AI, and scientific computing. Here’s what I learned and practiced 👇 🧩 1️⃣ Array Creation Methods np.array() → Creates arrays from Python lists np.zeros() → Creates arrays filled with zeros np.ones() → Creates arrays filled with ones np.arange() → Creates ranges of evenly spaced values np.linspace() → Generates evenly spaced numbers between a range np.full() → Fills an array with a constant value np.eye() → Creates an identity matrix np.random.rand() → Generates random floats between 0 and 1 np.random.randint() → Generates random integers np.empty() → Creates an uninitialized array (faster but filled with random memory values) 🧮 2️⃣ Array Attributes Every NumPy array comes with helpful attributes: .shape → Rows & columns .ndim → Number of dimensions .size → Total number of elements .dtype → Data type of elements 🔁 3️⃣ Reshaping & Flattening Transforming arrays is easy with NumPy: reshape() → Change array shape flatten() → Convert multi-dimensional to 1D ravel() → Similar to flatten, returns a view resize() → Change size (can repeat/truncate data) ➕ 4️⃣ Array Math Operations NumPy supports element-wise and matrix operations: np.add(), np.subtract(), np.multiply(), np.divide() np.dot() → Dot product np.power() → Exponentiation np.mod() → Modulus operation ⚙️ Code Example import numpy as np a = np.array([1, 2, 3]) b = np.array([4, 5, 6]) print(np.add(a, b)) print(np.reshape(np.arange(1, 7), (2, 3))) print(np.eye(3)) 💬 Key Takeaway NumPy makes data handling in Python blazing fast, memory-efficient, and easy to manipulate. It’s the foundation of Pandas, TensorFlow, and Scikit-learn — mastering it is essential for every developer! #Python #NumPy #PythonFullStack #10000Coders #LearningJourney #DataScience #MachineLearning #CodingCommunity #PythonDeveloper 10000 Coders Harish M Bhagavathula Srividya Spandana Chowdary
More Relevant Posts
-
I just released Kiru: a text chunking lib, 1000x faster than LangChain splitters: build in Rust for Python If you're building RAG systems, you know the basic drill: load documents, split them into chunks, feed them to your vector database. Simple enough, except most chunking libraries are painfully slow when you're processing millions of documents. kiru solves this bringing Rust native performance to Python via PyO3 bindings. 𝗧𝗵𝗲 𝗻𝘂𝗺𝗯𝗲𝗿𝘀 - 4000+ MB/s for byte chunking (Pure Rust) - 1,400+ MB/s for byte chunking (Python bindings) - 300+ MB/s for character-aware chunking - Constant memory usage, even on gigabyte files - Works with files, URLs, and glob patterns out of the box 𝗪𝗵𝘆 𝗶𝘁'𝘀 𝗳𝗮𝘀𝘁 𝗮𝗻𝗱 𝗺𝗲𝗺𝗼𝗿𝘆 𝗲𝗳𝗳𝗶𝗰𝗶𝗲𝗻𝘁 Most chunkers load entire files into memory, then split them. Kiru streams data in blocks, chunks on-the-fly, and never breaks UTF-8 boundaries. The Rust implementation hits 4,000+ MB/s (for in memory string and byte chunking), and even the Python bindings crush slower pure Python implementation. 𝗕𝘆𝘁𝗲 𝘃𝘀 𝗖𝗵𝗮𝗿𝗮𝗰𝘁𝗲𝗿 𝗰𝗵𝘂𝗻𝗸𝗶𝗻𝗴 Byte chunking splits on byte boundaries (faster, perfect for token-limited models). So for a chunk of 500 bytes we just lookup the 500th byte in the sequence, if it's not a valid character boundary we take the closest one. Character chunking splits on exact characters count. It's slower because you need to compute all the character boundaries (characters can be multi-bytes). Both respect UTF-8 boundaries, so you never get corrupted text. 𝗪𝗵𝘆 𝗶𝘁 𝗺𝗮𝘁𝘁𝗲𝗿𝘀 When you're ingesting your entire knowledge base or processing documents in real-time, speed isn't just nice, it's the difference between a system that scales and one that doesn't. 𝗪𝗵𝗮𝘁'𝘀 𝗻𝗲𝘅𝘁 This is just the first release. Coming soon: 👉🏽 Delimiter-based splitting (newlines, sentences, paragraphs) 👉🏽 Recursive splitting with multiple delimiters 👉🏽 Markdown-native chunking (preserve structure) 👉🏽 Sitemap support (chunk entire websites from a single URL) 👉🏽 Code-aware splitting powered by tree-sitter Available now on PyPI and Rust Crates. Fully opensource. Links below 👇🏽 #python #rust #rag #opensource #ai #llm
To view or add a comment, sign in
-
Rust-level speed to Python text chunking Most chunkers choke when dealing with millions of documents. This one doesn’t. • Streams data instead of loading entire files into memory • Works directly with bytes, keeping UTF-8 intact • Handles gigabyte-scale files without breaking a sweat If you’re building RAG systems, this is the kind of efficiency that actually matters. It’s already on GitHub → github.com/bitswired/kiru
I just released Kiru: a text chunking lib, 1000x faster than LangChain splitters: build in Rust for Python If you're building RAG systems, you know the basic drill: load documents, split them into chunks, feed them to your vector database. Simple enough, except most chunking libraries are painfully slow when you're processing millions of documents. kiru solves this bringing Rust native performance to Python via PyO3 bindings. 𝗧𝗵𝗲 𝗻𝘂𝗺𝗯𝗲𝗿𝘀 - 4000+ MB/s for byte chunking (Pure Rust) - 1,400+ MB/s for byte chunking (Python bindings) - 300+ MB/s for character-aware chunking - Constant memory usage, even on gigabyte files - Works with files, URLs, and glob patterns out of the box 𝗪𝗵𝘆 𝗶𝘁'𝘀 𝗳𝗮𝘀𝘁 𝗮𝗻𝗱 𝗺𝗲𝗺𝗼𝗿𝘆 𝗲𝗳𝗳𝗶𝗰𝗶𝗲𝗻𝘁 Most chunkers load entire files into memory, then split them. Kiru streams data in blocks, chunks on-the-fly, and never breaks UTF-8 boundaries. The Rust implementation hits 4,000+ MB/s (for in memory string and byte chunking), and even the Python bindings crush slower pure Python implementation. 𝗕𝘆𝘁𝗲 𝘃𝘀 𝗖𝗵𝗮𝗿𝗮𝗰𝘁𝗲𝗿 𝗰𝗵𝘂𝗻𝗸𝗶𝗻𝗴 Byte chunking splits on byte boundaries (faster, perfect for token-limited models). So for a chunk of 500 bytes we just lookup the 500th byte in the sequence, if it's not a valid character boundary we take the closest one. Character chunking splits on exact characters count. It's slower because you need to compute all the character boundaries (characters can be multi-bytes). Both respect UTF-8 boundaries, so you never get corrupted text. 𝗪𝗵𝘆 𝗶𝘁 𝗺𝗮𝘁𝘁𝗲𝗿𝘀 When you're ingesting your entire knowledge base or processing documents in real-time, speed isn't just nice, it's the difference between a system that scales and one that doesn't. 𝗪𝗵𝗮𝘁'𝘀 𝗻𝗲𝘅𝘁 This is just the first release. Coming soon: 👉🏽 Delimiter-based splitting (newlines, sentences, paragraphs) 👉🏽 Recursive splitting with multiple delimiters 👉🏽 Markdown-native chunking (preserve structure) 👉🏽 Sitemap support (chunk entire websites from a single URL) 👉🏽 Code-aware splitting powered by tree-sitter Available now on PyPI and Rust Crates. Fully opensource. Links below 👇🏽 #python #rust #rag #opensource #ai #llm
To view or add a comment, sign in
-
🧮 Dissecting NumPy: Working With Intrinsic NumPy Objects For Array Creation 💪 It feels really exciting getting into the core of NumPy and seeing it unlocking its true strength infront of me! 🤔 Why NumPy Arrays Are Better Than Python Lists? - Fast Computation Of Large Datasets - Dont Require Loops - Easy Arithmetical Operations - Consume Less Memory ⚙️Today i digged a bit deeper into NumPy Array Creation With Intrinsic Objects like: - np.ones/np.zeros: gives arrays of 1s and 0s - np.arange(): gives a sequence of array unlike python range() that gives integers - np.linspace(): gives equally linear numbers in array between a start and stop value - np.reshape(): it can simply reshape a given array without changing its data, means generates a new array with a different number of rows and columns (as specified) But, listen up! ‼️One critical thing about NumPy Arrays is their Axis0(rows) and Axis1(coulums). ‼️It means we can perform some of the arithmetical ops on row elements and colum elements using their axis 💭 Its been a productive week by far getting into the world of NumPy and unlocking a new skill on the way of becoming a data scientist! 🫡 Until we meet again, my fellow coders! ------------------------- ☺️ Here are Python (Beginner to Intermediate) GitHub Repos for you: 📁Python Variables: https://lnkd.in/e9rjz-_D 📁Python Operators: https://lnkd.in/e6hzgHSn 📁Python Conditionals: https://lnkd.in/egQNGZBF 📁Python Loops: https://lnkd.in/eezUg_-y 📁Python Functions: https://lnkd.in/eKdU6nex 📁Python Lists & Tuples: https://lnkd.in/eZ8KiQNs 📁Python Dictionaries & Sets: https://lnkd.in/eDmgj7pc 📁Python OOP: https://lnkd.in/eJFupCiK 📁Python DSAs: https://lnkd.in/ebR3rjkt ------------------------- 🤓 NumPy (Beginner To Intermediate): 🧮Arrays: https://lnkd.in/ebghYRYE ------------------------- ⚡ Follow my learning journey: 📎 GitHub: https://lnkd.in/ehu8wX85 🔗 GitLab: https://lnkd.in/eiiQP2gw 💬 Feedback: I’d love your thoughts and tips! 🤝 Collab: If you’re also exploring Python, DM me! Let’s grow together! -------------------------- 📞Book A Call With Me: https://lnkd.in/e23BtnR9 -------------------------- #pythonnumpy #NumPy #pythonlibraries #pythonfordatascience #datascience #machinelearning #artificialintelligence
To view or add a comment, sign in
-
Dictionaries in Python: The Pantry Labels of Your Code 🏷️ Your pantry has so many items — but how do you find things easily? You don’t just dump everything in boxes — you label them! “Sugar → 1kg” “Milk → 2 packets” “Coffee → 500g” That’s what Dictionaries in Python do - they store data as key–value pairs, just like labeled jars in your kitchen! 💡 What is a Dictionary? A dictionary helps you store and access data using names (keys) instead of positions. Think of it like this: Instead of saying “Give me the 3rd item”, you can say “Give me the sugar!” 📘 Example: pantry = { "Sugar": "1kg", "Milk": "2 packets", "Coffee": "500g" } Now, if you want to check what’s in your pantry: print(pantry) Output: {'Sugar': '1kg', 'Milk': '2 packets', 'Coffee': '500g'} 💬 Accessing Items You can get values by using their key names: print(pantry["Sugar"]) Output: 1kg Easy, right? No need to remember the position - just ask for the label! 🧠 Updating or Adding Items Refill something or add new stock: pantry["Sugar"] = "2kg" # update existing pantry["Tea"] = "1 box" # add new print(pantry) Output: {'Sugar': '2kg', 'Milk': '2 packets', 'Coffee': '500g', 'Tea': '1 box'} 💥 Removing Items You can remove an item once it’s finished: del pantry["Coffee"] print(pantry) Output: {'Sugar': '2kg', 'Milk': '2 packets', 'Tea': '1 box'} 💡 Why Dictionaries Are Powerful ✅ Easy to find data using names ✅ Data stays organized and readable ✅ Perfect for real-world applications - like storing user info, product details, etc. 🧠 Today’s takeaway: “Dictionaries are like labeled jars — they help you find exactly what you need without confusion!” 💬 Try this today: Create a dictionary with your favorite fruits and their colors 🍎 Then print each fruit with its color using: for fruit, color in fruits.items(): print(fruit, "is", color) #PythonWithKeshav #LearnPython #PythonBasics #CodingJourney #PythonDictionaries #ProgrammingForBeginners #PythonLearning #CodeSmart #STEMEducation #PythonForAll
To view or add a comment, sign in
-
✅ What is a Library in Python? A library in Python is a collection of pre-written code (functions, classes, modules) that you can reuse to perform specific tasks — instead of writing everything from scratch. Think of it as: ✅ A toolbox ✅ With ready-made tools ✅ That you use anytime in your program ✅ Why Libraries Are Important Python libraries help you: save time reduce errors build powerful apps quickly focus on logic instead of low-level code ✅ How to Import a Library ✔ Basic import import math ✔ Import with alias import numpy as np ✔ Import specific functions from math import sqrt ✅ Types of Python Libraries ✅ 1. Built-in Libraries These come with Python by default. Examples: math → mathematics datetime → dates & time json → work with JSON os → interact with operating system random → random numbers ✅ Example: import math print(math.sqrt(16)) ✅ 2. External / Third-party Libraries You install them using pip. pip install numpy Examples: 🔹 Data analysis: pandas numpy 🔹 Machine learning: scikit-learn xgboost 🔹 Deep learning: tensorflow pytorch 🔹 Web development: flask django 🔹 Automation: selenium ✅ Example: import pandas as pd df = pd.read_csv("data.csv") ✅ 3. Custom Libraries You write your own Python file and reuse it. Suppose you create: my_functions.py def add(a, b): return a + b Then import it: import my_functions print(my_functions.add(5, 3)) ✅ Popular Python Libraries and Their Use Cases Library Purpose NumPy -- Numerical computing Pandas -- Data analysis Matplotlib -- Charts & visualizations Scikit-learn -- Machine learning TensorFlow/PyTorch -- Deep learning OpenCV -- Image processing Requests -- API calls Flask/FastAPI -- Web APIs BeautifulSoup -- Web scraping NLTK/spaCy -- NLP tasks ✅ Example: Using Multiple Libraries Together import numpy as np import pandas as pd import matplotlib.pyplot as plt data = np.random.rand(10) df = pd.DataFrame(data, columns=["Values"]) plt.plot(df["Values"]) plt.show()
To view or add a comment, sign in
-
🚀 Day 35 of #100DaysOfPython – Working with Date, Time & Calendar 🕒📅 Today’s topic helps us retrieve and manipulate the current date, time, and calendar using Python’s built-in modules — time and calendar. 🕐 1️⃣ Retrieving the Current Time Python provides the time() and localtime() functions to get system time. import time lt = time.localtime(time.time()) print(lt) 🧩 Output example: time.struct_time(tm_year=2022, tm_mon=4, tm_mday=14, tm_hour=10, tm_min=30, ...) 🔹 Attributes of time.struct_time: tm_year → Current year tm_mon → Current month tm_mday → Day of month tm_hour → Hour tm_min → Minute tm_sec → Second tm_wday → Weekday tm_yday → Day of year tm_isdst → Daylight saving flag 🕓 2️⃣ Formatted Time with asctime() The asctime() method returns the current time as a formatted string. import time lt = time.asctime(time.localtime(time.time())) print(lt) ✅ Example Output: Thu Apr 14 10:33:59 2022 🧮 3️⃣ Converting String to Time – strptime() Used to parse strings into time structures. import time tr = time.strptime("26 jun 14", "%d %b %y") print(tr) 📖 Example Output: time.struct_time(tm_year=2014, tm_mon=6, tm_mday=26, ...) 🧭 4️⃣ Formatting Time – strftime() Converts time into a specific string format. import time t = (2014, 6, 26, 17, 3, 38, 1, 48, -1) t = time.mktime(t) print(time.strftime("%d %m %y %H:%M:%S", time.gmtime(t))) ✅ Output: 26 06 14 11:33:38 📆 5️⃣ Python Calendar Module The calendar module allows working with dates, months, and years. import calendar print(calendar.prcal(2023)) 🧠 Common Calendar Functions: Method Description prcal(year) Prints full calendar for a year firstweekday() Returns first weekday (default Monday = 0) isleap(year) Checks if year is leap monthcalendar(year, month) Returns matrix of weeks in month leapdays(y1, y2) Counts leap years between y1 and y2 prmonth(year, month) Prints specific month 🗓️ Example: import calendar print(calendar.isleap(2020)) # True print(calendar.monthcalendar(2022, 6)) calendar.prmonth(2022, 5) ✨ In Short: time → retrieves and formats time strptime / strftime → convert between strings & time calendar → helps print and analyze calendars 💬 Which one do you use most often — datetime, time, or calendar? #Python #100DaysOfCode #LearningPython #PythonProgramming #DateTime #Calendar
To view or add a comment, sign in
-
🚀 Just built my own Python data type using OOP & magic methods! We all know Python gives us built-in types like int, float, and list... But what if we could design our own — that behaves just like them? 🤯 That’s exactly what I did with PyMatrixEngine 🧠 I built a custom Matrix data type that supports operations such as: ➕ Addition (A + B) ➖ Subtraction (A - B) ✖️ Multiplication (A * B) 🔁 Transpose & Determinant All powered by Python’s magic methods (__add__, __mul__, __str__, and friends) 🪄 And here’s the cool part — If you input something that doesn’t form a valid matrix, this datatype automatically checks it and raises a clean, readable error. No more silent shape mismatches or confusing bugs ✅ You can simply drop the file in your project and start using it: from matrix import Matrix A = Matrix([[1,2],[3,4]]) B = Matrix([[5,6],[7,8]]) print(A + B) print(A * B) print(A.determinant()) It’s a fun deep-dive into Object-Oriented Programming (OOP) and Python’s hidden superpowers: magic methods ✨ 🧩 GitHub Repo → https://lnkd.in/gkrheMQS Would love to hear — what’s the coolest custom data type you’ve ever built in Python? #Python #OOP #MagicMethods #Coding #Matrix #Learning #PythonProjects #Developers #PythonTips
To view or add a comment, sign in
-
🧮 NumPy Logic Building: Practice Session 🙋♀️ Since I am started with NumPy, it is crucial to understand its concepts manually. Therefore, I have started NumPy practice sessions from today where i will be building logic and practically solving NumPy problems in each session. 👉 The best way to practice a new skill, is not directly making projects. You rather start with: 1️⃣ Quizzes 2️⃣ Exercises/Pactice Questions 3️⃣ Logic Building Exercises 4️⃣ Syntax Practice 🤔 What's Next? 👉 Once ur comfortable with the concepts, pick a dataset and apply NumPy that u have learnt on it 🤔 This is how u can not only recognize the patterns but also work with real-world data in form of NumPy projects (for instance, data cleaning/preprocessing, data analyzing, applying arithmetical ops on data, and much more) 🤔 Should u be ashamed of ERRORS? 👉 The answer is NO! Be as shameless as u can if u want to learn and unlock a new skill. Be consistent on making errors so that u can recognize the patterns on the way! ‼️I won't be showcasing practice sessions in my captions instead, i would be dropping them in the comments, so that anyone who wants to practice NumPy concepts can use my practice sessions easily 🫡 Until we meet again, my fellow coders! ------------------------- ☺️ Here are Python (Beginner to Intermediate) GitHub Repos for you: 📁Python Variables: https://lnkd.in/e9rjz-_D 📁Python Operators: https://lnkd.in/e6hzgHSn 📁Python Conditionals: https://lnkd.in/egQNGZBF 📁Python Loops: https://lnkd.in/eezUg_-y 📁Python Functions: https://lnkd.in/eKdU6nex 📁Python Lists & Tuples: https://lnkd.in/eZ8KiQNs 📁Python Dictionaries & Sets: https://lnkd.in/eDmgj7pc 📁Python OOP: https://lnkd.in/eJFupCiK 📁Python DSAs: https://lnkd.in/ebR3rjkt ------------------------- 📊 Data Science For Beginners 🤓 NumPy (Beginner To Intermediate): 🧮 1. Arrays: https://lnkd.in/ebghYRYE 💻 2. Coders Of Delhi Project: https://lnkd.in/eRYc9j63 ------------------------- ⚡ Follow my learning journey: 📎 GitHub: https://lnkd.in/ehu8wX85 🔗 GitLab: https://lnkd.in/eiiQP2gw 💬 Feedback: I’d love your thoughts and tips! 🤝 Collab: If you’re also exploring Python, DM me! Let’s grow together! -------------------------- 📞Book A Call With Me: https://lnkd.in/e23BtnR9 -------------------------- #numpy #python #pythonfordatascience #numpylogic #pythonforbeginners #numpyforbeginners #datascience #datacleaning #datanalyzing
To view or add a comment, sign in
-
Stop wasting hours cleaning data manually, automate it with Python! Did you know that most data analysts and scientists spend over 60% of their time cleaning messy data instead of analyzing it? Here’s the good news; you can automate almost all of it using Python, with just a few lines of code. In my latest blog post on CodeWithFimi.com, I show you exactly how to: 1. Automate cleaning tasks using Pandas and Dask 2. Handle huge datasets that don’t fit in memory 3. Build fully automated cleaning pipelines with Airflow and Great Expectations Whether you’re a beginner or a pro, this guide will help you save time, reduce errors, and work like a modern data engineer. Read the full guide: https://lnkd.in/dAvrc5Y9 #DataScience #Python #MachineLearning #DataEngineering #Automation #Pandas #Dask #DataAnalytics #CodeWithFimi #Innovation
To view or add a comment, sign in
-
As data volumes grow, efficiency in data processing becomes critical. Our latest blog explores whether Polars could be the next big step beyond Pandas for Python developers and data scientists. Read the full insight here: https://lnkd.in/g38X4uS9 #DataScience #Python #PolarsvsPandas #polarspythonlibrary #pandasinpython #DataMites
To view or add a comment, sign in
Explore related topics
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development
#CFBR