Numpy python R eqivalent indexing

Numpy python R eqivalent indexing

It first flattens the row of each matrix

import numpy as np

o = np.array([

              [
              [1,2,3,4],
              [5,6,7,8]
              ],

              [
              [9,10,11,12],
              [13,14,15,16]
              ]

             ])
print(o.flatten())

# array([ 1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16])

It first flattens the row of each matrix

But I want that it flattens the coluumn of each matrix first so that it prints [1,5,2,6,3,7,4,8,9,13,10,14,11,15,12,16]

I tried searching and what I found was passing "F" as an argument but that gives [1,5,9,13,2,6,10,14,3,7,11,15,4,8,12,16] that is it switches to another matrix without completing first.

In short, I would like to find python equivalent of R's indexing with double brackets

someData <- rep(0, 2*3*4);

ar <- array(someData, c(2, 3, 4));
ar[1,1,1] = 1 ar[1,2,1] = 2 ar[1,3,1] = 3

ar[2,1,1] = 4 ar[2,2,1] = 5 ar[2,3,1] = 6

ar[1,1,2] = 7 ar[1,2,2] = 8 ar[1,3,2] = 9 print(ar[[1]]) # 1 print(ar[[2]]) # 4 print(ar[[3]]) # 2 print(ar[[4]]) # 5 print(ar[[5]]) # 3 print(ar[[6]]) # 6


Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Data Science Course in Dallas

Become a data analysis expert using the R programming language in this [data science](https://360digitmg.com/usa/data-science-using-python-and-r-programming-in-dallas "data science") certification training in Dallas, TX. You will master data...

Python For Data Science - How to use Data Science with Python

This Edureka video on 'Python For Data Science - How to use Data Science with Python - Data Science using Python ' will help you understand how we can use python for data science along with various use cases. What is Data Science? Why Python? Python Libraries For Data Science. Roadmap To Data Science With Python. Data Science Jobs and Salary Trends

Learn NumPy Fundamentals - Python Library for Data Science

All the basics to start using the Python library NumPy. In this course I'll cover the basics of using number and have several interactive course videos that will challenge you to learn how to use NumPy.