Reshaping & Indexing NumPy Arrays - Learn NumPy Series

Reshaping & Indexing NumPy Arrays - Learn NumPy Series


Full Code From This Example:

YouTube Description:

This Video is a part of a NumPy Tutorial Series: Start the entire series here: We're continuing on in our NumPy series by talking about how to reshape and index numpy arrays. We'll talk about reshaping using the reshape method and .T transposes We'll also talk about how to select a row, column, and specific value from a numpy array using indexing. Thanks for all the support! Almost to 5k subscribers. Insanely awesome. Thank you for all the kind words! Join The Socials -- Picking Shoutouts Across YouTube, Insta, FB, and Twitter! FB - Insta - Twitter - LinkedIn - GitHub - ***************************************************************** Full code from the video: import numpy as np #Create simple array array_a = np.array([[1,2,3],[4,5,6]]) print(array_a.shape) # New Attribute Array Size print(array_a.size) # Number of Rows times Number of Columns # Reshape Array array_b = array_a.reshape(3,2) print(array_b) print(array_b.shape) #transpose array_a array_c = array_a.T print(array_c) print(array_c.shape) # Access Row print(array_c[0]) # Access Columns print(array_c[:,0]) # Access Specific Values print(array_c[1,1]) Packages (& Versions) used in this video: Python 3.7 NumPy 1.17 ***************************************************************** Code from this tutorial and all my others can be found on my GitHub: Check out my website: If you liked the video - please hit the like button. It means more than you know. Thanks for watching and thank you for all your support!! Always looking for suggestions on what video to make next -- leave me a comment with your project! Happy Coding!

Enjoy this content? Consider Subbing to the Youtube channel

Derrick Sherrill

By: Derrick Sherrill

Thanks for visiting my page! I'm working hard to make the best content I can for you. I love watching people learn and teaching others. Happy Coding!

Become a Patreon!