Skip to content

Commit

Permalink
faster index removal from another dataframe
Browse files Browse the repository at this point in the history
  • Loading branch information
marksibrahim committed Sep 19, 2018
1 parent cf91ae2 commit 0073fba
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions modern-pandas/modern-pandas.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -14,7 +14,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -23,7 +23,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -65,7 +65,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -608,7 +608,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 5,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -719,7 +719,7 @@
"[2395 rows x 14 columns]"
]
},
"execution_count": 7,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -728,9 +728,7 @@
"bad_flights = flights[flights[\"cancelled\"] == 0]\n",
"\n",
"# use index.difference method\n",
"good_indices = flights.index.difference(bad_flights.index)\n",
"\n",
"flights.loc[good_indices]"
"flights.drop(bad_flights.index, axis=0)"
]
},
{
Expand Down

0 comments on commit 0073fba

Please sign in to comment.