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 8467685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:42:53+00:00 2026-06-10T15:42:53+00:00

I have a 50 research subjects who provided reaction time data on six tasks.

  • 0

I have a 50 research subjects who provided reaction time data on six tasks. I stored each subject’s mean reaction time on a task as a .npy file (50 subjects * 6 tasks = 300 files), and I wish to get a group mean for each task. This would ideally result in six files for the group.

To put it another way, I want to populate a numpy array with individual .npy files, but I am a little lost on the best way to do this. I had the idea to initialize an empty array for each task, populate it with values for subjects, then get the mean.

subjects=range(1,51)
tasks=['a','b','c','d','e','f']
datalist=[]

for subject in subjects:
    for task in tasks:

        array=np.array(datalist)
        f=np.load('%d/%s.npy' % (subject,event))
        result=np.append(array,f)
        mu=np.mean(result)
        sav=np.save('%s' %(task),mu)

The result of this code is the last value in the series, indicating that the array is not populating correctly. Any ideas would be greatly appreciated!

  • 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-10T15:42:54+00:00Added an answer on June 10, 2026 at 3:42 pm

    You’re recreating a new array each time, since it is inside the for loop. In fact, you are creating array, appending a single array to it, taking the mean, and then saving, for every single subject and every single task. You should instead organize it like this:

    for task in tasks:
        result=np.array([])
        for subject in subjects:
            f=np.load('%d/%s.npy' % (subject,event))
            result=np.append(result,f)
        mu=np.mean(result)
        sav=np.save('%s' %(task),mu)
    

    ETA: Incidentally, there are much better ways to store this data than in 300 separate .npy files. Is there only one value for each subject for each task? In that case, why not just represent this a 50 by 6 numpy matrix?

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

Sidebar

Related Questions

I have done some research on this subject, and found out, that Gzipping and
I have attempted to do research on this subject but I have been unable
This is a subject of common discussion, but through all my research I have
I have research about an issue and could not find a solution for it
we have started research on Service Broker and planning to implement in application. But
Have done some research and found some stuff that may be helpful. I would
I have done some research and it really seems that implementing a transaction system
I have done some research, and majority of the examples I have found use
I have done some research on the above and found that I am able
I am building my own torrent site and after doing some research I have

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.