@@ -3111,13 +3111,12 @@ Name: a, dtype: int64
31113111< Sr> .update(< Sr> ) # Updates items that are already present.
31123112```
31133113
3114- #### Apply, Aggregate, Transform:
3114+ #### Aggregate, Transform, Map :
31153115``` python
31163116< el> = < Sr> .sum/ max / mean/ idxmax/ all () # Or: <Sr>.aggregate(<agg_func>)
3117- < Sr> = < Sr> .rank/ diff/ cumsum/ pct_change() # Or: <Sr>.agg/transform(<trans_func>)
3117+ < Sr> = < Sr> .rank/ diff/ cumsum/ ffill / interpl() # Or: <Sr>.agg/transform(<trans_func>)
31183118< Sr> = < Sr> .fillna(< el> ) # Or: <Sr>.apply/agg/transform/map(<map_func>)
31193119```
3120- * ** Also: ` 'ffill()' ` and ` 'interpolate()' ` .**
31213120* ** The way ` 'aggregate()' ` and ` 'transform()' ` find out whether a function accepts an element or the whole Series is by passing it a single value at first and if it raises an error, then they pass it the whole Series.**
31223121
31233122``` python
@@ -3128,23 +3127,22 @@ dtype: int64
31283127```
31293128
31303129``` python
3131- + ------------ -+ -------------- -+ -------------- -+ -------------- -+
3132- | | ' sum' | [' sum' ] | {' s' : ' sum' } |
3133- + ------------ -+ -------------- -+ -------------- -+ -------------- -+
3134- | sr.apply(…) | | | |
3135- | sr.agg(…) | 3 | sum 3 | s 3 |
3136- | | | | |
3137- + ------------ -+ -------------- -+ -------------- -+ -------------- -+
3130+ ┏━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓
3131+ ┃ │ ' sum' │ [' sum' ] │ {' s' : ' sum' } ┃
3132+ ┠─────────────┼─────────────┼─────────────┼───────────────┨
3133+ ┃ sr.apply(…) │ 3 │ sum 3 │ s 3 ┃
3134+ ┃ sr.agg(…) │ │ │ ┃
3135+ ┗━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛
31383136```
31393137
31403138``` python
3141- + ------------ -+ -------------- -+ -------------- -+ -------------- -+
3142- | | ' rank' | [' rank' ] | {' r' : ' rank' } |
3143- + ------------ -+ -------------- -+ -------------- -+ -------------- -+
3144- | sr.apply(…) | | rank | |
3145- | sr.agg(…) | x 1 | x 1 | r x 1 |
3146- | sr.trans(…) | y 2 | y 2 | y 2 |
3147- + ------------ -+ -------------- -+ -------------- -+ -------------- -+
3139+ ┏━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓
3140+ ┃ │ ' rank' │ [' rank' ] │ {' r' : ' rank' } ┃
3141+ ┠─────────────┼─────────────┼─────────────┼───────────────┨
3142+ ┃ sr.apply(…) │ │ rank │ ┃
3143+ ┃ sr.agg(…) │ x 1 │ x 1 │ r x 1 ┃
3144+ ┃ sr.trans(…) │ y 2 │ y 2 │ y 2 ┃
3145+ ┗━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛
31483146```
31493147
31503148### DataFrame
@@ -3201,7 +3199,7 @@ c 6 7
32013199
32023200``` python
32033201┏━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━┓
3204- ┃ how/ join │ ' outer' │ ' inner' │ ' left' │ description ┃
3202+ ┃ how/ join │ ' outer' │ ' inner' │ ' left' │ description ┃
32053203┠────────────────────────┼───────────────┼────────────┼────────────┼──────────────────────────┨
32063204┃ l.merge(r, on = ' y' , │ x y z │ x y z │ x y z │ Joins/ merges on column. ┃
32073205┃ how = …) │ 0 1 2 . │ 3 4 5 │ 1 2 . │ Also accepts left_on and ┃
@@ -3231,13 +3229,12 @@ c 6 7
32313229┗━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━┛
32323230```
32333231
3234- #### Apply, Aggregate, Transform:
3232+ #### Aggregate, Transform, Map :
32353233``` python
32363234< Sr> = < DF > .sum/ max / mean/ idxmax/ all () # Or: <DF>.apply/agg/transform(<agg_func>)
3237- < DF > = < DF > .rank/ diff/ cumsum/ pct_change() # Or: <DF>.apply/agg/transform(<trans_func>)
3235+ < DF > = < DF > .rank/ diff/ cumsum/ ffill / interpl() # Or: <DF>.apply/agg/transform(<trans_func>)
32383236< DF > = < DF > .fillna(< el> ) # Or: <DF>.applymap(<map_func>)
32393237```
3240- * ** Also: ` 'ffill()' ` and ` 'interpolate()' ` .**
32413238* ** All operations operate on columns by default. Use ` 'axis=1' ` parameter to process the rows instead.**
32423239
32433240``` python
@@ -3248,24 +3245,24 @@ b 3 4
32483245```
32493246
32503247``` python
3251- + ------------ -+ -------------- -+ -------------- -+ -------------- -+
3252- | | ' sum' | [' sum' ] | {' x' : ' sum' } |
3253- + ------------ -+ -------------- -+ -------------- -+ -------------- -+
3254- | df.apply(…) | | x y | |
3255- | df.agg(…) | x 4 | sum 4 6 | x 4 |
3256- | | y 6 | | |
3257- + ------------ -+ -------------- -+ -------------- -+ -------------- -+
3248+ ┏━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓
3249+ ┃ │ ' sum' │ [' sum' ] │ {' x' : ' sum' } ┃
3250+ ┠─────────────┼─────────────┼─────────────┼───────────────┨
3251+ ┃ df.apply(…) │ │ x y │ ┃
3252+ ┃ df.agg(…) │ x 4 │ sum 4 6 │ x 4 ┃
3253+ ┃ │ y 6 │ │ ┃
3254+ ┗━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛
32583255```
32593256
32603257``` python
3261- + ------------ -+ -------------- -+ -------------- -+ -------------- -+
3262- | | ' rank' | [' rank' ] | {' x' : ' rank' } |
3263- + ------------ -+ -------------- -+ -------------- -+ -------------- -+
3264- | df.apply(…) | x y | x y | x |
3265- | df.agg(…) | a 1 1 | rank rank | a 1 |
3266- | df.trans(…) | b 2 2 | a 1 1 | b 2 |
3267- | | | b 2 2 | |
3268- + ------------ -+ -------------- -+ -------------- -+ -------------- -+
3258+ ┏━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓
3259+ ┃ │ ' rank' │ [' rank' ] │ {' x' : ' rank' } ┃
3260+ ┠─────────────┼─────────────┼─────────────┼───────────────┨
3261+ ┃ df.apply(…) │ x y │ x y │ x ┃
3262+ ┃ df.agg(…) │ a 1 1 │ rank rank │ a 1 ┃
3263+ ┃ df.trans(…) │ b 2 2 │ a 1 1 │ b 2 ┃
3264+ ┃ │ │ b 2 2 │ ┃
3265+ ┗━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛
32693266```
32703267
32713268#### Encode, Decode:
@@ -3284,7 +3281,7 @@ b 3 4
32843281```
32853282
32863283### GroupBy
3287- ** Object that groups together rows of a dataframe based on the value of passed column.**
3284+ ** Object that groups together rows of a dataframe based on the value of the passed column.**
32883285
32893286``` python
32903287>> > df = DataFrame([[1 , 2 , 3 ], [4 , 5 , 6 ], [7 , 8 , 6 ]], index = list (' abc' ), columns = list (' xyz' ))
@@ -3302,7 +3299,7 @@ c 7 8
33023299< DF > = < GB > .get_group(group_key) # Selects a group by value of grouping column.
33033300```
33043301
3305- #### Apply, Aggregate, Transform:
3302+ #### Aggregate, Transform, Map :
33063303``` python
33073304< DF > = < GB > .sum/ max / mean/ idxmax/ all () # Or: <GB>.apply/agg(<agg_func>)
33083305< DF > = < GB > .rank/ diff/ cumsum/ ffill() # Or: <GB>.aggregate(<trans_func>)
@@ -3318,20 +3315,20 @@ c 7 8
33183315```
33193316
33203317``` python
3321- + ------------ -+ ------------ -+ ------------ -+ ------------ -+ -------------- -+
3322- | | ' sum' | ' rank' | [' rank' ] | {' x' : ' rank' } |
3323- + ------------ -+ ------------ -+ ------------ -+ ------------ -+ -------------- -+
3324- | gb.agg(…) | x y | x y | x y | x |
3325- | | z | a 1 1 | rank rank | a 1 |
3326- | | 3 1 2 | b 1 1 | a 1 1 | b 1 |
3327- | | 6 11 13 | c 2 2 | b 1 1 | c 2 |
3328- | | | | c 2 2 | |
3329- + ------------ -+ ------------ -+ ------------ -+ ------------ -+ -------------- -+
3330- | gb.trans(…) | x y | x y | | |
3331- | | a 1 2 | a 1 1 | | |
3332- | | b 11 13 | b 1 1 | | |
3333- | | c 11 13 | c 1 1 | | |
3334- + ------------ -+ ------------ -+ ------------ -+ ------------ -+ -------------- -+
3318+ ┏━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓
3319+ ┃ │ ' sum' │ ' rank' │ [' rank' ] │ {' x' : ' rank' } ┃
3320+ ┠─────────────┼─────────────┼─────────────┼─────────────┼───────────────┨
3321+ ┃ gb.agg(…) │ x y │ x y │ x y │ x ┃
3322+ ┃ │ z │ a 1 1 │ rank rank │ a 1 ┃
3323+ ┃ │ 3 1 2 │ b 1 1 │ a 1 1 │ b 1 ┃
3324+ ┃ │ 6 11 13 │ c 2 2 │ b 1 1 │ c 2 ┃
3325+ ┃ │ │ │ c 2 2 │ ┃
3326+ ┠─────────────┼─────────────┼─────────────┼─────────────┼───────────────┨
3327+ ┃ gb.trans(…) │ x y │ x y │ │ ┃
3328+ ┃ │ a 1 2 │ a 1 1 │ │ ┃
3329+ ┃ │ b 11 13 │ b 1 1 │ │ ┃
3330+ ┃ │ c 11 13 │ c 1 1 │ │ ┃
3331+ ┗━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛
33353332```
33363333
33373334### Rolling
0 commit comments