-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Create argmin.md #6534
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
base: main
Are you sure you want to change the base?
Create argmin.md #6534
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey Captain-Arnab@, thank you for contributing to Codecademy Docs, the entry is nicely written! 😄
I've suggested a few changes, could you please review and modify those at your earliest convenience? Thank you! 😃
Title: '.argmin()' | ||
Description: 'Finds the index of the minimum value in a NumPy array or along a specified axis.' | ||
|
||
Subjects: | ||
- 'Computer Science' | ||
- 'Data Science' | ||
Tags: | ||
- 'Data Structures' | ||
- 'Arrays' | ||
- 'Functions' | ||
- 'NumPy' | ||
CatalogContent: | ||
- 'learn-python-3' | ||
- 'paths/data-science' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Title: '.argmin()' | |
Description: 'Finds the index of the minimum value in a NumPy array or along a specified axis.' | |
Subjects: | |
- 'Computer Science' | |
- 'Data Science' | |
Tags: | |
- 'Data Structures' | |
- 'Arrays' | |
- 'Functions' | |
- 'NumPy' | |
CatalogContent: | |
- 'learn-python-3' | |
- 'paths/data-science' | |
Title: '.argmin()' | |
Description: 'Finds the index of the minimum value in a NumPy array, either across the entire array or along a specified axis.' | |
Subjects: | |
- 'Computer Science' | |
- 'Data Science' | |
Tags: | |
- 'Arrays' | |
- 'Data Structures' | |
- 'Functions' | |
- 'NumPy' | |
CatalogContent: | |
- 'learn-python-3' | |
- 'paths/data-science' |
- 'paths/data-science' | ||
--- | ||
|
||
The **`.argmin()`** function in NumPy identifies the index of the smallest value in an array. When working with multi-dimensional arrays, it can also return the index position along a specified axis. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The **`.argmin()`** function in NumPy identifies the index of the smallest value in an array. When working with multi-dimensional arrays, it can also return the index position along a specified axis. | |
The **`.argmin()`** function in NumPy is used to find the index of the smallest value in a NumPy array. It works on both 1D and multi-dimensional arrays, and when an axis is specified, it returns the index of the minimum value along that axis. | |
This function is commonly used in data analysis and numerical computations to quickly locate the position of the lowest value in an array. |
- `a`: (Required) The input array containing values to evaluate. | ||
- `axis`: (Optional) The axis along which to find the minimum. If not provided, the array is flattened before computation. | ||
- `out`: (Optional) An alternative array to store the result. It must be the correct shape. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- `a`: (Required) The input array containing values to evaluate. | |
- `axis`: (Optional) The axis along which to find the minimum. If not provided, the array is flattened before computation. | |
- `out`: (Optional) An alternative array to store the result. It must be the correct shape. | |
- `a`: The input array containing values to evaluate. | |
- `axis` (Optional): The axis along which to find the index of the minimum value. If not specified, the array is flattened and the index of the global minimum is returned. | |
- `out` (Optional): An alternative array to store the result. It must have the appropriate shape and data type. |
## Syntax | ||
|
||
```pseudo | ||
numpy.argmin(a, axis=None, out=None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
numpy.argmin(a, axis=None, out=None) | |
numpy.argmin(a, axis=None, out=None, keepdims=<no value>) |
|
||
Below is an example of using `.argmin()` on a 2-dimensional array to find index positions of minimum values: | ||
|
||
```python |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
```python | |
```py |
print(np.argmin(arr, axis=1)) # Minimum indices along rows | ||
``` | ||
|
||
**Output:** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
**Output:** | |
This code produces the output as follows: | |
|
||
## Codebyte Example | ||
|
||
In this Codebyte, we generate a 2D array with random integers and use `.argmin()` in different contexts: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
avoid using pronouns
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure will do the changes
Description
Issue Solved
Type of Change
Checklist
main
branch.Issues Solved
section.