Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a single solution to the 'rows with unequal values' exrecise #36

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions 100 Numpy exercises.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2150,12 +2150,7 @@
"\n",
"Z = np.random.randint(0,5,(10,3))\n",
"print(Z)\n",
"# solution for arrays of all dtypes (including string arrays and record arrays)\n",
"E = np.all(Z[:,1:] == Z[:,:-1], axis=1)\n",
"U = Z[~E]\n",
"print(U)\n",
"# soluiton for numerical arrays only, will work for any number of columns in Z\n",
"U = Z[Z.max(axis=1) != Z.min(axis=1),:]\n",
"U = Z[~(Z[:,0,None]==Z[:,1:]).all(axis=1)]\n",
"print(U)"
]
},
Expand Down
7 changes: 1 addition & 6 deletions 100 Numpy exercises.md
Original file line number Diff line number Diff line change
Expand Up @@ -1109,12 +1109,7 @@ print(rows)

Z = np.random.randint(0,5,(10,3))
print(Z)
# solution for arrays of all dtypes (including string arrays and record arrays)
E = np.all(Z[:,1:] == Z[:,:-1], axis=1)
U = Z[~E]
print(U)
# soluiton for numerical arrays only, will work for any number of columns in Z
U = Z[Z.max(axis=1) != Z.min(axis=1),:]
U = Z[~(Z[:,0,None]==Z[:,1:]).all(axis=1)]
print(U)
```

Expand Down