Skip to content

Instantly share code, notes, and snippets.

@snippsat
Created January 21, 2020 00:04
Show Gist options
  • Save snippsat/57e610fc1f9d1ec43a718540fa7e5f1c to your computer and use it in GitHub Desktop.
Save snippsat/57e610fc1f9d1ec43a718540fa7e5f1c to your computer and use it in GitHub Desktop.
{
"cells": [
{
"cell_type": "code",
"execution_count": 85,
"metadata": {},
"outputs": [],
"source": [
"''''\n",
"Jonathan Kessous 454517\n",
"Diunique Williams 950184\n",
"Aundre Price 989670\n",
"Larry Jackson 265408\n",
"Josie Djach 577911\n",
"'''\n",
"import pandas as pd\n",
"\n",
"df = pd.read_clipboard(names=[\"Name\", \"temp\", \"id\"])"
]
},
{
"cell_type": "code",
"execution_count": 97,
"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>Names</th>\n",
" <th>id</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Jonathan Kessous</td>\n",
" <td>454517</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Diunique Williams</td>\n",
" <td>950184</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Aundre Price</td>\n",
" <td>989670</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Larry Jackson</td>\n",
" <td>265408</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Josie Djach</td>\n",
" <td>577911</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Names id\n",
"0 Jonathan Kessous 454517\n",
"1 Diunique Williams 950184\n",
"2 Aundre Price 989670\n",
"3 Larry Jackson 265408\n",
"4 Josie Djach 577911"
]
},
"execution_count": 97,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df1 = pd.DataFrame(df['Name'] +' '+ df['temp'])\n",
"df2 = df1.assign(id=df['id'].values)\n",
"df2.columns = ['Names', 'id']\n",
"df2\n",
"#df2.to_excel(\"output.xlsx\", index=False) "
]
}
],
"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.3"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment