Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8006283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:27:40+00:00 2026-06-04T17:27:40+00:00

I would like to reshape the following numpy array in iPython: array([[1, 2, 3,

  • 0

I would like to reshape the following numpy array in iPython:

array([[1, 2, 3, 4],[5, 6, 7, 8],[9, 10, 11, 12]]) # Array A

to:

array([[1, 5, 9],[2, 6, 10],[3, 7, 11],[4, 8, 12]]) # Array B

The main task is to calculate the mean of the first elements of Array A (meaning the mean of 1,5,9), then the second elements, etc.

I thought the easiest way to do this is to reshape the array and afterwards calculating the mean of it.

Is there any way to do this without looping through the array via a for loop?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T17:27:41+00:00Added an answer on June 4, 2026 at 5:27 pm

    To do this kind of calculations you should use numpy.

    Assuming that a is your starting array:

    a.transpose()
    

    would do the trick

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use pcolor on a masked array. I would like masked elements
I would like to reshape the following list : wide_list = [[1,['a','b','c']],[2,['d','e']],[3,'f']] in a
I would like to store and load numpy arrays from binary files. For that
I have a 2D array t in numpy: >>> t = numpy.array(range(81)).reshape((9,9)) >>> t
I have a list of values and a 1-d numpy array, and I would
I would like to reshape a data frame of dimensions 103740 x 4 into
I have a file that I would like to reshape it to use R:
Suppose I make a 2d array like this: >>> A=np.arange(16).reshape((4,4)) >>> A array([[ 0,
I'd like to 'shear' a numpy array. I'm not sure I'm using the term
Would like to get step-by-step explanation of the following function in Haskell fibs =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.