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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:49:14+00:00 2026-05-20T05:49:14+00:00

I have daily stock data as an HDF5 file created using PyTables. I would

  • 0

I have daily stock data as an HDF5 file created using PyTables. I would like to get a group of rows, process it as an array and then write it back to disk (update rows) using PyTables. I couldn’t figure out a way to do this cleanly. Could you please let me know what will be the best way to accomplish this?

My data:

Symbol, date, price, var1, var2
abcd, 1, 2.5, 12, 12.5
abcd, 2, 2.6, 11, 10.2
abcd, 3, 2.45, 11, 10.3
defg, 1,12.34, 19.1, 18.1
defg, 2, 11.90, 19.5, 18.2
defg, 3, 11.75, 21, 20.9
defg, 4, 11.74, 22.2, 21.4

I would like to read the rows that correspond to each symbol as an array, do some processing and update the fields var1 and var2. I know all the symbols in advance so I can loop through them. I tried something like this:

rows_array = [row.fetch_all_fields() for row in table.where('Symbol == "abcd"')]

I would like to pass rows_array to another function which will compute the values for var1 and var2 and update it for each record. Please note that var1, var2 are like moving averages so I will not be able to calculate them inside an iterator and hence the need for the entire set of rows to be an array.

After I calculate whatever I need using rows_array, I am not sure how to write it back to the data i.e., update the rows with the new calculated values. When updating the entire table , I use this:

 table.cols.var1[:] = calc_something(rows_array)

However, when I want to update only a portion of the table, I am not the best way to do it. I guess I can re-run the ‘where’ condition and then update each row based on my calcs but that’s seems like a waste of time rescanning the table.

Your suggestions are appreciated…

Thanks,
-e

  • 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-20T05:49:14+00:00Added an answer on May 20, 2026 at 5:49 am

    If I understand well, the next should do what you want:

    condition = 'Symbol == "abcd"'
    indices = table.getWhereList(condition)  # get indices
    rows_array = table[indices]  # get values
    new_rows = compute(rows_array)   # compute new values
    table[indices] = new_rows  # update the indices with new values
    

    Hope this helps

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

Sidebar

Related Questions

I need to have a process that compiles daily data into an PDF that
I have some stock data based on daily close values. I need to be
I have a daily batch process that involves selecting out a large number of
Basically, I have been using both Integer.Parse and CInt in most of my daily
Assume you have a table with a stock time series on a daily basis.
I currently have an application that gets hit with over 20,000 users daily and
I have a forum on a website I master, which gets a daily dose
I use Eclipse 3.3 in my daily work, and have also used Eclipse 3.2
Currently I'm tasked with doing the daily build. We have an ASP.NET 2005 website
Cron installation is vixie-cron /etc/cron.daily/rmspam.cron #!/bin/bash /usr/bin/rm /home/user/Maildir/.SPAM/cur/*; I Have this simple bash script

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.