Shaded interval example
(data)
| 343 | |
| 344 | @_print_source |
| 345 | def _plot_shaded_interval(data): |
| 346 | """ |
| 347 | Shaded interval example |
| 348 | """ |
| 349 | |
| 350 | # Sum price grouped by date |
| 351 | price_by_date = ( |
| 352 | data.groupby(["date"])["total_price"] |
| 353 | .agg(["mean", "std", "count"]) |
| 354 | .loc["2017-12-01":] |
| 355 | .assign( |
| 356 | lower_ci=lambda x: x["mean"] - 1.96 * x["std"] / x["count"] ** 0.5, |
| 357 | upper_ci=lambda x: x["mean"] + 1.96 * x["std"] / x["count"] ** 0.5, |
| 358 | ) |
| 359 | .reset_index() |
| 360 | ) |
| 361 | print(price_by_date.head()) |
| 362 | """Print break""" |
| 363 | _shaded_interval_example_1(price_by_date) |
| 364 | |
| 365 | |
| 366 | @_print_source |
no test coverage detected