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

  • Home
  • SEARCH
  • 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 6707715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:40:21+00:00 2026-05-26T07:40:21+00:00

I am trying to relate the python/numpy indices of two arrays with different sizes,

  • 0

I am trying to relate the python/numpy indices of two arrays with different sizes, but I cannot pass index one from the small array to the large array through a subroutine.

For example, I have two numpy arrays: a1 and a2. a1.shape = (240,33,258) and a2.shape = (240,40,33,258). I am finding indices in a1 and relating these indices to a2. ie., index1 = numpy.where(a > n). I can grab the data that I an interested in using

dat1 = a1[index]
dat2 = a2[index[0],:,index[1],index[2]]

with the resulting dat shapes as dat1.shape = (n) and dat2.shape = (n, 40). To speed up the program, I want to pass the index through a subroutine, but I cannot pass [index[0],:,index[1],index[2]] through a subroutine because I cannot pass the colon ‘:’.

I believe my solution would be to pass the numerical equivalent to ‘:’ in the subroutine, but I have not found an answer.

Any help?

Thank you very much

  • 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-05-26T07:40:22+00:00Added an answer on May 26, 2026 at 7:40 am

    You should be able to use slice(None) to represent :. As in

    [index[0], slice(None), index[1], index[2]]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to call a Java program (Stanford Chinese Word Segmenter) from within python.
I am trying to translate a python script to perl but currently stuck at
I'm trying to write a function in Python (still a noob!) which returns indices
Related question [stackoverflow] here . I'm trying to do the above, but I want
I have a question related to this one : I'm trying to attach an
This is somewhat related to the question posed in this question but I'm trying
I am trying to write a cross-platform python program that would run in the
I'm trying to configure logging for a Django app using the Python logging module.
I'm trying to connect to a SQL server from VB. The SQL server is
I am very new to python. I am trying to write a program that

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.