From a8fad9a222c12bd973679e4d3dc642c6d70e1162 Mon Sep 17 00:00:00 2001 From: David Rotermund <54365609+davrot@users.noreply.github.com> Date: Sat, 16 Dec 2023 17:27:11 +0100 Subject: [PATCH] Update README.md Signed-off-by: David Rotermund <54365609+davrot@users.noreply.github.com> --- pandas/basics/README.md | 75 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/pandas/basics/README.md b/pandas/basics/README.md index a516b0d..2428476 100644 --- a/pandas/basics/README.md +++ b/pandas/basics/README.md @@ -45,3 +45,78 @@ class pandas.Series(data=None, index=None, dtype=None, name=None, copy=None, fas > > Operations between Series (+, -, /, *, **) align values based on their associated index values– they need not be the same length. The result index will be the sorted union of the two indexes. +Examples: + +```python +import pandas as pd + +example = pd.Series(["Bambu", "Tree", "Sleep"]) +print(example) +``` + +Output: + +```python +0 Bambu +1 Tree +2 Sleep +dtype: object +``` + + +```python +import numpy as np +import pandas as pd + +example = pd.Series([99, 88, 32]) +print(example) +``` + +Output: + +```python +0 99 +1 88 +2 32 +dtype: int64 +``` + + +```python +import numpy as np +import pandas as pd + +rng = np.random.default_rng() +a = rng.random((5)) + +example = pd.Series(a) +print(example) +``` + +Output: + +```python +0 0.305920 +1 0.633360 +2 0.219094 +3 0.005722 +4 0.006673 +dtype: float64 +``` + +```python +import pandas as pd + +example = pd.Series(["Bambu", 3, "Sleep"]) +print(example) +``` + +Output: + +```python +0 Bambu +1 3 +2 Sleep +dtype: object +``` +