{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-12-24T17:41:41.902299Z",
     "start_time": "2019-12-24T17:41:40.774410Z"
    }
   },
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "pd.options.display.max_colwidth = 500"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-12-24T17:41:41.913664Z",
     "start_time": "2019-12-24T17:41:41.904256Z"
    }
   },
   "outputs": [],
   "source": [
    "df = pd.read_csv(r'examples/test.csv', sep='\\n', skiprows=[0], names=['Description'])\n",
    "\n",
    "df.index = list(range(1, 22))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-12-24T17:41:42.060477Z",
     "start_time": "2019-12-24T17:41:41.915659Z"
    }
   },
   "outputs": [],
   "source": [
    "def f1(x):\n",
    "    x = x.split(' ')\n",
    "    return x.pop(0)\n",
    "\n",
    "\n",
    "df['Argument'] = df['Description'].map(f1) # get the first word"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-12-24T17:41:42.218867Z",
     "start_time": "2019-12-24T17:41:42.066314Z"
    }
   },
   "outputs": [],
   "source": [
    "def f2(x):\n",
    "    x = x.split(' ')\n",
    "    return \" \".join(x[1:])\n",
    "\n",
    "df['Description'] = df['Description'].map(f2) # remove the first word"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-12-24T17:41:42.377774Z",
     "start_time": "2019-12-24T17:41:42.225841Z"
    }
   },
   "outputs": [],
   "source": [
    "df = df.reindex(columns=['Argument', 'Description'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-12-24T17:41:42.589564Z",
     "start_time": "2019-12-24T17:41:42.381000Z"
    }
   },
   "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>Argument</th>\n",
       "      <th>Description</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>path</td>\n",
       "      <td>String indicating filesystem location, URL, or file-like object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>sep</td>\n",
       "      <td>Character sequence or regular expression to use to split fields in each row</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>header</td>\n",
       "      <td>Row number to use as column names; defaults to 0 (first row), but should be None if there is no header row</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>index_col</td>\n",
       "      <td>Column numbers or names to use as the row index in the result; can be a single name/number or a list of them for a hierarchical index</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>names</td>\n",
       "      <td>List of column names for result, combine with header=None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>skiprows</td>\n",
       "      <td>Number of rows at beginning of file to ignore or list of row numbers (starting from 0) to skip.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>na_values</td>\n",
       "      <td>Sequence of values to replace with NA.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>comment</td>\n",
       "      <td>Character(s) to split comments off the end of lines.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>parse_dates</td>\n",
       "      <td>Attempt to parse data to datetime; False by default. If True, will attempt to parse all columns. Otherwise can specify a list of column numbers or name to parse. If element of list is tuple or list, will combine multiple columns together and parse to date (e.g., if date/time split across two columns).</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>keep_date_col</td>\n",
       "      <td>If joining columns to parse date, keep the joined columns; False by default.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>converters</td>\n",
       "      <td>Dict containing column number of name mapping to functions (e.g., {'foo': f} would apply the function f to all values in the 'foo' column).</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>dayfirst</td>\n",
       "      <td>When parsing potentially ambiguous dates, treat as international format (e.g., 7/6/2012 -&gt; June 7, 2012); False by default.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>date_parser</td>\n",
       "      <td>Function to use to parse dates.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>nrows</td>\n",
       "      <td>Number of rows to read from beginning of file.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>iterator</td>\n",
       "      <td>Return a TextParser object for reading file piecemeal.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>chunksize</td>\n",
       "      <td>For iteration, size of file chunks.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>skip_footer</td>\n",
       "      <td>Number of lines to ignore at end of file.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>verbose</td>\n",
       "      <td>Print various parser output information, like the number of missing values placed in non-numeric columns.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>encoding</td>\n",
       "      <td>Text encoding for Unicode (e.g., 'utf-8' for UTF-8 encoded text).</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>squeeze</td>\n",
       "      <td>If the parsed data only contains one column, return a Series.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>thousands</td>\n",
       "      <td>Separator for thousands (e.g., ',' or '.').</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         Argument  \\\n",
       "1            path   \n",
       "2             sep   \n",
       "3          header   \n",
       "4       index_col   \n",
       "5           names   \n",
       "6        skiprows   \n",
       "7       na_values   \n",
       "8         comment   \n",
       "9     parse_dates   \n",
       "10  keep_date_col   \n",
       "11     converters   \n",
       "12       dayfirst   \n",
       "13    date_parser   \n",
       "14          nrows   \n",
       "15       iterator   \n",
       "16      chunksize   \n",
       "17    skip_footer   \n",
       "18        verbose   \n",
       "19       encoding   \n",
       "20        squeeze   \n",
       "21      thousands   \n",
       "\n",
       "                                                                                                                                                                                                                                                                                                       Description  \n",
       "1                                                                                                                                                                                                                                                  String indicating filesystem location, URL, or file-like object  \n",
       "2                                                                                                                                                                                                                                      Character sequence or regular expression to use to split fields in each row  \n",
       "3                                                                                                                                                                                                       Row number to use as column names; defaults to 0 (first row), but should be None if there is no header row  \n",
       "4                                                                                                                                                                            Column numbers or names to use as the row index in the result; can be a single name/number or a list of them for a hierarchical index  \n",
       "5                                                                                                                                                                                                                                                        List of column names for result, combine with header=None  \n",
       "6                                                                                                                                                                                                                  Number of rows at beginning of file to ignore or list of row numbers (starting from 0) to skip.  \n",
       "7                                                                                                                                                                                                                                                                           Sequence of values to replace with NA.  \n",
       "8                                                                                                                                                                                                                                                             Character(s) to split comments off the end of lines.  \n",
       "9   Attempt to parse data to datetime; False by default. If True, will attempt to parse all columns. Otherwise can specify a list of column numbers or name to parse. If element of list is tuple or list, will combine multiple columns together and parse to date (e.g., if date/time split across two columns).  \n",
       "10                                                                                                                                                                                                                                    If joining columns to parse date, keep the joined columns; False by default.  \n",
       "11                                                                                                                                                                     Dict containing column number of name mapping to functions (e.g., {'foo': f} would apply the function f to all values in the 'foo' column).  \n",
       "12                                                                                                                                                                                     When parsing potentially ambiguous dates, treat as international format (e.g., 7/6/2012 -> June 7, 2012); False by default.  \n",
       "13                                                                                                                                                                                                                                                                                 Function to use to parse dates.  \n",
       "14                                                                                                                                                                                                                                                                  Number of rows to read from beginning of file.  \n",
       "15                                                                                                                                                                                                                                                          Return a TextParser object for reading file piecemeal.  \n",
       "16                                                                                                                                                                                                                                                                             For iteration, size of file chunks.  \n",
       "17                                                                                                                                                                                                                                                                       Number of lines to ignore at end of file.  \n",
       "18                                                                                                                                                                                                       Print various parser output information, like the number of missing values placed in non-numeric columns.  \n",
       "19                                                                                                                                                                                                                                               Text encoding for Unicode (e.g., 'utf-8' for UTF-8 encoded text).  \n",
       "20                                                                                                                                                                                                                                                   If the parsed data only contains one column, return a Series.  \n",
       "21                                                                                                                                                                                                                                                                     Separator for thousands (e.g., ',' or '.').  "
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  }
 ],
 "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.7.4"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}