{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "d = {\n",
    "    'Account' : ['ABC', 'ABC', 'DEF', 'DEF'],\n",
    "    'Type' : ['DEP', 'WITH', 'BUY', 'SELL'],\n",
    "    'Value' : [100.98, -150.34, 200.02, -500.89],\n",
    "}\n",
    "\n",
    "test = pd.DataFrame(d)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "test['Account_Type'] = (test['Account'] + '_' + test['Type'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Account</th>\n",
       "      <th>Type</th>\n",
       "      <th>Value</th>\n",
       "      <th>Account_Type</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>ABC</td>\n",
       "      <td>DEP</td>\n",
       "      <td>100.98</td>\n",
       "      <td>ABC_DEP</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>ABC</td>\n",
       "      <td>WITH</td>\n",
       "      <td>-150.34</td>\n",
       "      <td>ABC_WITH</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>DEF</td>\n",
       "      <td>BUY</td>\n",
       "      <td>200.02</td>\n",
       "      <td>DEF_BUY</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>DEF</td>\n",
       "      <td>SELL</td>\n",
       "      <td>-500.89</td>\n",
       "      <td>DEF_SELL</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  Account  Type   Value Account_Type\n",
       "0     ABC   DEP  100.98      ABC_DEP\n",
       "1     ABC  WITH -150.34     ABC_WITH\n",
       "2     DEF   BUY  200.02      DEF_BUY\n",
       "3     DEF  SELL -500.89     DEF_SELL"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "test"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "test['Account_Value'] = (test['Account'] + '_' + test['Value'].astype(str))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Account</th>\n",
       "      <th>Type</th>\n",
       "      <th>Value</th>\n",
       "      <th>Account_Type</th>\n",
       "      <th>Account_Value</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>ABC</td>\n",
       "      <td>DEP</td>\n",
       "      <td>100.98</td>\n",
       "      <td>ABC_DEP</td>\n",
       "      <td>ABC_100.98</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>ABC</td>\n",
       "      <td>WITH</td>\n",
       "      <td>-150.34</td>\n",
       "      <td>ABC_WITH</td>\n",
       "      <td>ABC_-150.34</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>DEF</td>\n",
       "      <td>BUY</td>\n",
       "      <td>200.02</td>\n",
       "      <td>DEF_BUY</td>\n",
       "      <td>DEF_200.02</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>DEF</td>\n",
       "      <td>SELL</td>\n",
       "      <td>-500.89</td>\n",
       "      <td>DEF_SELL</td>\n",
       "      <td>DEF_-500.89</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  Account  Type   Value Account_Type Account_Value\n",
       "0     ABC   DEP  100.98      ABC_DEP    ABC_100.98\n",
       "1     ABC  WITH -150.34     ABC_WITH   ABC_-150.34\n",
       "2     DEF   BUY  200.02      DEF_BUY    DEF_200.02\n",
       "3     DEF  SELL -500.89     DEF_SELL   DEF_-500.89"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "test"
   ]
  },
  {
   "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.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
