Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Sichere ProgrammierungWhy Claude Code keeps writing shell commands that fail on your Mac(20.09.2026 um 21:06 Uhr)
Sichere Programmierungllms.txt v2: What the Spec Says, and What 137,000 Domains Show(20.09.2026 um 21:17 Uhr)
Sicherheitslücken (CVE)NiceTryGPT: Less pattern matching. More actual hacking.(20.09.2026 um 21:19 Uhr)
IT Security VideoActivities BoF (kde2026)(20.09.2026 um 00:00 Uhr)
IT Security Toolsirdoc-app(20.09.2026 um 20:33 Uhr)
Sichere ProgrammierungWhy Claude Code keeps writing shell commands that fail on your Mac(20.09.2026 um 21:06 Uhr)
Sichere Programmierungllms.txt v2: What the Spec Says, and What 137,000 Domains Show(20.09.2026 um 21:17 Uhr)
Sicherheitslücken (CVE)NiceTryGPT: Less pattern matching. More actual hacking.(20.09.2026 um 21:19 Uhr)
IT Security VideoActivities BoF (kde2026)(20.09.2026 um 00:00 Uhr)
IT Security Toolsirdoc-app(20.09.2026 um 20:33 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

NumPy Arrays for Beginners: A Better Alternative to Python Lists

Reagiere als Erste:r — dein Feedback zählt!

NumPy is a highly popular Python package. One of its best features is the NumPy array (officially known as ndarray). You can think of it as a cleaner, much faster version of a standard Python list.

Although NumPy arrays resemble Python lists, they offer a significant advantage: you can perform mathematical operations on the entire array at once. These operations are simple to write and execute very efficiently.

Example
Suppose you have two lists:

heights = [2.40, 3.21, 1.34, 3.45]
weights = [45.0, 68.3, 34.1, 82.0]

Attempting to calculate the Body Mass Index (BMI) directly with lists produces an error:

bmi = weights / (heights ** 2)

*Error: *

TypeError: unsupported operand type(s) for ** or pow(): 'list' and 'int'

Python lists do not support element-wise mathematical operations. To achieve the same result with regular lists, you would need to loop through each element individually. This approach is slow and inefficient, especially with large data.

This is where NumPy comes in

NumPy allows us to perform these calculations efficiently by converting the lists into NumPy arrays:

import numpy as np

np_height = np.array(heights)
np_weight = np.array(weights)

bmi = np_weight / np_height ** 2
bmi

This code runs successfully and returns a new array containing the BMI values for each corresponding pair:

array([ 7.8125    ,  6.62842946, 18.99086656,  6.88930897])

Important Note:
Unlike Python lists, NumPy arrays can only contain elements of the same data type. If you try to create an array with mixed types, NumPy will automatically convert all elements to a single common type.

Example:

np.array([1.0, 'is', True])

Output:

array(['1.0', 'is', 'True'], dtype='<U32')

In summary, NumPy lets you apply math to entire arrays at once, making your calculations fast and efficient.

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten NumPy Arrays for Beginners: A Better Alternative to Python Lists

Thematisch verwandte Begriffe: NumPy, Arrays, Beginners, Better · 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 ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-93956 | A flaw has been found in olivier-ls PHP-FTS up to 1.1.2. Affected by thi…
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