Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ea5b3c9

Browse files
committed
Add another example to filter and separate data
1 parent 23114dd commit ea5b3c9

File tree

1 file changed

+100
-2
lines changed

1 file changed

+100
-2
lines changed

‎pandas/pandas_Foundations/Exploratory_Data_Analysis.ipynb

Lines changed: 100 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -975,6 +975,104 @@
975975
"cell_type": "code",
976976
"execution_count": 24,
977977
"metadata": {},
978+
"outputs": [
979+
{
980+
"data": {
981+
"text/html": [
982+
"<div>\n",
983+
"<style scoped>\n",
984+
" .dataframe tbody tr th:only-of-type {\n",
985+
" vertical-align: middle;\n",
986+
" }\n",
987+
"\n",
988+
" .dataframe tbody tr th {\n",
989+
" vertical-align: top;\n",
990+
" }\n",
991+
"\n",
992+
" .dataframe thead th {\n",
993+
" text-align: right;\n",
994+
" }\n",
995+
"</style>\n",
996+
"<table border=\"1\" class=\"dataframe\">\n",
997+
" <thead>\n",
998+
" <tr style=\"text-align: right;\">\n",
999+
" <th></th>\n",
1000+
" <th>sepal_length</th>\n",
1001+
" <th>sepal_width</th>\n",
1002+
" <th>petal_length</th>\n",
1003+
" <th>petal_width</th>\n",
1004+
" <th>species</th>\n",
1005+
" </tr>\n",
1006+
" </thead>\n",
1007+
" <tbody>\n",
1008+
" <tr>\n",
1009+
" <th>0</th>\n",
1010+
" <td>5.1</td>\n",
1011+
" <td>3.5</td>\n",
1012+
" <td>1.4</td>\n",
1013+
" <td>0.2</td>\n",
1014+
" <td>setosa</td>\n",
1015+
" </tr>\n",
1016+
" <tr>\n",
1017+
" <th>1</th>\n",
1018+
" <td>4.9</td>\n",
1019+
" <td>3.0</td>\n",
1020+
" <td>1.4</td>\n",
1021+
" <td>0.2</td>\n",
1022+
" <td>setosa</td>\n",
1023+
" </tr>\n",
1024+
" <tr>\n",
1025+
" <th>2</th>\n",
1026+
" <td>4.7</td>\n",
1027+
" <td>3.2</td>\n",
1028+
" <td>1.3</td>\n",
1029+
" <td>0.2</td>\n",
1030+
" <td>setosa</td>\n",
1031+
" </tr>\n",
1032+
" <tr>\n",
1033+
" <th>3</th>\n",
1034+
" <td>4.6</td>\n",
1035+
" <td>3.1</td>\n",
1036+
" <td>1.5</td>\n",
1037+
" <td>0.2</td>\n",
1038+
" <td>setosa</td>\n",
1039+
" </tr>\n",
1040+
" <tr>\n",
1041+
" <th>4</th>\n",
1042+
" <td>5.0</td>\n",
1043+
" <td>3.6</td>\n",
1044+
" <td>1.4</td>\n",
1045+
" <td>0.2</td>\n",
1046+
" <td>setosa</td>\n",
1047+
" </tr>\n",
1048+
" </tbody>\n",
1049+
"</table>\n",
1050+
"</div>"
1051+
],
1052+
"text/plain": [
1053+
" sepal_length sepal_width petal_length petal_width species\n",
1054+
"0 5.1 3.5 1.4 0.2 setosa\n",
1055+
"1 4.9 3.0 1.4 0.2 setosa\n",
1056+
"2 4.7 3.2 1.3 0.2 setosa\n",
1057+
"3 4.6 3.1 1.5 0.2 setosa\n",
1058+
"4 5.0 3.6 1.4 0.2 setosa"
1059+
]
1060+
},
1061+
"execution_count": 24,
1062+
"metadata": {},
1063+
"output_type": "execute_result"
1064+
}
1065+
],
1066+
"source": [
1067+
"# Another way to filter and separate data\n",
1068+
"setosa2 = df[df['species'] == 'setosa']\n",
1069+
"setosa2.head()"
1070+
]
1071+
},
1072+
{
1073+
"cell_type": "code",
1074+
"execution_count": 25,
1075+
"metadata": {},
9781076
"outputs": [],
9791077
"source": [
9801078
"# Since we have only 'setosa' species within the setosa DataFrame, we can delete the now redundant species column\n",
@@ -990,7 +1088,7 @@
9901088
},
9911089
{
9921090
"cell_type": "code",
993-
"execution_count": 25,
1091+
"execution_count": 26,
9941092
"metadata": {},
9951093
"outputs": [
9961094
{
@@ -1022,7 +1120,7 @@
10221120
},
10231121
{
10241122
"cell_type": "code",
1025-
"execution_count": 26,
1123+
"execution_count": 27,
10261124
"metadata": {},
10271125
"outputs": [
10281126
{

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /