diff --git a/README.md b/README.md index aa6c04c..9c863de 100644 --- a/README.md +++ b/README.md @@ -662,12 +662,12 @@ import zoneinfo, dateutil.tz ### Arithmetics ```python = > # Ignores time jumps (fold attribute). Also ==. - = > # Ignores jumps if they share tz object. Broken ==. + = > # Ignores time jumps if they share tzinfo object. = - # Ignores jumps. Convert to UTC for actual delta. = - # Ignores jumps if they share tzinfo object. = ± # Returned datetime can fall into missing hour. - = * # Also: = abs() and = ±% . - = / # E.g. how many hours are in TD. Also //, divmod(). + = * # Also ` = abs()`, ` = ± `. + = / # Also `, = divmod(, )`. ``` @@ -3165,6 +3165,7 @@ Name: a, dtype: int64 ```python = pd.Series() # Uses list's indices for 'index'. = pd.Series() # Uses dictionary's keys for 'index'. + = pd.concat() # Also .combine_first(), .update(). ``` ```python @@ -3176,18 +3177,17 @@ Name: a, dtype: int64 ```python = [key/i] # Or: . = [coll_of_keys/coll_of_i] # Or: [key/i : key/i] - = [bools] # Or: .loc/iloc[bools] + = [] # Or: .loc/iloc[] ``` ```python - = > # Returns S of bools. Pairs items by keys. + = > # Returns S of bools. For logic use &, |, ~. = + # Items with non-matching keys get value NaN. ``` ```python - = pd.concat() # Concats multiple series into one long Series. - = .combine_first() # Adds items that are not yet present. -.update() # Updates items that are already present. + = .value_counts(normalize=False) # Returns S of unique values and their counts. + = .str.strip/lower/contains/replace() # Processes strings. For dates see File Formats. ``` ```python @@ -3199,7 +3199,7 @@ Name: a, dtype: int64 #### Series — Aggregate, Transform, Map: ```python - = .sum/max/mean/idxmax/all() # Or: .agg(lambda : ) + = .sum/max/mean/idxmax/all/count() # Or: .agg(lambda : ) = .rank/diff/cumsum/ffill/interpol…() # Or: .agg/transform(lambda : ) = .isna/fillna/isin([]) # Or: .agg/transform/map(lambda : ) ``` @@ -3314,7 +3314,7 @@ c 6 7 #### DataFrame — Aggregate, Transform, Map: ```python - = .sum/max/mean/idxmax/all() # Or: .apply/agg(lambda : ) + = .sum/max/mean/idxmax/all/count() # Or: .apply/agg(lambda : ) = .rank/diff/cumsum/ffill/interpo…() # Or: .apply/agg/transform(lambda : ) = .isna/fillna/isin([]) # Or: .applymap(lambda : ) ``` diff --git a/index.html b/index.html index b09b829..a02afbe 100644 --- a/index.html +++ b/index.html @@ -55,7 +55,7 @@
- +
@@ -579,12 +579,12 @@ Point(x=1, y=2
  • '%Z' accepts 'UTC/GMT' and local timezone's code and returns timezone's name, 'UTC[±HH:MM]' if timezone is nameless, or an empty string if datetime is naive.
  • Arithmetics

    <bool>   = <D/T/DTn> > <D/T/DTn>            # Ignores time jumps (fold attribute). Also ==.
    -<bool>   = <DTa>     > <DTa>                # Ignores jumps if they share tz object. Broken ==.
    +<bool>   = <DTa>     > <DTa>                # Ignores time jumps if they share tzinfo object.
     <TD>     = <D/DTn>   - <D/DTn>              # Ignores jumps. Convert to UTC for actual delta.
     <TD>     = <DTa>     - <DTa>                # Ignores jumps if they share tzinfo object.
     <D/DT>   = <D/DT>    ± <TD>                 # Returned datetime can fall into missing hour.
    -<TD>     = <TD>      * <float>              # Also: <TD> = abs(<TD>) and <TD> = <TD> ±% <TD>.
    -<float>  = <TD>      / <TD>                 # E.g. how many hours are in TD. Also //, divmod().
    +<TD>     = <TD>      * <float>              # Also `<TD> = abs(<TD>)`, `<TD> = <TD> ± <TD>`.
    +<float>  = <TD>      / <TD>                 # Also `<int>, <TD> = divmod(<TD>, <TD>)`.
     

    #Arguments

    Inside Function Call

    func(<positional_args>)                           # func(0, 0)
    @@ -2582,6 +2582,7 @@ Name: a, dtype: int64
     
     
    <S>  = pd.Series(<list>)                       # Uses list's indices for 'index'.
     <S>  = pd.Series(<dict>)                       # Uses dictionary's keys for 'index'.
    +<S>  = pd.concat(<coll_of_S>)                  # Also <S>.combine_first(<S>), <S>.update(<S>).
     
    <el> = <S>.loc[key]                            # Or: <S>.iloc[i]
     <S>  = <S>.loc[coll_of_keys]                   # Or: <S>.iloc[coll_of_i]
    @@ -2589,14 +2590,13 @@ Name: a, dtype: int64
     
    <el> = <S>[key/i]                              # Or: <S>.<key>
     <S>  = <S>[coll_of_keys/coll_of_i]             # Or: <S>[key/i : key/i]
    -<S>  = <S>[bools]                              # Or: <S>.loc/iloc[bools]
    +<S>  = <S>[<S_of_bools>]                       # Or: <S>.loc/iloc[<S_of_bools>]
     
    -
    <S>  = <S> > <el/S>                            # Returns S of bools. Pairs items by keys.
    +
    <S>  = <S> > <el/S>                            # Returns S of bools. For logic use &, |, ~.
     <S>  = <S> + <el/S>                            # Items with non-matching keys get value NaN.
     
    -
    <S> = pd.concat(<coll_of_S>)                   # Concats multiple series into one long Series.
    -<S> = <S>.combine_first(<S>)                   # Adds items that are not yet present.
    -<S>.update(<S>)                                # Updates items that are already present.
    +
    <S>  = <S>.value_counts(normalize=False)       # Returns S of unique values and their counts.
    +<S>  = <S>.str.strip/lower/contains/replace()  # Processes strings. For dates see File Formats.
     
    <S>.plot.line/area/bar/pie/hist()              # Generates a plot. `plt.show()` displays it.
     
    @@ -2605,7 +2605,7 @@ Name: a, dtype: int64
  • Pandas uses NumPy types like 'np.int64'. Series is converted to 'float64' if we assign np.nan to any item. Use '<S>.astype(<str/type>)' to get converted Series.
  • Series will silently overflow if we run 'pd.Series([100], dtype="int8") + 100'!
  • -

    Series — Aggregate, Transform, Map:

    <el> = <S>.sum/max/mean/idxmax/all()           # Or: <S>.agg(lambda <S>: <el>)
    +

    Series — Aggregate, Transform, Map:

    <el> = <S>.sum/max/mean/idxmax/all/count()     # Or: <S>.agg(lambda <S>: <el>)
     <S>  = <S>.rank/diff/cumsum/ffill/interpol…()  # Or: <S>.agg/transform(lambda <S>: <S>)
     <S>  = <S>.isna/fillna/isin([<el/coll>])       # Or: <S>.agg/transform/map(lambda <el>: <el>)
     
    @@ -2696,7 +2696,7 @@ c 6 7 ┃ │ c . . 6 7 │ │ │ treated as a column. ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
    -

    DataFrame — Aggregate, Transform, Map:

    <S>  = <DF>.sum/max/mean/idxmax/all()          # Or: <DF>.apply/agg(lambda <S>: <el>)
    +

    DataFrame — Aggregate, Transform, Map:

    <S>  = <DF>.sum/max/mean/idxmax/all/count()    # Or: <DF>.apply/agg(lambda <S>: <el>)
     <DF> = <DF>.rank/diff/cumsum/ffill/interpo…()  # Or: <DF>.apply/agg/transform(lambda <S>: <S>)
     <DF> = <DF>.isna/fillna/isin([<el/coll>])      # Or: <DF>.applymap(lambda <el>: <el>)
     
    @@ -2932,7 +2932,7 @@ $ deactivate # Deactivates the active