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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:45:19+00:00 2026-06-16T01:45:19+00:00

I need to create a set of dictionaries from Oracle query results. My data

  • 0

I need to create a set of dictionaries from Oracle query results.

My data is laid out into station ID, date, time, location, species, and catch weight. For each species, there is a new line, while all the location, etc, data may be redundant.

First, I need to create a keyed dictionary by fieldname and value, such as stationID, date, etc so that when I call, say,

value[1]  (this being the station ID field)

I get

112

The end result is to conglomerate all of the “like” station ID’s, dates, etc into one unique key– with the resulting data (fish catch) being the values.

such as [date,time,location, etc]: cod 47, hake 31, dogfish 5

So far, to get the data parsed into individual keyed dictionaries by field name and then by line I have this:

desc=[d[0] for d in cursor.description]
field=[d[1] for d in cursor.description]
value=dict(zip(desc,field))   
result=[dict(zip(value,line)) for line in cursor]
print result[1]

However, if I try and call value, the field is simply the data type.. how can I get the actual data value? And then nest that into the “result” dictionary that parses each individual sample?

  • 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-16T01:45:19+00:00Added an answer on June 16, 2026 at 1:45 am

    You are zipping together the wrong items. Zip only desc and line, you do not need to use the second item in the cursor.description tuples:

    desc=[d[0] for d in cursor.description]
    result=[dict(zip(desc, line)) for line in cursor]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to create an NSImage from a url and then set it to
I need to create an match-finder system for some data set, as follows: There
I need to create a set of unequal age groupings from a patient dataset
I need to create my own toolbar with set of buttons in the Visio
i need to create a function in my application to set its available memory
i am using raw sockets to create my own socket. i need to set
I need create custom dialog and put JPanel into it. Is it possible?
I need to create a Set of objects. The concern is I do not
I need to create a set of CSS/JavaScript tab panels. However, most the examples
I have a custom class called card and I need to create a set

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.