visto pandas en clase

parent 83f4fa57
......@@ -1221,7 +1221,7 @@
},
{
"cell_type": "code",
"execution_count": 51,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
......@@ -1231,17 +1231,17 @@
},
{
"cell_type": "code",
"execution_count": 52,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"d = {'one': pd.Series([1., 2., 3.], index=['a', 'b', 'c']),\n",
" 'two': pd.Series([1., 2., 3., 4.], index=['a', 'b', 'c', 'd'])}"
" 'two': pd.Series([1., 2., 3., 4.], index=['a', 'x', 'c', 'd'])}"
]
},
{
"cell_type": "code",
"execution_count": 53,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
......@@ -1250,7 +1250,7 @@
},
{
"cell_type": "code",
"execution_count": 54,
"execution_count": 7,
"metadata": {},
"outputs": [
{
......@@ -1287,7 +1287,7 @@
" <tr>\n",
" <th>b</th>\n",
" <td>2.0</td>\n",
" <td>2.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>c</th>\n",
......@@ -1299,6 +1299,11 @@
" <td>NaN</td>\n",
" <td>4.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>x</th>\n",
" <td>NaN</td>\n",
" <td>2.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
......@@ -1306,12 +1311,13 @@
"text/plain": [
" one two\n",
"a 1.0 1.0\n",
"b 2.0 2.0\n",
"b 2.0 NaN\n",
"c 3.0 3.0\n",
"d NaN 4.0"
"d NaN 4.0\n",
"x NaN 2.0"
]
},
"execution_count": 54,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
......@@ -1329,7 +1335,7 @@
},
{
"cell_type": "code",
"execution_count": 55,
"execution_count": 10,
"metadata": {},
"outputs": [
{
......@@ -1339,10 +1345,11 @@
"b 2.0\n",
"c 3.0\n",
"d NaN\n",
"x NaN\n",
"Name: one, dtype: float64"
]
},
"execution_count": 55,
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
......@@ -1353,7 +1360,7 @@
},
{
"cell_type": "code",
"execution_count": 56,
"execution_count": 11,
"metadata": {},
"outputs": [
{
......@@ -1394,8 +1401,8 @@
" <tr>\n",
" <th>b</th>\n",
" <td>2.0</td>\n",
" <td>2.0</td>\n",
" <td>4.0</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>False</td>\n",
" </tr>\n",
" <tr>\n",
......@@ -1412,6 +1419,13 @@
" <td>NaN</td>\n",
" <td>False</td>\n",
" </tr>\n",
" <tr>\n",
" <th>x</th>\n",
" <td>NaN</td>\n",
" <td>2.0</td>\n",
" <td>NaN</td>\n",
" <td>False</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
......@@ -1419,12 +1433,13 @@
"text/plain": [
" one two three flag\n",
"a 1.0 1.0 1.0 False\n",
"b 2.0 2.0 4.0 False\n",
"b 2.0 NaN NaN False\n",
"c 3.0 3.0 9.0 True\n",
"d NaN 4.0 NaN False"
"d NaN 4.0 NaN False\n",
"x NaN 2.0 NaN False"
]
},
"execution_count": 56,
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
......@@ -1437,7 +1452,7 @@
},
{
"cell_type": "code",
"execution_count": 57,
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
......@@ -1446,7 +1461,7 @@
},
{
"cell_type": "code",
"execution_count": 58,
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
......@@ -1455,7 +1470,7 @@
},
{
"cell_type": "code",
"execution_count": 59,
"execution_count": 14,
"metadata": {},
"outputs": [
{
......@@ -1504,6 +1519,11 @@
" <td>NaN</td>\n",
" <td>False</td>\n",
" </tr>\n",
" <tr>\n",
" <th>x</th>\n",
" <td>NaN</td>\n",
" <td>False</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
......@@ -1513,10 +1533,11 @@
"a 1.0 False\n",
"b 2.0 False\n",
"c 3.0 True\n",
"d NaN False"
"d NaN False\n",
"x NaN False"
]
},
"execution_count": 59,
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
......@@ -1527,7 +1548,7 @@
},
{
"cell_type": "code",
"execution_count": 60,
"execution_count": 16,
"metadata": {},
"outputs": [
{
......@@ -1552,6 +1573,7 @@
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>one</th>\n",
" <th>two</th>\n",
" <th>three</th>\n",
" <th>flag</th>\n",
" </tr>\n",
......@@ -1561,24 +1583,35 @@
" <th>a</th>\n",
" <td>1.0</td>\n",
" <td>1.0</td>\n",
" <td>1.0</td>\n",
" <td>False</td>\n",
" </tr>\n",
" <tr>\n",
" <th>b</th>\n",
" <td>2.0</td>\n",
" <td>4.0</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>False</td>\n",
" </tr>\n",
" <tr>\n",
" <th>c</th>\n",
" <td>3.0</td>\n",
" <td>9.0</td>\n",
" <td>9.0</td>\n",
" <td>True</td>\n",
" </tr>\n",
" <tr>\n",
" <th>d</th>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>False</td>\n",
" </tr>\n",
" <tr>\n",
" <th>x</th>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>False</td>\n",
" </tr>\n",
" </tbody>\n",
......@@ -1586,20 +1619,22 @@
"</div>"
],
"text/plain": [
" one three flag\n",
"a 1.0 1.0 False\n",
"b 2.0 4.0 False\n",
"c 3.0 9.0 True\n",
"d NaN NaN False"
" one two three flag\n",
"a 1.0 1.0 1.0 False\n",
"b 2.0 NaN NaN False\n",
"c 3.0 9.0 9.0 True\n",
"d NaN NaN NaN False\n",
"x NaN NaN NaN False"
]
},
"execution_count": 60,
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.insert(1, \"three\", three)\n",
"# inserta la columna three en la posición 1 bajo el nombre two\n",
"df.insert(1, \"two\", three)\n",
"df"
]
},
......@@ -1964,7 +1999,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.3"
"version": "3.7.1"
}
},
"nbformat": 4,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment