2025-07-01 21:35:40 +02:00

44 lines
2.5 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## CAP-Theorem
-**Konsistenz (Consistency):** Alle Knoten zeigen zur gleichen Zeit die gleichen Daten an.
- **Verfügbarkeit (Availability):** Jeder Anfrage wird garantiert eine Antwort geliefert auch wenn sie nicht den aktuellsten Stand widerspiegelt.
- **Partitionstoleranz (Partition Tolerance):** Das System funktioniert weiter, auch wenn Teile des Netzwerks ausfallen oder nicht miteinander kommunizieren können.
- **CA (Konsistenz + Verfügbarkeit):**
    Funktioniert nur ohne Netzwerkausfall.
    Beispiel: Einzelner MySQL-Server.
- **CP (Konsistenz + Partitionstoleranz):**
    Bleibt bei Ausfall konsistent, aber nicht immer erreichbar.
    Beispiel: HBase, MongoDB (strikte Konsistenz).
- **AP (Verfügbarkeit + Partitionstoleranz):**
    Immer erreichbar, aber Daten können kurz inkonsistent sein.
    Beispiel: Cassandra, DynamoDB.
```python
# --- Pandas ----------
pd.read_csv("path.csv") -> DataFrame # CSV einlesen
pd.DataFrame(data) -> DataFrame # DataFrame aus dict/array
df.head(), df.tail() # Erste/letzte Zeilen
df.info(), df.describe() # Überblick & Statistik
df.loc[row, col], df.iloc[row_idx, col_idx] # Label- & Positionszugriff
df.groupby(keys).agg(func) # Gruppierung & Aggregation
pd.merge(left, right, on="col") # Tabellen verbinden
df.pivot_table(values, index, columns, aggfunc="mean") # Schnelles Pivottable
df.isna().sum(), df.fillna(value) # Fehlende Werte prüfen/behandeln
df.sort_values(by="col"), df.sort_index() # Sortieren
# --- NumPy ----------
np.array(data) # Array erstellen
np.arange(stop), np.linspace(start, stop, num) # Sequenzen
np.zeros(shape), np.ones(shape) # Nullen/Einsen-Arrays
np.reshape(a, newshape) # Form ändern
np.mean(a), np.median(a), np.std(a) # Statistiken
# --- Matplotlib ----------
import matplotlib.pyplot as plt
plt.figure(figsize=(6,4)) # Figure erstellen
plt.plot(x, y, label="Linie") # Liniendiagramm
plt.scatter(x, y, c="r", label="Punkte") # Streudiagramm
plt.bar(x, height, label="Balken") # Balkendiagramm
plt.hist(data, bins=30, alpha=0.7) # Histogramm
plt.axvline(x, color="k", ls="--") # Vertikale Linie
plt.xlabel("x-Achse"); plt.ylabel("y-Achse") # Achsenbeschriftung
plt.title("Titel"); plt.legend(); plt.tight_layout(); plt.show()
```