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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T06:33:42+00:00 2026-06-08T06:33:42+00:00

The purpose of my Python script is to compare the data present in multiple

  • 0

The purpose of my Python script is to compare the data present in multiple CSV files, looking for discrepancies. The data are ordered, but the ordering differs between files. The files contain about 70K lines, weighing around 15MB. Nothing fancy or hardcore here. Here’s part of the code:

def getCSV(fpath):
    with open(fpath,"rb") as f:
        csvfile = csv.reader(f)

        for row in csvfile:
            allRows.append(row)

allCols = map(list, zip(*allRows))
  • Am I properly reading from my CSV files? I’m using csv.reader, but would I benefit from using csv.DictReader?
  • How can I create a list containing whole rows which have a certain value in a precise column?
  • 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-08T06:33:43+00:00Added an answer on June 8, 2026 at 6:33 am

    Are you sure you want to be keeping all rows around? This creates a list with matching values only… fname could also come from glob.glob() or os.listdir() or whatever other data source you so choose. Just to note, you mention the 20th column, but row[20] will be the 21st column…

    import csv
    
    matching20 = []
    
    for fname in ('file1.csv', 'file2.csv', 'file3.csv'):
        with open(fname) as fin:
            csvin = csv.reader(fin)
            next(csvin) # <--- if you want to skip header row
            for row in csvin:
                if row[20] == 'value':
                    matching20.append(row) # or do something with it here
    

    You only want csv.DictReader if you have a header row and want to access your columns by name.

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

Sidebar

Related Questions

I've a python script which works just as it should, but I need to
I'm working on a Python script to go through two files - one containing
I have a python script that calls a USB-based data-acquisition C# dotnet executable. The
I have a python script that calls a USB-based data-acquisition C# dotnet executable. The
I have a python script which uses subprocess.Popen to run multiple instances of another
I'm working on embedding Python in our test suite application. The purpose is to
I'm writing a server and client system in python. The purpose of the system
I am calling a python script from PHP. The python program has to return
Is there any way to keep my Python script (with an endless 'while' loop)
I have a usb midi controller (uc-33e) and I have a working python 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.