{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"mycsv = pd.read_csv('topologies_desc.csv', encoding = \"ISO-8859-1\")"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'Proportion Sample'"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"mycsv[mycsv.columns[0]][0]"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'10%'"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"mycsv['Ambitious Strivers'][0]"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
"mycsv = mycsv.dropna(axis=1, how='all')"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['Column1',\n",
" 'Ambitious Strivers',\n",
" 'Comfortable Altruistic',\n",
" 'Retired and liquid',\n",
" 'Living for Today',\n",
" 'Struggling Families',\n",
" 'High Wealth',\n",
" 'Money Managers',\n",
" 'Digital Pioneers',\n",
" 'Ultra High Wealth',\n",
" 'Unnamed: 10']"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"list(mycsv.columns).drop()"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['Column1',\n",
" 'Ambitious Strivers',\n",
" 'Comfortable Altruistic',\n",
" 'Retired and liquid',\n",
" 'Living for Today',\n",
" 'Struggling Families',\n",
" 'High Wealth',\n",
" 'Money Managers',\n",
" 'Digital Pioneers',\n",
" 'Ultra High Wealth']"
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"list(mycsv.columns)"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0 Proportion Sample\n",
"1 Description\n",
"2 Household Income\n",
"3 dropout %\n",
"4 Propensity to Buy\n",
"Name: Column1, dtype: object"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"mycsv['Column1']"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [],
"source": [
"df1 = mycsv.loc[:, mycsv.columns != 'Column1']"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Ambitious Strivers | \n",
" Comfortable Altruistic | \n",
" Retired and liquid | \n",
" Living for Today | \n",
" Struggling Families | \n",
" High Wealth | \n",
" Money Managers | \n",
" Digital Pioneers | \n",
" Ultra High Wealth | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" 10% | \n",
" 10% | \n",
" 18% | \n",
" 17% | \n",
" 18% | \n",
" 8% | \n",
" 11% | \n",
" 6% | \n",
" 2% | \n",
"
\n",
" \n",
" 1 | \n",
" Young ambitous professionals, mostly men, work... | \n",
" More to life than money; socially responsible;... | \n",
" Over 55, active pensioners, treat themselve to... | \n",
" Between 18 and 34 years old, independant, acce... | \n",
" Between the ages of 21 and 40 years old. In ma... | \n",
" Over 40 years old, independent, city dweling, ... | \n",
" Couples who enjoy managing their money, active... | \n",
" 22- 35, Love exploring new ways to make money ... | \n",
" Extremely high net worth from inheritied money... | \n",
"
\n",
" \n",
" 2 | \n",
" £42K | \n",
" £64k | \n",
" £55K | \n",
" £24k | \n",
" £32K | \n",
" 150k | \n",
" £55k | \n",
" £32K | \n",
" £750K+ | \n",
"
\n",
" \n",
" 3 | \n",
" NaN | \n",
" 2% | \n",
" NaN | \n",
" NaN | \n",
" NaN | \n",
" NaN | \n",
" NaN | \n",
" NaN | \n",
" 10% | \n",
"
\n",
" \n",
" 4 | \n",
" 1.4 | \n",
" 1.2 | \n",
" 0.7 | \n",
" 0.5 | \n",
" 0.5 | \n",
" 0.9 | \n",
" 0.4 | \n",
" 1.2 | \n",
" 0.8 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Ambitious Strivers \n",
"0 10% \\\n",
"1 Young ambitous professionals, mostly men, work... \n",
"2 £42K \n",
"3 NaN \n",
"4 1.4 \n",
"\n",
" Comfortable Altruistic \n",
"0 10% \\\n",
"1 More to life than money; socially responsible;... \n",
"2 £64k \n",
"3 2% \n",
"4 1.2 \n",
"\n",
" Retired and liquid \n",
"0 18% \\\n",
"1 Over 55, active pensioners, treat themselve to... \n",
"2 £55K \n",
"3 NaN \n",
"4 0.7 \n",
"\n",
" Living for Today \n",
"0 17% \\\n",
"1 Between 18 and 34 years old, independant, acce... \n",
"2 £24k \n",
"3 NaN \n",
"4 0.5 \n",
"\n",
" Struggling Families \n",
"0 18% \\\n",
"1 Between the ages of 21 and 40 years old. In ma... \n",
"2 £32K \n",
"3 NaN \n",
"4 0.5 \n",
"\n",
" High Wealth \n",
"0 8% \\\n",
"1 Over 40 years old, independent, city dweling, ... \n",
"2 150k \n",
"3 NaN \n",
"4 0.9 \n",
"\n",
" Money Managers \n",
"0 11% \\\n",
"1 Couples who enjoy managing their money, active... \n",
"2 £55k \n",
"3 NaN \n",
"4 0.4 \n",
"\n",
" Digital Pioneers \n",
"0 6% \\\n",
"1 22- 35, Love exploring new ways to make money ... \n",
"2 £32K \n",
"3 NaN \n",
"4 1.2 \n",
"\n",
" Ultra High Wealth \n",
"0 2% \n",
"1 Extremely high net worth from inheritied money... \n",
"2 £750K+ \n",
"3 10% \n",
"4 0.8 "
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df1"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [],
"source": [
"list(mycsv.columns).remove('Column1')"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Column1 | \n",
" Ambitious Strivers | \n",
" Comfortable Altruistic | \n",
" Retired and liquid | \n",
" Living for Today | \n",
" Struggling Families | \n",
" High Wealth | \n",
" Money Managers | \n",
" Digital Pioneers | \n",
" Ultra High Wealth | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" Proportion Sample | \n",
" 10% | \n",
" 10% | \n",
" 18% | \n",
" 17% | \n",
" 18% | \n",
" 8% | \n",
" 11% | \n",
" 6% | \n",
" 2% | \n",
"
\n",
" \n",
" 1 | \n",
" Description | \n",
" Young ambitous professionals, mostly men, work... | \n",
" More to life than money; socially responsible;... | \n",
" Over 55, active pensioners, treat themselve to... | \n",
" Between 18 and 34 years old, independant, acce... | \n",
" Between the ages of 21 and 40 years old. In ma... | \n",
" Over 40 years old, independent, city dweling, ... | \n",
" Couples who enjoy managing their money, active... | \n",
" 22- 35, Love exploring new ways to make money ... | \n",
" Extremely high net worth from inheritied money... | \n",
"
\n",
" \n",
" 2 | \n",
" Household Income | \n",
" £42K | \n",
" £64k | \n",
" £55K | \n",
" £24k | \n",
" £32K | \n",
" 150k | \n",
" £55k | \n",
" £32K | \n",
" £750K+ | \n",
"
\n",
" \n",
" 3 | \n",
" dropout % | \n",
" NaN | \n",
" 2% | \n",
" NaN | \n",
" NaN | \n",
" NaN | \n",
" NaN | \n",
" NaN | \n",
" NaN | \n",
" 10% | \n",
"
\n",
" \n",
" 4 | \n",
" Propensity to Buy | \n",
" 1.4 | \n",
" 1.2 | \n",
" 0.7 | \n",
" 0.5 | \n",
" 0.5 | \n",
" 0.9 | \n",
" 0.4 | \n",
" 1.2 | \n",
" 0.8 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Column1 Ambitious Strivers \n",
"0 Proportion Sample 10% \\\n",
"1 Description Young ambitous professionals, mostly men, work... \n",
"2 Household Income £42K \n",
"3 dropout % NaN \n",
"4 Propensity to Buy 1.4 \n",
"\n",
" Comfortable Altruistic \n",
"0 10% \\\n",
"1 More to life than money; socially responsible;... \n",
"2 £64k \n",
"3 2% \n",
"4 1.2 \n",
"\n",
" Retired and liquid \n",
"0 18% \\\n",
"1 Over 55, active pensioners, treat themselve to... \n",
"2 £55K \n",
"3 NaN \n",
"4 0.7 \n",
"\n",
" Living for Today \n",
"0 17% \\\n",
"1 Between 18 and 34 years old, independant, acce... \n",
"2 £24k \n",
"3 NaN \n",
"4 0.5 \n",
"\n",
" Struggling Families \n",
"0 18% \\\n",
"1 Between the ages of 21 and 40 years old. In ma... \n",
"2 £32K \n",
"3 NaN \n",
"4 0.5 \n",
"\n",
" High Wealth \n",
"0 8% \\\n",
"1 Over 40 years old, independent, city dweling, ... \n",
"2 150k \n",
"3 NaN \n",
"4 0.9 \n",
"\n",
" Money Managers \n",
"0 11% \\\n",
"1 Couples who enjoy managing their money, active... \n",
"2 £55k \n",
"3 NaN \n",
"4 0.4 \n",
"\n",
" Digital Pioneers \n",
"0 6% \\\n",
"1 22- 35, Love exploring new ways to make money ... \n",
"2 £32K \n",
"3 NaN \n",
"4 1.2 \n",
"\n",
" Ultra High Wealth \n",
"0 2% \n",
"1 Extremely high net worth from inheritied money... \n",
"2 £750K+ \n",
"3 10% \n",
"4 0.8 "
]
},
"execution_count": 30,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"mycsv"
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'Young ambitous professionals, mostly men, work hard play attitude, competitive with peers and treat themselves to expensive things, Independent, enjoy using the internet, searching for the best deal, not always brand loyal, look for the best solution case by case, want to be recognised for their achievements'"
]
},
"execution_count": 36,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"mycsv['Ambitious Strivers'][pd.Index(mycsv['Column1']).get_loc('Description')]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"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.10.11"
}
},
"nbformat": 4,
"nbformat_minor": 2
}