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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:13:48+00:00 2026-06-03T23:13:48+00:00

I have two csv files which store an id and some associated fields that

  • 0

I have two csv files which store an id and some associated fields that I need to match. Currently, in Python 2.4, I load the csv files into a dictionary of record objects with the dictionary key as the record id. I then loop through one and match the keys in the other and do some processing.

This is all fine and works well but this is on relatively small csv files with around 60,000 records. I will soon need to deal with many millions of records and possibly multiple csv files. I am concerned about the memory load using the current method.

I was initially thinking about a simple loop in the csv reader and not bothering to load them into memory at all, but when looping though a few million records for each of the million records in the other files we’re talking extremely inefficient stuff here.

So, any ideas on a good way of doing this? I’m stuck in python 2.4, I can’t really change from csv files and I’d like to avoid using sql if possible. Thanks

Edit: As a ballpark figure I’m looking at up to 20 200MB files.

  • 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-03T23:13:49+00:00Added an answer on June 3, 2026 at 11:13 pm

    What are the reasons you want to avoid SQL?

    You really want to switch to using a database of some kind. I suggest SQLite to start with; it’s baked into Python as the sqlite3 module.. It has no other dependencies, uses a plain file (or RAM) for data storage – no network/server setup required – and it’s dead easy to get started with.

    The reasons you want to switch to a database include:

    • Much less code to write. Instead of having to write loops to look for specific elements, you can just write SELECT queries.
    • The database knows how to optimise queries in ways you haven’t even thought about. It will typically be much, much faster than any pseudo-database you roll in Python.
    • You can do more complex queries. You can select rows which meet certain criteria (SELECT * FROM table WHERE...), correlate records from one table with records from another table (SELECT * FROM table1 JOIN table2...), and so forth.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tab delimited csv files (with headers) that I need to merge
I have two CSV files (three columns) which I need to compare and extract
I have two CSV files which use @ to divide each column. The first
I have two DataTables, A and B , produced from CSV files. I need
I have the following PHP script which reads from two CSV files, At the
I have n csv files which I need to compare against each other and
I have a list of csv files ( file1, file2, ... ) that have
I need to develop an application where two csv files are compared. The first
I have two .csv files containing correlation matrices exported from R. One file contains
I have two files one is a tab delimited and one is a csv

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.