diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..52b0c49 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +tableau_lab.csv +tableau_lab.xlsx diff --git a/lab_tableau.ipynb b/lab_tableau.ipynb new file mode 100644 index 0000000..c7d8eb2 --- /dev/null +++ b/lab_tableau.ipynb @@ -0,0 +1,285 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 5, + "id": "6f66f9dc", + "metadata": {}, + "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", + "
CustomerStateCustomer Lifetime ValueResponseCoverageEducationEffective To DateEmploymentStatusGenderIncome...Months Since Policy InceptionNumber of Open ComplaintsNumber of PoliciesPolicy TypePolicyRenew Offer TypeSales ChannelTotal Claim AmountVehicle ClassVehicle Size
0BU79786Washington2763.519279NoBasicBachelor2/24/11EmployedF56274...501Corporate AutoCorporate L3Offer1Agent384.811147Two-Door CarMedsize
1QZ44356Arizona6979.535903NoExtendedBachelor1/31/11UnemployedF0...4208Personal AutoPersonal L3Offer3Agent1131.464935Four-Door CarMedsize
2AI49188Nevada12887.431650NoPremiumBachelor2/19/11EmployedF48767...3802Personal AutoPersonal L3Offer1Agent566.472247Two-Door CarMedsize
3WW63253California7645.861827NoBasicBachelor1/20/11UnemployedM0...6507Corporate AutoCorporate L2Offer1Call Center529.881344SUVMedsize
4HB64268Washington2813.692575NoBasicBachelor2/3/11EmployedM43836...4401Personal AutoPersonal L1Offer1Agent138.130879Four-Door CarMedsize
\n", + "

5 rows × 24 columns

\n", + "
" + ], + "text/plain": [ + " Customer State Customer Lifetime Value Response Coverage Education \\\n", + "0 BU79786 Washington 2763.519279 No Basic Bachelor \n", + "1 QZ44356 Arizona 6979.535903 No Extended Bachelor \n", + "2 AI49188 Nevada 12887.431650 No Premium Bachelor \n", + "3 WW63253 California 7645.861827 No Basic Bachelor \n", + "4 HB64268 Washington 2813.692575 No Basic Bachelor \n", + "\n", + " Effective To Date EmploymentStatus Gender Income ... \\\n", + "0 2/24/11 Employed F 56274 ... \n", + "1 1/31/11 Unemployed F 0 ... \n", + "2 2/19/11 Employed F 48767 ... \n", + "3 1/20/11 Unemployed M 0 ... \n", + "4 2/3/11 Employed M 43836 ... \n", + "\n", + " Months Since Policy Inception Number of Open Complaints Number of Policies \\\n", + "0 5 0 1 \n", + "1 42 0 8 \n", + "2 38 0 2 \n", + "3 65 0 7 \n", + "4 44 0 1 \n", + "\n", + " Policy Type Policy Renew Offer Type Sales Channel \\\n", + "0 Corporate Auto Corporate L3 Offer1 Agent \n", + "1 Personal Auto Personal L3 Offer3 Agent \n", + "2 Personal Auto Personal L3 Offer1 Agent \n", + "3 Corporate Auto Corporate L2 Offer1 Call Center \n", + "4 Personal Auto Personal L1 Offer1 Agent \n", + "\n", + " Total Claim Amount Vehicle Class Vehicle Size \n", + "0 384.811147 Two-Door Car Medsize \n", + "1 1131.464935 Four-Door Car Medsize \n", + "2 566.472247 Two-Door Car Medsize \n", + "3 529.881344 SUV Medsize \n", + "4 138.130879 Four-Door Car Medsize \n", + "\n", + "[5 rows x 24 columns]" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import pandas as pd\n", + "\n", + "df=pd.read_csv('https://raw.githubusercontent.com/data-bootcamp-v4/data/main/we_fn_use_c_marketing_customer_value_analysis.csv')\n", + "df.head()" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "d8e505bb", + "metadata": {}, + "outputs": [], + "source": [ + "df.to_csv('tableau_lab.csv', index=False, encoding='utf-8', sep=',', quotechar='\"', lineterminator='\\n')\n", + "df.isnull().sum()\n", + "df.to_excel('tableau_lab.xlsx')" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "432b97c0", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array(['Suburban', 'Rural', 'Urban'], dtype=object)" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df['Location Code'].unique()" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "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.13.2" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/tableau.twbx b/tableau.twbx new file mode 100644 index 0000000..45aac9c Binary files /dev/null and b/tableau.twbx differ