Skip to content
Snippets Groups Projects
Commit 690ff856 authored by Xia, Ning's avatar Xia, Ning :penguin:
Browse files

added numpy quick start

parent 815735ca
No related branches found
No related tags found
No related merge requests found
......@@ -19,9 +19,41 @@ In diesem GitLab Repo finden Sie:
- Requirements (`requirements.txt`): Beschreibt die pip-Umgebung, nicht relevant für die Ausarbeitung
- Matplotlib Style (`FST.mplstyle`): Einstellung für Matplotlib nach der FST-Institut-Vorschrift
### Numpy Quick Start Quide
`numpy.ndarray` ist eine sehr effiziente Datenstruktur im Python-Package `numpy`, die von Datenwissenschaftlern jeden Tag gebraucht wird. Einige Beispiele werden hier gezeigt.
Initializierung von `numpy.ndarray`:
```python
import numpy as np
a = np.array([[1, 2, 3, 4], [5, 6, 7, 8]])
```
Anders als `list` müssen die Elemente im `ndarray` von gleichen Typen (zum Beispiel `float64`) sein. Und das Array muss wie eine Matrix in der Mathematik aussehen. Das heißt, die Anzahl der Elemente bei jeder Spalte bzw. Zeile gleich ist.
`numpy.ndarray` erleichert die mathematische Berechnung:
```python
# Assuming that each element in "a" is the radius of a circle,
# the area of each circle can be calculated in this way.
area = np.pi * a ** 2
# Print the array.
print(area)
# Print a element in the array.
print(area[0, 3])
```
Es ist möglich, Statistik des Arrays durch Build-in Funktionen von `numpy` zu brechen.
```python
a_mean = a.mean()
print(a_mean)
# Calculate the average of each column.
a_mean_first_dimension = a.mean(0)
print(a_mean_first_dimension)
```
### Links
Mehr Infomationen über die Datenstruktur sind in der [README.md](https://git.rwth-aachen.de/fst-tuda/public/lehre/calorimetry_home/-/blob/main/README.md) des Küchentischversuches zu finden.
[NumPy: the absolute basics for beginners](https://numpy.org/doc/stable/user/absolute_beginners.html)
[h5py Quick Start Guide](https://docs.h5py.org/en/stable/quick.html)
[NumPy Fundamentals](https://numpy.org/doc/stable/user/basics.html)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment