@@ -3111,13 +3111,12 @@ Name: a, dtype: int64
3111
3111
< Sr> .update(< Sr> ) # Updates items that are already present.
3112
3112
```
3113
3113
3114
- #### Apply, Aggregate, Transform:
3114
+ #### Aggregate, Transform, Map :
3115
3115
``` python
3116
3116
< 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>)
3118
3118
< Sr> = < Sr> .fillna(< el> ) # Or: <Sr>.apply/agg/transform/map(<map_func>)
3119
3119
```
3120
- * ** Also: ` 'ffill()' ` and ` 'interpolate()' ` .**
3121
3120
* ** 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.**
3122
3121
3123
3122
``` python
@@ -3128,23 +3127,22 @@ dtype: int64
3128
3127
```
3129
3128
3130
3129
``` 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
+ ┗━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛
3138
3136
```
3139
3137
3140
3138
``` 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
+ ┗━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛
3148
3146
```
3149
3147
3150
3148
### DataFrame
@@ -3201,7 +3199,7 @@ c 6 7
3201
3199
3202
3200
``` python
3203
3201
┏━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━┓
3204
- ┃ how/ join │ ' outer' │ ' inner' │ ' left' │ description ┃
3202
+ ┃ how/ join │ ' outer' │ ' inner' │ ' left' │ description ┃
3205
3203
┠────────────────────────┼───────────────┼────────────┼────────────┼──────────────────────────┨
3206
3204
┃ l.merge(r, on = ' y' , │ x y z │ x y z │ x y z │ Joins/ merges on column. ┃
3207
3205
┃ how = …) │ 0 1 2 . │ 3 4 5 │ 1 2 . │ Also accepts left_on and ┃
@@ -3231,13 +3229,12 @@ c 6 7
3231
3229
┗━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━┛
3232
3230
```
3233
3231
3234
- #### Apply, Aggregate, Transform:
3232
+ #### Aggregate, Transform, Map :
3235
3233
``` python
3236
3234
< 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>)
3238
3236
< DF > = < DF > .fillna(< el> ) # Or: <DF>.applymap(<map_func>)
3239
3237
```
3240
- * ** Also: ` 'ffill()' ` and ` 'interpolate()' ` .**
3241
3238
* ** All operations operate on columns by default. Use ` 'axis=1' ` parameter to process the rows instead.**
3242
3239
3243
3240
``` python
@@ -3248,24 +3245,24 @@ b 3 4
3248
3245
```
3249
3246
3250
3247
``` 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
+ ┗━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛
3258
3255
```
3259
3256
3260
3257
``` 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
+ ┗━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛
3269
3266
```
3270
3267
3271
3268
#### Encode, Decode:
@@ -3284,7 +3281,7 @@ b 3 4
3284
3281
```
3285
3282
3286
3283
### 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.**
3288
3285
3289
3286
``` python
3290
3287
>> > df = DataFrame([[1 , 2 , 3 ], [4 , 5 , 6 ], [7 , 8 , 6 ]], index = list (' abc' ), columns = list (' xyz' ))
@@ -3302,7 +3299,7 @@ c 7 8
3302
3299
< DF > = < GB > .get_group(group_key) # Selects a group by value of grouping column.
3303
3300
```
3304
3301
3305
- #### Apply, Aggregate, Transform:
3302
+ #### Aggregate, Transform, Map :
3306
3303
``` python
3307
3304
< DF > = < GB > .sum/ max / mean/ idxmax/ all () # Or: <GB>.apply/agg(<agg_func>)
3308
3305
< DF > = < GB > .rank/ diff/ cumsum/ ffill() # Or: <GB>.aggregate(<trans_func>)
@@ -3318,20 +3315,20 @@ c 7 8
3318
3315
```
3319
3316
3320
3317
``` 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
+ ┗━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛
3335
3332
```
3336
3333
3337
3334
### Rolling
0 commit comments