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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:53:33+00:00 2026-05-20T12:53:33+00:00

For analysis it is sometimes better to access columns of a select-result instead of

  • 0

For analysis it is sometimes better to access columns of a select-result instead of rows. Let’s say we want to plot a voltage trace of a specific recording point (rp) and the data is stored in a table *recordings*like this

__________________________________
|rp_key  | time       | value_mV |
----------------------------------
|  1     |    1       |    -65   |
----------------------------------
|  1     |    2       |    -64.4 |
----------------------------------
|  1     |    3       |    -65.3 |
----------------------------------
|  2     |    1       |    -67.9 |
----------------------------------
|  2     |    2       |    -68.0 |
----------------------------------

Now I would like to plot like this:

import sqlalchemy as sa
import matplotlib.pyplot as plt
# ...
res = session.query(Recording).filter_by(rp_key=1).all()
# HERE: elegant sqlalchemy-way of accessing the columns of the result
plt.plot(time, value_mV)

What would you suggest?

  • 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-20T12:53:34+00:00Added an answer on May 20, 2026 at 12:53 pm

    SQLAlchemy allows to query for specified columns only. All you need is to transpose resulting matrix. Assuming Recording is a mapped class the code might look as following:

    rows = session.query(Recording.time, Recording.value_mV).filter_by(rp_key=1).all()
    time, value_mV = zip(*rows)
    plt.plot(time, value_mV)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several Code Analysis CA1704:IdentifiersShouldBeSpelledCorrectly warnings that I want to suppress. Basically, they
When performing a factor analysis using factanal the usual result is some loadings table
Thanks to this excellent analysis of the Plot algorithm by Yaroslav Bulatov, I now
I want to pull out the user block. The JSON result will always change,
I am programming a numerical analysis program and sometimes the calculus give in some
For statistical reasons, I want an extensive analysis from a dataset. I already have
An analysis from a colleague with UML diagrams contains the following: 0..° I'm familiar
This is about the analysis of insertion sort in the book 'Introduction to Algorithms'.
Any ideas about escape analysis in dalvik? Or when and if it's planned to
Which static analysis tools for Java has easiest extension mechanism. I checked PMD But

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.