Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Web Security TippsIntroducing the new Confluence integration with Google Chat(22.09.2026 um 19:40 Uhr)
Web Security TippsQuick notes in Take notes for me(22.09.2026 um 21:31 Uhr)
Sichere ProgrammierungSecurity improvements for SSH(22.09.2026 um 16:11 Uhr)
Sichere ProgrammierungKI-Akzeptanz: Wie Rewe digital einfach nur den Chatbot umbenannte(22.09.2026 um 18:00 Uhr)
Sichere ProgrammierungClaude Opus 5.5: Keeping safety ahead of capabilities(22.09.2026 um 20:59 Uhr)
Sichere ProgrammierungYour Terraform Monolith Isn't Too Big. It's Tightly Coupled.(22.09.2026 um 21:00 Uhr)
Sichere ProgrammierungMy PR got merged into Mike — OSS Legal AI Platform 🎉(22.09.2026 um 21:34 Uhr)
Sichere ProgrammierungStop Writing JavaScript To Fix `100vh` On Mobile(22.09.2026 um 21:35 Uhr)
Sichere ProgrammierungNext.js proxy.ts Explained (with Cheat Sheet)(22.09.2026 um 21:36 Uhr)
Web Security TippsIntroducing the new Confluence integration with Google Chat(22.09.2026 um 19:40 Uhr)
Web Security TippsQuick notes in Take notes for me(22.09.2026 um 21:31 Uhr)
Sichere ProgrammierungSecurity improvements for SSH(22.09.2026 um 16:11 Uhr)
Sichere ProgrammierungKI-Akzeptanz: Wie Rewe digital einfach nur den Chatbot umbenannte(22.09.2026 um 18:00 Uhr)
Sichere ProgrammierungClaude Opus 5.5: Keeping safety ahead of capabilities(22.09.2026 um 20:59 Uhr)
Sichere ProgrammierungYour Terraform Monolith Isn't Too Big. It's Tightly Coupled.(22.09.2026 um 21:00 Uhr)
Sichere ProgrammierungMy PR got merged into Mike — OSS Legal AI Platform 🎉(22.09.2026 um 21:34 Uhr)
Sichere ProgrammierungStop Writing JavaScript To Fix `100vh` On Mobile(22.09.2026 um 21:35 Uhr)
Sichere ProgrammierungNext.js proxy.ts Explained (with Cheat Sheet)(22.09.2026 um 21:36 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

NumPy & Data Manipulation

By the end of this session you will learn: • What NumPy is • Why NumPy is faster than Python lists • Core NumPy operations • Data manipulation techniques • A real-world recommendation system example Introduction (3 Minutes) Python is w…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

By the end of this session you will learn:



• What NumPy is

• Why NumPy is faster than Python lists

• Core NumPy operations

• Data manipulation techniques

• A real-world recommendation system example




  1. Introduction (3 Minutes)



Python is widely used in data science, machine learning, and AI systems.



At the core of these systems lies a powerful library called NumPy.



NumPy stands for Numerical Python and provides:



High-performance arrays



Mathematical operations



Matrix computations



Fast vectorized operations



Many popular libraries are built on top of NumPy:



Pandas



Scikit-Learn



TensorFlow



PyTorch



Understanding NumPy helps us understand how modern AI systems process data efficiently.




  1. Why NumPy? (Python List vs NumPy Array)



Python lists are flexible but not optimized for large numerical computations.



NumPy arrays are implemented in C, making them significantly faster.



Example: Performance Comparison

import numpy as np

import time



size = 1000000



list1 = list(range(size))

list2 = list(range(size))



start = time.time()

result = [x + y for x, y in zip(list1, list2)]

print("Python list time:", time.time() - start)



arr1 = np.arange(size)

arr2 = np.arange(size)



start = time.time()

result = arr1 + arr2

print("NumPy array time:", time.time() - start)



Explanation:



NumPy performs operations on entire arrays at once, called vectorization.



This removes the need for loops.




  1. Creating NumPy Arrays (5 Minutes)



NumPy arrays are called ndarrays (N-dimensional arrays).



Basic Array Creation

import numpy as np



arr = np.array([1,2,3,4,5])

print(arr)

Creating Arrays of Zeros

zeros = np.zeros((3,3))

print(zeros)



Creates a 3×3 matrix of zeros.



Creating Arrays of Ones

ones = np.ones((2,4))

print(ones)



Creates a 2×4 matrix filled with ones.



Creating Ranges

numbers = np.arange(0,10,2)

print(numbers)



Output



[0 2 4 6 8]




  1. Array Shapes and Dimensions



NumPy arrays can be multi-dimensional.



Example:



matrix = np.array([

[1,2,3],

[4,5,6],

[7,8,9]

])



print(matrix.shape)



Output



(3,3)



Meaning:



3 rows

3 columns




  1. Vectorized Operations (5 Minutes)



NumPy allows mathematical operations without loops.



Example:



arr = np.array([10,20,30,40])



print(arr + 5)

print(arr * 2)

print(arr / 10)



Output



[15 25 35 45]

[20 40 60 80]

[1. 2. 3. 4.]



Explanation:



The operation is automatically applied to each element of the array.



This is called broadcasting.




  1. Indexing and Slicing
    1D Array
    data = np.array([10,20,30,40,50])



print(data[0])

print(data[1:4])



Output



10

[20 30 40]

2D Array

matrix = np.array([

[1,2,3],

[4,5,6],

[7,8,9]

])



print(matrix[1,2])



Output



6

Extract Column

print(matrix[:,1])



Output



[2 5 8]



Explanation



: means all rows




  1. Aggregation Functions



NumPy provides built-in functions for data analysis.



Example:



data = np.array([10,20,30,40])



print("Mean:", np.mean(data))

print("Sum:", np.sum(data))

print("Max:", np.max(data))

print("Min:", np.min(data))



Output



Mean: 25

Sum: 100

Max: 40

Min: 10




  1. Boolean Filtering (Very Useful for Data Cleaning)



Example dataset:



scores = np.array([55,78,90,34,88,67])



Find students who passed:



passed = scores[scores > 60]

print(passed)



Output



[78 90 88 67]



Explanation:



NumPy allows filtering data without loops.



This is heavily used in data preprocessing pipelines.




  1. Real World Example – Web Response Time Analysis



Suppose we are monitoring API response times.



response_times = np.array([120,115,130,200,500,110,118])

Average response time

print("Average:", np.mean(response_times))

Find slow responses

slow = response_times[response_times > 200]

print("Slow responses:", slow)



Output



[500]

Normalize Data



Normalization is commonly used in machine learning pipelines.



normalized = (response_times - np.mean(response_times)) / np.std(response_times)



print("Normalized values:")

print(normalized)




  1. Real-World Example – Netflix Recommendation System



Recommendation systems power platforms like Netflix.



Users and movies can be represented as vectors.



Movie List

movies = ["Interstellar", "Inception", "Titanic", "Avengers"]

User Ratings Matrix

ratings = np.array([

[5,4,1,1], # Alice

[4,5,1,1], # Bob

[1,1,5,4] # Charlie

])



print(ratings)



Rows represent users



Columns represent movies




  1. Cosine Similarity



Recommendation systems often compute similarity between users.



Formula



similarity = (A · B) / (|A| |B|)

Implementing Similarity

from numpy.linalg import norm



alice = ratings[0]

bob = ratings[1]

charlie = ratings[2]



sim_alice_bob = np.dot(alice,bob) / (norm(alice)*norm(bob))

sim_alice_charlie = np.dot(alice,charlie) / (norm(alice)*norm(charlie))



print("Alice vs Bob:", sim_alice_bob)

print("Alice vs Charlie:", sim_alice_charlie)



Expected output



Alice vs Bob: ~0.98

Alice vs Charlie: ~0.32



Explanation



Alice and Bob have similar movie taste.



Charlie has different preferences.




  1. Recommendation Logic



If Alice hasn't watched Avengers, we can recommend movies liked by similar users.



alice_ratings = np.array([5,4,1,0])

bob_ratings = ratings[1]



recommended_index = np.argmax(bob_ratings)



print("Recommended movie:", movies[recommended_index])




  1. Key Takeaways



NumPy provides:



Fast array computations

Vectorized mathematical operations

Powerful data manipulation tools



It is the foundation of the Python data ecosystem.



Libraries built on NumPy include:



Pandas



TensorFlow



PyTorch



Scikit-learn



Understanding NumPy is a critical step toward machine learning and AI development.



Optional 1-Minute Closing



In modern systems:



• AI models

• Recommendation systems

• Image processing

• Fraud detection



all rely heavily on matrix operations.



NumPy makes these computations simple and extremely efficient.

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten NumPy & Data Manipulation

Thematisch verwandte Begriffe: NumPy, Data, Manipulation · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-77259 | MCP Atlassian is a Model Context Protocol (MCP) server for Atlassian pro…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick