mirror of
https://github.com/donnemartin/data-science-ipython-notebooks.git
synced 2024-03-22 13:30:56 +08:00
Cleaned up notebook.
This commit is contained in:
parent
83cf7b1278
commit
ad82bdeefc
|
@ -13,10 +13,8 @@
|
|||
"metadata": {},
|
||||
"source": [
|
||||
"# Pandas Cleaning\n",
|
||||
"* Clean\n",
|
||||
"* Transform\n",
|
||||
"* Merge\n",
|
||||
"* Reshape\n",
|
||||
"* Replace\n",
|
||||
"* Drop\n",
|
||||
"* Concatenate"
|
||||
]
|
||||
},
|
||||
|
@ -36,7 +34,7 @@
|
|||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Check for matching values in a specific column for replacement:"
|
||||
"Setup a DataFrame:"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -115,61 +113,11 @@
|
|||
"prompt_number": 2
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"collapsed": false,
|
||||
"input": [
|
||||
"df_1[df_1['state'] == 'VA']"
|
||||
],
|
||||
"language": "python",
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"html": [
|
||||
"<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
|
||||
"<table border=\"1\" class=\"dataframe\">\n",
|
||||
" <thead>\n",
|
||||
" <tr style=\"text-align: right;\">\n",
|
||||
" <th></th>\n",
|
||||
" <th>population</th>\n",
|
||||
" <th>state</th>\n",
|
||||
" <th>year</th>\n",
|
||||
" </tr>\n",
|
||||
" </thead>\n",
|
||||
" <tbody>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td> 5.0</td>\n",
|
||||
" <td> VA</td>\n",
|
||||
" <td> 2012</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>1</th>\n",
|
||||
" <td> 5.1</td>\n",
|
||||
" <td> VA</td>\n",
|
||||
" <td> 2013</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>2</th>\n",
|
||||
" <td> 5.2</td>\n",
|
||||
" <td> VA</td>\n",
|
||||
" <td> 2014</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
"</div>"
|
||||
],
|
||||
"metadata": {},
|
||||
"output_type": "pyout",
|
||||
"prompt_number": 3,
|
||||
"text": [
|
||||
" population state year\n",
|
||||
"0 5.0 VA 2012\n",
|
||||
"1 5.1 VA 2013\n",
|
||||
"2 5.2 VA 2014"
|
||||
]
|
||||
}
|
||||
],
|
||||
"prompt_number": 3
|
||||
"source": [
|
||||
"## Replace"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
|
@ -329,6 +277,13 @@
|
|||
],
|
||||
"prompt_number": 5
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Drop"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
|
@ -402,6 +357,13 @@
|
|||
],
|
||||
"prompt_number": 6
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Concatenate"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
|
|
Loading…
Reference in New Issue
Block a user