{"nbformat": 4, "nbformat_minor": 1, "metadata": {"kernelspec": {"display_name": "Python 3", "name": "python3", "language": "python"}, "language_info": {"codemirror_mode": {"version": 3, "name": "ipython"}, "name": "python", "version": "3.6.3", "mimetype": "text/x-python", "nbconvert_exporter": "python", "file_extension": ".py", "pygments_lexer": "ipython3"}}, "cells": [{"outputs": [], "source": ["# This Python 3 environment comes with many helpful analytics libraries installed\n", "# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python\n", "# For example, here's several helpful packages to load in \n", "\n", "import numpy as np # linear algebra\n", "import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n", "\n", "# Input data files are available in the \"../input/\" directory.\n", "# For example, running this (by clicking run or pressing Shift+Enter) will list the files in the input directory\n", "\n", "from subprocess import check_output\n", "print(check_output([\"ls\", \"../input\"]).decode(\"utf8\"))\n", "\n", "# Any results you write to the current directory are saved as output."], "execution_count": null, "cell_type": "code", "metadata": {"_cell_guid": "0420de32-8386-44d8-b6d2-5145acc2304f", "_uuid": "1422f6d305487079696b5a781a10f922844e1fba"}}, {"outputs": [], "source": ["dfTrain=pd.read_csv(\"../input/train.csv\")\n", "print(dfTrain)\n", "\n"], "execution_count": null, "cell_type": "code", "metadata": {}}, {"outputs": [], "source": ["dfTrain.onpromotion.value_counts()"], "execution_count": null, "cell_type": "code", "metadata": {}}, {"outputs": [], "source": ["dfTrain.item_nbr.value_counts()"], "execution_count": null, "cell_type": "code", "metadata": {}}, {"outputs": [], "source": ["dfTest=pd.read_csv(\"../input/test.csv\")\n", "print(dfTest)"], "execution_count": null, "cell_type": "code", "metadata": {}}, {"outputs": [], "source": ["testItems= pd.unique(dfTest.item_nbr)\n", "print(testItems)\n", "trainItems= pd.unique(dfTrain.item_nbr)\n", "print(trainItems)\n"], "execution_count": null, "cell_type": "code", "metadata": {}}, {"outputs": [], "source": ["itemsTrainTest = set(testItems).intersection(set(trainItems))\n", "print(itemsTrainTest)\n"], "execution_count": null, "cell_type": "code", "metadata": {}}, {"outputs": [], "source": ["import pylab as plt\n", "from matplotlib_venn import venn2, venn3_circles"], "execution_count": null, "cell_type": "code", "metadata": {"collapsed": true}}, {"outputs": [], "source": ["v= venn2(subsets=(len(trainItems),len(itemsTrainTest),len(testItems)), set_labels = ('Train Dataset','Test Dataset'))\n", "v.get_patch_by_id('10').set_color('darkred')\n", "v.get_patch_by_id('01').set_color('yellow')\n", "v.get_patch_by_id('11').set_color('darkblue')\n"], "execution_count": null, "cell_type": "code", "metadata": {}}]}