@@ -3127,22 +3127,22 @@ dtype: int64
3127
3127
```
3128
3128
3129
3129
``` python
3130
- ┏━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓
3131
- ┃ │ ' sum' │ [' sum' ] │ {' s' : ' sum' } ┃
3132
- ┠─────────────┼─────────────┼─────────────┼───────────────┨
3133
- ┃ sr.apply(…) │ 3 │ sum 3 │ s 3 ┃
3134
- ┃ sr.agg(…) │ │ │ ┃
3135
- ┗━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛
3130
+ + ------------ -+ ------------ -+ ------------ -+ -------------- -+
3131
+ | | ' sum' | [' sum' ] | {' s' : ' sum' } |
3132
+ + ------------ -+ ------------ -+ ------------ -+ -------------- -+
3133
+ | sr.apply(…) | 3 | sum 3 | s 3 |
3134
+ | sr.agg(…) | | | |
3135
+ + ------------ -+ ------------ -+ ------------ -+ -------------- -+
3136
3136
```
3137
3137
3138
3138
``` python
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
- ┗━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛
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
+ + ------------ -+ ------------ -+ ------------ -+ -------------- -+
3146
3146
```
3147
3147
3148
3148
### DataFrame
@@ -3198,35 +3198,35 @@ c 6 7
3198
3198
```
3199
3199
3200
3200
``` python
3201
- ┏━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━┓
3202
- ┃ how/ join │ ' outer' │ ' inner' │ ' left' │ description ┃
3203
- ┠────────────────────────┼───────────────┼────────────┼────────────┼──────────────────────────┨
3204
- ┃ l.merge(r, on = ' y' , │ x y z │ x y z │ x y z │ Joins/ merges on column. ┃
3205
- ┃ how = …) │ 0 1 2 . │ 3 4 5 │ 1 2 . │ Also accepts left_on and ┃
3206
- ┃ │ 1 3 4 5 │ │ 3 4 5 │ right_on parameters. ┃
3207
- ┃ │ 2 . 6 7 │ │ │ Uses ' inner' by default. ┃
3208
- ┠────────────────────────┼───────────────┼────────────┼────────────┼──────────────────────────┨
3209
- ┃ l.join(r, lsuffix = ' l' , │ x yl yr z │ │ x yl yr z │ Joins/ merges on row_keys.┃
3210
- ┃ rsuffix = ' r' , │ a 1 2 . . │ x yl yr z │ 1 2 . . │ Uses ' left' by default. ┃
3211
- ┃ how = …) │ b 3 4 4 5 │ 3 4 4 5 │ 3 4 4 5 │ ┃
3212
- ┃ │ c . . 6 7 │ │ │ ┃
3213
- ┠────────────────────────┼───────────────┼────────────┼────────────┼──────────────────────────┨
3214
- ┃ pd.concat([l, r], │ x y z │ y │ │ Adds rows at the bottom. ┃
3215
- ┃ axis = 0 , │ a 1 2 . │ 2 │ │ Uses ' outer' by default. ┃
3216
- ┃ join = …) │ b 3 4 . │ 4 │ │ By default works the ┃
3217
- ┃ │ b . 4 5 │ 4 │ │ same as `l.append(r)` . ┃
3218
- ┃ │ c . 6 7 │ 6 │ │ ┃
3219
- ┠────────────────────────┼───────────────┼────────────┼────────────┼──────────────────────────┨
3220
- ┃ pd.concat([l, r], │ x y y z │ │ │ Adds columns at the ┃
3221
- ┃ axis = 1 , │ a 1 2 . . │ x y y z │ │ right end. ┃
3222
- ┃ join = …) │ b 3 4 4 5 │ 3 4 4 5 │ │ Uses ' outer' by default. ┃
3223
- ┃ │ c . . 6 7 │ │ │ ┃
3224
- ┠────────────────────────┼───────────────┼────────────┼────────────┼──────────────────────────┨
3225
- ┃ l.combine_first(r) │ x y z │ │ │ Adds missing rows and ┃
3226
- ┃ │ a 1 2 . │ │ │ columns. ┃
3227
- ┃ │ b 3 4 5 │ │ │ ┃
3228
- ┃ │ c . 6 7 │ │ │ ┃
3229
- ┗━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━┛
3201
+ + ------------------------ + -------------- -+ ------------ + ------------ + -------------------------- +
3202
+ | how/ join | ' outer' | ' inner' | ' left' | description |
3203
+ + ------------------------ + -------------- -+ ------------ + ------------ + -------------------------- +
3204
+ | l.merge(r, on = ' y' , | x y z | x y z | x y z | Joins/ merges on column. |
3205
+ | how = …) | 0 1 2 . | 3 4 5 | 1 2 . | Also accepts left_on and |
3206
+ | | 1 3 4 5 | | 3 4 5 | right_on parameters. |
3207
+ | | 2 . 6 7 | | | Uses ' inner' by default. |
3208
+ + ------------------------ + -------------- -+ ------------ + ------------ + -------------------------- +
3209
+ | l.join(r, lsuffix = ' l' , | x yl yr z | | x yl yr z | Joins/ merges on row_keys.|
3210
+ | rsuffix = ' r' , | a 1 2 . . | x yl yr z | 1 2 . . | Uses ' left' by default. |
3211
+ | how = …) | b 3 4 4 5 | 3 4 4 5 | 3 4 4 5 | |
3212
+ | | c . . 6 7 | | | |
3213
+ + ------------------------ + -------------- -+ ------------ + ------------ + -------------------------- +
3214
+ | pd.concat([l, r], | x y z | y | | Adds rows at the bottom. |
3215
+ | axis = 0 , | a 1 2 . | 2 | | Uses ' outer' by default. |
3216
+ | join = …) | b 3 4 . | 4 | | By default works the |
3217
+ | | b . 4 5 | 4 | | same as `l.append(r)` . |
3218
+ | | c . 6 7 | 6 | | |
3219
+ + ------------------------ + -------------- -+ ------------ + ------------ + -------------------------- +
3220
+ | pd.concat([l, r], | x y y z | | | Adds columns at the |
3221
+ | axis = 1 , | a 1 2 . . | x y y z | | right end. |
3222
+ | join = …) | b 3 4 4 5 | 3 4 4 5 | | Uses ' outer' by default. |
3223
+ | | c . . 6 7 | | | |
3224
+ + ------------------------ + -------------- -+ ------------ + ------------ + -------------------------- +
3225
+ | l.combine_first(r) | x y z | | | Adds missing rows and |
3226
+ | | a 1 2 . | | | columns. |
3227
+ | | b 3 4 5 | | | |
3228
+ | | c . 6 7 | | | |
3229
+ + ------------------------ + -------------- -+ ------------ + ------------ + -------------------------- +
3230
3230
```
3231
3231
3232
3232
#### Aggregate, Transform, Map:
@@ -3245,24 +3245,24 @@ b 3 4
3245
3245
```
3246
3246
3247
3247
``` python
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
- ┗━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛
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
+ + ------------ -+ ------------ -+ ------------ -+ -------------- -+
3255
3255
```
3256
3256
3257
3257
``` python
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
- ┗━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛
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
+ + ------------ -+ ------------ -+ ------------ -+ -------------- -+
3266
3266
```
3267
3267
3268
3268
#### Encode, Decode:
@@ -3315,20 +3315,20 @@ c 7 8
3315
3315
```
3316
3316
3317
3317
``` python
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
- ┗━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛
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
+ + ------------ -+ ------------ -+ ------------ -+ ------------ -+ -------------- -+
3332
3332
```
3333
3333
3334
3334
### Rolling
@@ -3344,30 +3344,10 @@ c 7 8
3344
3344
Plotly
3345
3345
------
3346
3346
3347
- ### Top 10 Countries by Percentage of Population With Confirmed COVID-19 Infection
3348
- ``` text
3349
- |
3350
- |
3351
- |
3352
- |
3353
- |
3354
- |
3355
- |
3356
- |
3357
- |
3358
- |
3359
- |
3360
- |
3361
- |
3362
- |
3363
- |
3364
- |
3365
- |
3366
- |
3367
- |
3368
- |
3369
- +----------------------------------------------------------------------------------------------
3370
- ```
3347
+ ### Covid Deaths by Continent
3348
+
3349
+ <div id =" 2a950764-39fc-416d-97fe-0a6226a3095f " class =" plotly-graph-div " style =" height :420px ; width :100% ;" ></div >
3350
+ </div >
3371
3351
3372
3352
``` python
3373
3353
import pandas as pd
@@ -3381,35 +3361,14 @@ continents = pd.read_csv('https://datahub.io/JohnSnowLabs/country-and-continent-
3381
3361
merged = pd.merge(covid, continents, left_on = ' iso_code' , right_on = ' Three_Letter_Country_Code' )
3382
3362
summed = merged.groupby([' Continent_Name' , ' date' ]).sum().reset_index()
3383
3363
summed[' Total Deaths per Million' ] = summed.total_deaths * 1e6 / summed.population
3384
- summed = summed[(' 2020-03-14' < summed.date) & (summed.date < ' 2020-05-31 ' )]
3364
+ summed = summed[(' 2020-03-14' < summed.date) & (summed.date < ' 2020-06-25 ' )]
3385
3365
summed = summed.rename({' date' : ' Date' , ' Continent_Name' : ' Continent' }, axis = ' columns' )
3386
3366
plotly.express.line(summed, x = ' Date' , y = ' Total Deaths per Million' , color = ' Continent' ).show()
3387
3367
```
3388
3368
3389
- ### Confirmed Cases of COVID-19, Dow Jones Index, Gold, and Bitcoin Price
3390
- ``` text
3391
- |
3392
- |
3393
- |
3394
- |
3395
- |
3396
- |
3397
- |
3398
- |
3399
- |
3400
- |
3401
- |
3402
- |
3403
- |
3404
- |
3405
- |
3406
- |
3407
- |
3408
- |
3409
- |
3410
- |
3411
- +----------------------------------------------------------------------------------------------
3412
- ```
3369
+ ### Confirmed Covid Cases, Dow Jones, Gold, and Bitcoin Price
3370
+
3371
+ <div id =" e23ccacc-a456-478b-b467-7282a2165921 " class =" plotly-graph-div " style =" height :400px ; width :100% ;" ></div >
3413
3372
3414
3373
``` python
3415
3374
import pandas, datetime
0 commit comments