{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ ">### 🚩 *Create a free WhyLabs account to get more value out of whylogs!*
\n", ">*Did you know you can store, visualize, and monitor whylogs profiles with the [WhyLabs Observability Platform](https://whylabs.ai/whylogs-free-signup?utm_source=whylogs-Github&utm_medium=whylogs-example&utm_campaign=Logging_Different_Data)? Sign up for a [free WhyLabs account](https://whylabs.ai/whylogs-free-signup?utm_source=whylogs-Github&utm_medium=whylogs-example&utm_campaign=Logging_Different_Data) to leverage the power of whylogs and WhyLabs together!*" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# (why)Logging" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/whylabs/whylogs/blob/mainline/python/examples/basic/Logging_Different_Data.ipynb)" ] }, { "cell_type": "markdown", "metadata": { "collapsed": true, "pycharm": { "name": "#%% md\n" } }, "source": [ "WhyLogs enables logging different types of data that can then be used to monitor the data. We'll go through examples on different types of data to log and go more in depth on different options. Before we get going though, let's import whylogs." ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false, "pycharm": { "name": "#%%\n" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[33mWARNING: You are using pip version 22.0.3; however, version 22.1 is available.\r\n", "You should consider upgrading via the '/Users/melanie/Dev/whylogs-v1/python/.venv/bin/python -m pip install --upgrade pip' command.\u001b[0m\u001b[33m\r\n", "\u001b[0m" ] } ], "source": [ "# Note: you may need to restart the kernel to use updated packages.\n", "%pip install whylogs" ] }, { "cell_type": "markdown", "metadata": { "collapsed": false, "pycharm": { "name": "#%% md\n" } }, "source": [ "## Table of Contents\n", "#### [Log Pandas Dataframe](#log_dataframe) | [Log Dictionary](#log_dict) | [Display Logs](#display)" ] }, { "cell_type": "markdown", "metadata": { "collapsed": false }, "source": [ "## Log Pandas DataFrame \n", "\n", "We will be generating log by importing data from a CSV into Pandas Dataframe, logging it with the whylogs python library." ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false, "pycharm": { "name": "#%%\n" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Transaction IDCustomer IDProduct Subcategory CodeProduct Category CodeItem PriceTotal TaxTotal AmountStore TypeProduct CategoryProduct SubcategoryDate of BirthGenderCity CodeAge at Transaction DatePurchase CanceledTransaction Day of WeekTransaction WeekTransaction Batch
0T25601292314C268458126114.924.1290253.9290TeleShopHome and kitchenTools1976-10-08M1.036.00.0000
1T1465175267C27134435107.722.6170238.0170e-ShopBooksComics1970-01-29F5.043.00.0000
2T4968790114C2723054314.67.665080.6650e-ShopElectronicsMobiles1975-08-25F10.037.00.0000
3T50504166310C2750574415.74.945552.0455MBRBagsWomen1980-09-17M7.032.00.0000
4T10877729712C270074105144.145.3915477.6915e-ShopBooksNon-Fiction1983-02-20M10.030.00.0000
.........................................................
904T89167826318C27427010568.214.3220150.7220Flagship storeBooksNon-Fiction1972-06-06F1.040.00.0000
905T87193008634C271051116124.252.1640548.9640e-ShopHome and kitchenBath1976-02-13F3.036.00.0000
906T84036395834C27076311577.916.3590172.1590TeleShopBooksChildren1991-02-10F8.021.00.0000
907T72150045625C27043211511.84.956052.1560e-ShopBooksChildren1982-09-17M7.030.01.0000
908T97942600110C2695594367.935.6475375.1475e-ShopElectronicsMobiles1972-06-24M1.040.00.0000
\n", "

909 rows × 18 columns

\n", "
" ], "text/plain": [ " Transaction ID Customer ID Product Subcategory Code \\\n", "0 T25601292314 C268458 12 \n", "1 T1465175267 C271344 3 \n", "2 T4968790114 C272305 4 \n", "3 T50504166310 C275057 4 \n", "4 T10877729712 C270074 10 \n", ".. ... ... ... \n", "904 T89167826318 C274270 10 \n", "905 T87193008634 C271051 11 \n", "906 T84036395834 C270763 11 \n", "907 T72150045625 C270432 11 \n", "908 T97942600110 C269559 4 \n", "\n", " Product Category Code Item Price Total Tax Total Amount \\\n", "0 6 114.9 24.1290 253.9290 \n", "1 5 107.7 22.6170 238.0170 \n", "2 3 14.6 7.6650 80.6650 \n", "3 4 15.7 4.9455 52.0455 \n", "4 5 144.1 45.3915 477.6915 \n", ".. ... ... ... ... \n", "904 5 68.2 14.3220 150.7220 \n", "905 6 124.2 52.1640 548.9640 \n", "906 5 77.9 16.3590 172.1590 \n", "907 5 11.8 4.9560 52.1560 \n", "908 3 67.9 35.6475 375.1475 \n", "\n", " Store Type Product Category Product Subcategory Date of Birth \\\n", "0 TeleShop Home and kitchen Tools 1976-10-08 \n", "1 e-Shop Books Comics 1970-01-29 \n", "2 e-Shop Electronics Mobiles 1975-08-25 \n", "3 MBR Bags Women 1980-09-17 \n", "4 e-Shop Books Non-Fiction 1983-02-20 \n", ".. ... ... ... ... \n", "904 Flagship store Books Non-Fiction 1972-06-06 \n", "905 e-Shop Home and kitchen Bath 1976-02-13 \n", "906 TeleShop Books Children 1991-02-10 \n", "907 e-Shop Books Children 1982-09-17 \n", "908 e-Shop Electronics Mobiles 1972-06-24 \n", "\n", " Gender City Code Age at Transaction Date Purchase Canceled \\\n", "0 M 1.0 36.0 0.0 \n", "1 F 5.0 43.0 0.0 \n", "2 F 10.0 37.0 0.0 \n", "3 M 7.0 32.0 0.0 \n", "4 M 10.0 30.0 0.0 \n", ".. ... ... ... ... \n", "904 F 1.0 40.0 0.0 \n", "905 F 3.0 36.0 0.0 \n", "906 F 8.0 21.0 0.0 \n", "907 M 7.0 30.0 1.0 \n", "908 M 1.0 40.0 0.0 \n", "\n", " Transaction Day of Week Transaction Week Transaction Batch \n", "0 0 0 0 \n", "1 0 0 0 \n", "2 0 0 0 \n", "3 0 0 0 \n", "4 0 0 0 \n", ".. ... ... ... \n", "904 0 0 0 \n", "905 0 0 0 \n", "906 0 0 0 \n", "907 0 0 0 \n", "908 0 0 0 \n", "\n", "[909 rows x 18 columns]" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import os.path\n", "import pandas as pd\n", "\n", "# Read in a CSV, this one is from a public bucket on s3\n", "retail_daily = pd.read_csv('https://whylabs-public.s3.us-west-2.amazonaws.com/whylogs_examples/retail-daily-features.csv')\n", "retail_daily" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false, "pycharm": { "name": "#%%\n" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
counts/ncounts/nulltypes/integraltypes/fractionaltypes/booleantypes/stringtypes/objectcardinality/estcardinality/upper_1cardinality/lower_1...distribution/mindistribution/q_10distribution/q_25distribution/mediandistribution/q_75distribution/q_90typeints/maxints/minfrequent_items/frequent_strings
column
Purchase Canceled9097208370002.0000002.0001002.000000...0.0000.00000.0000.00000.00000.0000SummaryType.COLUMNNaNNaNNaN
Age at Transaction Date9090090900025.00000125.00125025.000000...19.00021.000025.00031.000037.000040.0000SummaryType.COLUMNNaNNaNNaN
Transaction Week909090900001.0000001.0000501.000000...0.0000.00000.0000.00000.00000.0000SummaryType.COLUMN0.00.0[FrequentItem(value='0.000000', est=909, upper...
Store Type909000090904.0000004.0002004.000000...NaNNaNNaNNaNNaNNaNSummaryType.COLUMNNaNNaN[FrequentItem(value='e-Shop', est=375, upper=3...
Product Category909000090906.0000006.0003006.000000...NaNNaNNaNNaNNaNNaNSummaryType.COLUMNNaNNaN[FrequentItem(value='Books', est=232, upper=23...
Gender909000090902.0000002.0001002.000000...NaNNaNNaNNaNNaNNaNSummaryType.COLUMNNaNNaN[FrequentItem(value='M', est=455, upper=455, l...
Transaction ID90900009090904.722898916.565225893.168643...NaNNaNNaNNaNNaNNaNSummaryType.COLUMNNaNNaN[FrequentItem(value='T40336799311', est=3, upp...
Item Price90900909000672.542875681.346093663.953801...7.10018.200043.20080.1000116.2000137.0000SummaryType.COLUMNNaNNaNNaN
Total Tax90900909000800.975225811.459552790.745935...0.8614.882510.01720.517036.172554.2640SummaryType.COLUMNNaNNaNNaN
Product Category Code909090900006.0000006.0003006.000000...1.0001.00002.0004.00005.00006.0000SummaryType.COLUMN6.01.0[FrequentItem(value='5.000000', est=232, upper...
Transaction Day of Week909090900001.0000001.0000501.000000...0.0000.00000.0000.00000.00000.0000SummaryType.COLUMN0.00.0[FrequentItem(value='0.000000', est=909, upper...
City Code9091090800010.00000010.00050010.000000...1.0001.00003.0005.00008.000010.0000SummaryType.COLUMNNaNNaNNaN
Transaction Batch909090900001.0000001.0000501.000000...0.0000.00000.0000.00000.00000.0000SummaryType.COLUMN0.00.0[FrequentItem(value='0.000000', est=909, upper...
Date of Birth90900009090801.978113812.475567791.736016...NaNNaNNaNNaNNaNNaNSummaryType.COLUMNNaNNaN[FrequentItem(value='1981-03-29', est=4, upper...
Customer ID90900009090847.420398858.512667836.597955...NaNNaNNaNNaNNaNNaNSummaryType.COLUMNNaNNaN[FrequentItem(value='C274278', est=4, upper=3,...
Total Amount90900909000842.098548853.121157831.344071...-767.97525.304582.433188.4025358.6830555.2625SummaryType.COLUMNNaNNaNNaN
Product Subcategory9090000909018.00000118.00089918.000000...NaNNaNNaNNaNNaNNaNSummaryType.COLUMNNaNNaN[FrequentItem(value='Women', est=133, upper=13...
Product Subcategory Code9090909000012.00000012.00059912.000000...1.0001.00003.0005.000010.000011.0000SummaryType.COLUMN12.01.0[FrequentItem(value='4.000000', est=148, upper...
\n", "

18 rows × 24 columns

\n", "
" ], "text/plain": [ " counts/n counts/null types/integral \\\n", "column \n", "Purchase Canceled 909 72 0 \n", "Age at Transaction Date 909 0 0 \n", "Transaction Week 909 0 909 \n", "Store Type 909 0 0 \n", "Product Category 909 0 0 \n", "Gender 909 0 0 \n", "Transaction ID 909 0 0 \n", "Item Price 909 0 0 \n", "Total Tax 909 0 0 \n", "Product Category Code 909 0 909 \n", "Transaction Day of Week 909 0 909 \n", "City Code 909 1 0 \n", "Transaction Batch 909 0 909 \n", "Date of Birth 909 0 0 \n", "Customer ID 909 0 0 \n", "Total Amount 909 0 0 \n", "Product Subcategory 909 0 0 \n", "Product Subcategory Code 909 0 909 \n", "\n", " types/fractional types/boolean types/string \\\n", "column \n", "Purchase Canceled 837 0 0 \n", "Age at Transaction Date 909 0 0 \n", "Transaction Week 0 0 0 \n", "Store Type 0 0 909 \n", "Product Category 0 0 909 \n", "Gender 0 0 909 \n", "Transaction ID 0 0 909 \n", "Item Price 909 0 0 \n", "Total Tax 909 0 0 \n", "Product Category Code 0 0 0 \n", "Transaction Day of Week 0 0 0 \n", "City Code 908 0 0 \n", "Transaction Batch 0 0 0 \n", "Date of Birth 0 0 909 \n", "Customer ID 0 0 909 \n", "Total Amount 909 0 0 \n", "Product Subcategory 0 0 909 \n", "Product Subcategory Code 0 0 0 \n", "\n", " types/object cardinality/est cardinality/upper_1 \\\n", "column \n", "Purchase Canceled 0 2.000000 2.000100 \n", "Age at Transaction Date 0 25.000001 25.001250 \n", "Transaction Week 0 1.000000 1.000050 \n", "Store Type 0 4.000000 4.000200 \n", "Product Category 0 6.000000 6.000300 \n", "Gender 0 2.000000 2.000100 \n", "Transaction ID 0 904.722898 916.565225 \n", "Item Price 0 672.542875 681.346093 \n", "Total Tax 0 800.975225 811.459552 \n", "Product Category Code 0 6.000000 6.000300 \n", "Transaction Day of Week 0 1.000000 1.000050 \n", "City Code 0 10.000000 10.000500 \n", "Transaction Batch 0 1.000000 1.000050 \n", "Date of Birth 0 801.978113 812.475567 \n", "Customer ID 0 847.420398 858.512667 \n", "Total Amount 0 842.098548 853.121157 \n", "Product Subcategory 0 18.000001 18.000899 \n", "Product Subcategory Code 0 12.000000 12.000599 \n", "\n", " cardinality/lower_1 ... distribution/min \\\n", "column ... \n", "Purchase Canceled 2.000000 ... 0.000 \n", "Age at Transaction Date 25.000000 ... 19.000 \n", "Transaction Week 1.000000 ... 0.000 \n", "Store Type 4.000000 ... NaN \n", "Product Category 6.000000 ... NaN \n", "Gender 2.000000 ... NaN \n", "Transaction ID 893.168643 ... NaN \n", "Item Price 663.953801 ... 7.100 \n", "Total Tax 790.745935 ... 0.861 \n", "Product Category Code 6.000000 ... 1.000 \n", "Transaction Day of Week 1.000000 ... 0.000 \n", "City Code 10.000000 ... 1.000 \n", "Transaction Batch 1.000000 ... 0.000 \n", "Date of Birth 791.736016 ... NaN \n", "Customer ID 836.597955 ... NaN \n", "Total Amount 831.344071 ... -767.975 \n", "Product Subcategory 18.000000 ... NaN \n", "Product Subcategory Code 12.000000 ... 1.000 \n", "\n", " distribution/q_10 distribution/q_25 \\\n", "column \n", "Purchase Canceled 0.0000 0.000 \n", "Age at Transaction Date 21.0000 25.000 \n", "Transaction Week 0.0000 0.000 \n", "Store Type NaN NaN \n", "Product Category NaN NaN \n", "Gender NaN NaN \n", "Transaction ID NaN NaN \n", "Item Price 18.2000 43.200 \n", "Total Tax 4.8825 10.017 \n", "Product Category Code 1.0000 2.000 \n", "Transaction Day of Week 0.0000 0.000 \n", "City Code 1.0000 3.000 \n", "Transaction Batch 0.0000 0.000 \n", "Date of Birth NaN NaN \n", "Customer ID NaN NaN \n", "Total Amount 25.3045 82.433 \n", "Product Subcategory NaN NaN \n", "Product Subcategory Code 1.0000 3.000 \n", "\n", " distribution/median distribution/q_75 \\\n", "column \n", "Purchase Canceled 0.0000 0.0000 \n", "Age at Transaction Date 31.0000 37.0000 \n", "Transaction Week 0.0000 0.0000 \n", "Store Type NaN NaN \n", "Product Category NaN NaN \n", "Gender NaN NaN \n", "Transaction ID NaN NaN \n", "Item Price 80.1000 116.2000 \n", "Total Tax 20.5170 36.1725 \n", "Product Category Code 4.0000 5.0000 \n", "Transaction Day of Week 0.0000 0.0000 \n", "City Code 5.0000 8.0000 \n", "Transaction Batch 0.0000 0.0000 \n", "Date of Birth NaN NaN \n", "Customer ID NaN NaN \n", "Total Amount 188.4025 358.6830 \n", "Product Subcategory NaN NaN \n", "Product Subcategory Code 5.0000 10.0000 \n", "\n", " distribution/q_90 type ints/max \\\n", "column \n", "Purchase Canceled 0.0000 SummaryType.COLUMN NaN \n", "Age at Transaction Date 40.0000 SummaryType.COLUMN NaN \n", "Transaction Week 0.0000 SummaryType.COLUMN 0.0 \n", "Store Type NaN SummaryType.COLUMN NaN \n", "Product Category NaN SummaryType.COLUMN NaN \n", "Gender NaN SummaryType.COLUMN NaN \n", "Transaction ID NaN SummaryType.COLUMN NaN \n", "Item Price 137.0000 SummaryType.COLUMN NaN \n", "Total Tax 54.2640 SummaryType.COLUMN NaN \n", "Product Category Code 6.0000 SummaryType.COLUMN 6.0 \n", "Transaction Day of Week 0.0000 SummaryType.COLUMN 0.0 \n", "City Code 10.0000 SummaryType.COLUMN NaN \n", "Transaction Batch 0.0000 SummaryType.COLUMN 0.0 \n", "Date of Birth NaN SummaryType.COLUMN NaN \n", "Customer ID NaN SummaryType.COLUMN NaN \n", "Total Amount 555.2625 SummaryType.COLUMN NaN \n", "Product Subcategory NaN SummaryType.COLUMN NaN \n", "Product Subcategory Code 11.0000 SummaryType.COLUMN 12.0 \n", "\n", " ints/min \\\n", "column \n", "Purchase Canceled NaN \n", "Age at Transaction Date NaN \n", "Transaction Week 0.0 \n", "Store Type NaN \n", "Product Category NaN \n", "Gender NaN \n", "Transaction ID NaN \n", "Item Price NaN \n", "Total Tax NaN \n", "Product Category Code 1.0 \n", "Transaction Day of Week 0.0 \n", "City Code NaN \n", "Transaction Batch 0.0 \n", "Date of Birth NaN \n", "Customer ID NaN \n", "Total Amount NaN \n", "Product Subcategory NaN \n", "Product Subcategory Code 1.0 \n", "\n", " frequent_items/frequent_strings \n", "column \n", "Purchase Canceled NaN \n", "Age at Transaction Date NaN \n", "Transaction Week [FrequentItem(value='0.000000', est=909, upper... \n", "Store Type [FrequentItem(value='e-Shop', est=375, upper=3... \n", "Product Category [FrequentItem(value='Books', est=232, upper=23... \n", "Gender [FrequentItem(value='M', est=455, upper=455, l... \n", "Transaction ID [FrequentItem(value='T40336799311', est=3, upp... \n", "Item Price NaN \n", "Total Tax NaN \n", "Product Category Code [FrequentItem(value='5.000000', est=232, upper... \n", "Transaction Day of Week [FrequentItem(value='0.000000', est=909, upper... \n", "City Code NaN \n", "Transaction Batch [FrequentItem(value='0.000000', est=909, upper... \n", "Date of Birth [FrequentItem(value='1981-03-29', est=4, upper... \n", "Customer ID [FrequentItem(value='C274278', est=4, upper=3,... \n", "Total Amount NaN \n", "Product Subcategory [FrequentItem(value='Women', est=133, upper=13... \n", "Product Subcategory Code [FrequentItem(value='4.000000', est=148, upper... \n", "\n", "[18 rows x 24 columns]" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import whylogs as why\n", "\n", "# Log the data frame. This equivalent to why.log(retail_daily) and why.log(data=retail_daily)\n", "results = why.log(pandas=retail_daily)\n", "\n", "# Get the Results\n", "profile = results.profile()\n", "\n", "# Head down to Display a Log for explination\n", "profile.view().to_pandas()" ] }, { "cell_type": "markdown", "metadata": { "collapsed": false, "pycharm": { "name": "#%% md\n" } }, "source": [ "## Log Dictionary \n", "\n", "Sometimes a quick log is all you need though and don't want to set up a DataFrame. We can log a dictionary as if it were a single row of data. This works best when the values of that dictionary are scalar data, any collection values or nested values will be tracked with only a basic type counter and these entries get mapped to the object count.\n", "\n", "Suppose we want to log art prints that are being shown to see what sells best.\n" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false, "pycharm": { "name": "#%%\n" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
counts/ncounts/nulltypes/integraltypes/fractionaltypes/booleantypes/stringtypes/objectcardinality/estcardinality/upper_1cardinality/lower_1...distribution/ndistribution/maxdistribution/mindistribution/q_10distribution/q_25distribution/mediandistribution/q_75distribution/q_90ints/maxints/min
column
status10000101.01.000051.0...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
medium1000001NaNNaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
price10010001.01.000051.0...1.058.058.058.058.058.058.058.0NaNNaN
height10100001.01.000051.0...1.0100.0100.0100.0100.0100.0100.0100.0100.0100.0
length10100001.01.000051.0...1.01000.01000.01000.01000.01000.01000.01000.01000.01000.0
\n", "

5 rows × 24 columns

\n", "
" ], "text/plain": [ " counts/n counts/null types/integral types/fractional \\\n", "column \n", "status 1 0 0 0 \n", "medium 1 0 0 0 \n", "price 1 0 0 1 \n", "height 1 0 1 0 \n", "length 1 0 1 0 \n", "\n", " types/boolean types/string types/object cardinality/est \\\n", "column \n", "status 0 1 0 1.0 \n", "medium 0 0 1 NaN \n", "price 0 0 0 1.0 \n", "height 0 0 0 1.0 \n", "length 0 0 0 1.0 \n", "\n", " cardinality/upper_1 cardinality/lower_1 ... distribution/n \\\n", "column ... \n", "status 1.00005 1.0 ... NaN \n", "medium NaN NaN ... NaN \n", "price 1.00005 1.0 ... 1.0 \n", "height 1.00005 1.0 ... 1.0 \n", "length 1.00005 1.0 ... 1.0 \n", "\n", " distribution/max distribution/min distribution/q_10 \\\n", "column \n", "status NaN NaN NaN \n", "medium NaN NaN NaN \n", "price 58.0 58.0 58.0 \n", "height 100.0 100.0 100.0 \n", "length 1000.0 1000.0 1000.0 \n", "\n", " distribution/q_25 distribution/median distribution/q_75 \\\n", "column \n", "status NaN NaN NaN \n", "medium NaN NaN NaN \n", "price 58.0 58.0 58.0 \n", "height 100.0 100.0 100.0 \n", "length 1000.0 1000.0 1000.0 \n", "\n", " distribution/q_90 ints/max ints/min \n", "column \n", "status NaN NaN NaN \n", "medium NaN NaN NaN \n", "price 58.0 NaN NaN \n", "height 100.0 100.0 100.0 \n", "length 1000.0 1000.0 1000.0 \n", "\n", "[5 rows x 24 columns]" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import whylogs as why\n", "\n", "example_data = {\"height\": 100, \"length\": 1000, \"status\": \"sold\", \"price\": 58.00, \"medium\": [\"watercolor\", \"digital\"] }\n", "\n", "# Log the dictionary this is equivalent to why.log(example_data)\n", "dict_results = why.log(row=example_data)\n", "\n", "# Retrieve the profile\n", "profile_from_dict = dict_results.profile()\n", "\n", "# Head to Display Logs to explain\n", "profile_from_dict.view().to_pandas()" ] }, { "cell_type": "markdown", "metadata": { "collapsed": false }, "source": [ "## Display the Logs
\n", "There are many ways to display the data! Examples in \"Integrations\", \"WhyLabs\", and \"Use Cases\" showcase how to use a variety of tools to see your data. Also the Notebook_Profile_Visualizer helps you display the profile with a variety of charts.\n", "\n", "Your log will from above returns results including the profile. It's this profile that we can view and export as a Pandas DataFrame." ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false, "pycharm": { "name": "#%%\n" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
counts/ncounts/nulltypes/integraltypes/fractionaltypes/booleantypes/stringtypes/objectcardinality/estcardinality/upper_1cardinality/lower_1...distribution/mindistribution/q_10distribution/q_25distribution/mediandistribution/q_75distribution/q_90typeints/maxints/minfrequent_items/frequent_strings
column
Purchase Canceled9097208370002.0000002.0001002.000000...0.0000.00000.0000.00000.00000.0000SummaryType.COLUMNNaNNaNNaN
Age at Transaction Date9090090900025.00000125.00125025.000000...19.00021.000025.00031.000037.000040.0000SummaryType.COLUMNNaNNaNNaN
Transaction Week909090900001.0000001.0000501.000000...0.0000.00000.0000.00000.00000.0000SummaryType.COLUMN0.00.0[FrequentItem(value='0.000000', est=909, upper...
Store Type909000090904.0000004.0002004.000000...NaNNaNNaNNaNNaNNaNSummaryType.COLUMNNaNNaN[FrequentItem(value='e-Shop', est=375, upper=3...
Product Category909000090906.0000006.0003006.000000...NaNNaNNaNNaNNaNNaNSummaryType.COLUMNNaNNaN[FrequentItem(value='Books', est=232, upper=23...
Gender909000090902.0000002.0001002.000000...NaNNaNNaNNaNNaNNaNSummaryType.COLUMNNaNNaN[FrequentItem(value='M', est=455, upper=455, l...
Transaction ID90900009090904.722898916.565225893.168643...NaNNaNNaNNaNNaNNaNSummaryType.COLUMNNaNNaN[FrequentItem(value='T40336799311', est=3, upp...
Item Price90900909000672.542875681.346093663.953801...7.10018.200043.20080.1000116.2000137.0000SummaryType.COLUMNNaNNaNNaN
Total Tax90900909000800.975225811.459552790.745935...0.8614.882510.01720.517036.172554.2640SummaryType.COLUMNNaNNaNNaN
Product Category Code909090900006.0000006.0003006.000000...1.0001.00002.0004.00005.00006.0000SummaryType.COLUMN6.01.0[FrequentItem(value='5.000000', est=232, upper...
Transaction Day of Week909090900001.0000001.0000501.000000...0.0000.00000.0000.00000.00000.0000SummaryType.COLUMN0.00.0[FrequentItem(value='0.000000', est=909, upper...
City Code9091090800010.00000010.00050010.000000...1.0001.00003.0005.00008.000010.0000SummaryType.COLUMNNaNNaNNaN
Transaction Batch909090900001.0000001.0000501.000000...0.0000.00000.0000.00000.00000.0000SummaryType.COLUMN0.00.0[FrequentItem(value='0.000000', est=909, upper...
Date of Birth90900009090801.978113812.475567791.736016...NaNNaNNaNNaNNaNNaNSummaryType.COLUMNNaNNaN[FrequentItem(value='1981-03-29', est=4, upper...
Customer ID90900009090847.420398858.512667836.597955...NaNNaNNaNNaNNaNNaNSummaryType.COLUMNNaNNaN[FrequentItem(value='C274278', est=4, upper=3,...
Total Amount90900909000842.098548853.121157831.344071...-767.97525.304582.433188.4025358.6830555.2625SummaryType.COLUMNNaNNaNNaN
Product Subcategory9090000909018.00000118.00089918.000000...NaNNaNNaNNaNNaNNaNSummaryType.COLUMNNaNNaN[FrequentItem(value='Women', est=133, upper=13...
Product Subcategory Code9090909000012.00000012.00059912.000000...1.0001.00003.0005.000010.000011.0000SummaryType.COLUMN12.01.0[FrequentItem(value='4.000000', est=148, upper...
\n", "

18 rows × 24 columns

\n", "
" ], "text/plain": [ " counts/n counts/null types/integral \\\n", "column \n", "Purchase Canceled 909 72 0 \n", "Age at Transaction Date 909 0 0 \n", "Transaction Week 909 0 909 \n", "Store Type 909 0 0 \n", "Product Category 909 0 0 \n", "Gender 909 0 0 \n", "Transaction ID 909 0 0 \n", "Item Price 909 0 0 \n", "Total Tax 909 0 0 \n", "Product Category Code 909 0 909 \n", "Transaction Day of Week 909 0 909 \n", "City Code 909 1 0 \n", "Transaction Batch 909 0 909 \n", "Date of Birth 909 0 0 \n", "Customer ID 909 0 0 \n", "Total Amount 909 0 0 \n", "Product Subcategory 909 0 0 \n", "Product Subcategory Code 909 0 909 \n", "\n", " types/fractional types/boolean types/string \\\n", "column \n", "Purchase Canceled 837 0 0 \n", "Age at Transaction Date 909 0 0 \n", "Transaction Week 0 0 0 \n", "Store Type 0 0 909 \n", "Product Category 0 0 909 \n", "Gender 0 0 909 \n", "Transaction ID 0 0 909 \n", "Item Price 909 0 0 \n", "Total Tax 909 0 0 \n", "Product Category Code 0 0 0 \n", "Transaction Day of Week 0 0 0 \n", "City Code 908 0 0 \n", "Transaction Batch 0 0 0 \n", "Date of Birth 0 0 909 \n", "Customer ID 0 0 909 \n", "Total Amount 909 0 0 \n", "Product Subcategory 0 0 909 \n", "Product Subcategory Code 0 0 0 \n", "\n", " types/object cardinality/est cardinality/upper_1 \\\n", "column \n", "Purchase Canceled 0 2.000000 2.000100 \n", "Age at Transaction Date 0 25.000001 25.001250 \n", "Transaction Week 0 1.000000 1.000050 \n", "Store Type 0 4.000000 4.000200 \n", "Product Category 0 6.000000 6.000300 \n", "Gender 0 2.000000 2.000100 \n", "Transaction ID 0 904.722898 916.565225 \n", "Item Price 0 672.542875 681.346093 \n", "Total Tax 0 800.975225 811.459552 \n", "Product Category Code 0 6.000000 6.000300 \n", "Transaction Day of Week 0 1.000000 1.000050 \n", "City Code 0 10.000000 10.000500 \n", "Transaction Batch 0 1.000000 1.000050 \n", "Date of Birth 0 801.978113 812.475567 \n", "Customer ID 0 847.420398 858.512667 \n", "Total Amount 0 842.098548 853.121157 \n", "Product Subcategory 0 18.000001 18.000899 \n", "Product Subcategory Code 0 12.000000 12.000599 \n", "\n", " cardinality/lower_1 ... distribution/min \\\n", "column ... \n", "Purchase Canceled 2.000000 ... 0.000 \n", "Age at Transaction Date 25.000000 ... 19.000 \n", "Transaction Week 1.000000 ... 0.000 \n", "Store Type 4.000000 ... NaN \n", "Product Category 6.000000 ... NaN \n", "Gender 2.000000 ... NaN \n", "Transaction ID 893.168643 ... NaN \n", "Item Price 663.953801 ... 7.100 \n", "Total Tax 790.745935 ... 0.861 \n", "Product Category Code 6.000000 ... 1.000 \n", "Transaction Day of Week 1.000000 ... 0.000 \n", "City Code 10.000000 ... 1.000 \n", "Transaction Batch 1.000000 ... 0.000 \n", "Date of Birth 791.736016 ... NaN \n", "Customer ID 836.597955 ... NaN \n", "Total Amount 831.344071 ... -767.975 \n", "Product Subcategory 18.000000 ... NaN \n", "Product Subcategory Code 12.000000 ... 1.000 \n", "\n", " distribution/q_10 distribution/q_25 \\\n", "column \n", "Purchase Canceled 0.0000 0.000 \n", "Age at Transaction Date 21.0000 25.000 \n", "Transaction Week 0.0000 0.000 \n", "Store Type NaN NaN \n", "Product Category NaN NaN \n", "Gender NaN NaN \n", "Transaction ID NaN NaN \n", "Item Price 18.2000 43.200 \n", "Total Tax 4.8825 10.017 \n", "Product Category Code 1.0000 2.000 \n", "Transaction Day of Week 0.0000 0.000 \n", "City Code 1.0000 3.000 \n", "Transaction Batch 0.0000 0.000 \n", "Date of Birth NaN NaN \n", "Customer ID NaN NaN \n", "Total Amount 25.3045 82.433 \n", "Product Subcategory NaN NaN \n", "Product Subcategory Code 1.0000 3.000 \n", "\n", " distribution/median distribution/q_75 \\\n", "column \n", "Purchase Canceled 0.0000 0.0000 \n", "Age at Transaction Date 31.0000 37.0000 \n", "Transaction Week 0.0000 0.0000 \n", "Store Type NaN NaN \n", "Product Category NaN NaN \n", "Gender NaN NaN \n", "Transaction ID NaN NaN \n", "Item Price 80.1000 116.2000 \n", "Total Tax 20.5170 36.1725 \n", "Product Category Code 4.0000 5.0000 \n", "Transaction Day of Week 0.0000 0.0000 \n", "City Code 5.0000 8.0000 \n", "Transaction Batch 0.0000 0.0000 \n", "Date of Birth NaN NaN \n", "Customer ID NaN NaN \n", "Total Amount 188.4025 358.6830 \n", "Product Subcategory NaN NaN \n", "Product Subcategory Code 5.0000 10.0000 \n", "\n", " distribution/q_90 type ints/max \\\n", "column \n", "Purchase Canceled 0.0000 SummaryType.COLUMN NaN \n", "Age at Transaction Date 40.0000 SummaryType.COLUMN NaN \n", "Transaction Week 0.0000 SummaryType.COLUMN 0.0 \n", "Store Type NaN SummaryType.COLUMN NaN \n", "Product Category NaN SummaryType.COLUMN NaN \n", "Gender NaN SummaryType.COLUMN NaN \n", "Transaction ID NaN SummaryType.COLUMN NaN \n", "Item Price 137.0000 SummaryType.COLUMN NaN \n", "Total Tax 54.2640 SummaryType.COLUMN NaN \n", "Product Category Code 6.0000 SummaryType.COLUMN 6.0 \n", "Transaction Day of Week 0.0000 SummaryType.COLUMN 0.0 \n", "City Code 10.0000 SummaryType.COLUMN NaN \n", "Transaction Batch 0.0000 SummaryType.COLUMN 0.0 \n", "Date of Birth NaN SummaryType.COLUMN NaN \n", "Customer ID NaN SummaryType.COLUMN NaN \n", "Total Amount 555.2625 SummaryType.COLUMN NaN \n", "Product Subcategory NaN SummaryType.COLUMN NaN \n", "Product Subcategory Code 11.0000 SummaryType.COLUMN 12.0 \n", "\n", " ints/min \\\n", "column \n", "Purchase Canceled NaN \n", "Age at Transaction Date NaN \n", "Transaction Week 0.0 \n", "Store Type NaN \n", "Product Category NaN \n", "Gender NaN \n", "Transaction ID NaN \n", "Item Price NaN \n", "Total Tax NaN \n", "Product Category Code 1.0 \n", "Transaction Day of Week 0.0 \n", "City Code NaN \n", "Transaction Batch 0.0 \n", "Date of Birth NaN \n", "Customer ID NaN \n", "Total Amount NaN \n", "Product Subcategory NaN \n", "Product Subcategory Code 1.0 \n", "\n", " frequent_items/frequent_strings \n", "column \n", "Purchase Canceled NaN \n", "Age at Transaction Date NaN \n", "Transaction Week [FrequentItem(value='0.000000', est=909, upper... \n", "Store Type [FrequentItem(value='e-Shop', est=375, upper=3... \n", "Product Category [FrequentItem(value='Books', est=232, upper=23... \n", "Gender [FrequentItem(value='M', est=455, upper=455, l... \n", "Transaction ID [FrequentItem(value='T40336799311', est=3, upp... \n", "Item Price NaN \n", "Total Tax NaN \n", "Product Category Code [FrequentItem(value='5.000000', est=232, upper... \n", "Transaction Day of Week [FrequentItem(value='0.000000', est=909, upper... \n", "City Code NaN \n", "Transaction Batch [FrequentItem(value='0.000000', est=909, upper... \n", "Date of Birth [FrequentItem(value='1981-03-29', est=4, upper... \n", "Customer ID [FrequentItem(value='C274278', est=4, upper=3,... \n", "Total Amount NaN \n", "Product Subcategory [FrequentItem(value='Women', est=133, upper=13... \n", "Product Subcategory Code [FrequentItem(value='4.000000', est=148, upper... \n", "\n", "[18 rows x 24 columns]" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Note run any of the examples above to get the results for this block\n", "\n", "#grab profile from result set\n", "profile = results.profile()\n", "\n", "#grab a 'view' of the profile for inspection\n", "prof_view = profile.view()\n", "\n", "#inspect profile as a Pandas DataFrame\n", "prof_df = prof_view.to_pandas()\n", "prof_df" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3.9.5 ('base')", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.5" }, "vscode": { "interpreter": { "hash": "8148c804a5838694570acf40aa3269caeebb6c584d51452dd558e946dfc16d39" } } }, "nbformat": 4, "nbformat_minor": 0 }