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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:43:05+00:00 2026-06-06T18:43:05+00:00

I have an excel file and I want to read each column and create

  • 0

I have an excel file and I want to read each column and create separate lists for them. I want to then compare each element of each list with other corresponding lists I have.
Is there a way I can convert the columns into lists using python?

for eg(i can get this file as a txt space separated file or an excel file)

HST_9578_02_ACS_WFC_F775W 245.8976441 -26.5255957 4339.570 1882.364
HST_10615_03_ACS_WFC_F435W 245.8976450 -26.5255138 2084.978 2101.122
HST_10120_02_ACS_WFC_F658N 245.8976758 -26.5255024 1778.055 1752.193
HST_10775_64_ACS_WFC_F606W 245.8977532 -26.5255296 2586.612 2603.519
HST_10775_64_ACS_WFC_F814W 245.8977532 -26.5255296 2586.612 2603.519
HST_9578_02_ACS_WFC_F775W 245.8978148 -26.5255491 4328.571 1885.712
HST_10120_02_ACS_WFC_F625W 245.8978053 -26.5254741 1769.711 1754.229
HST_10353_02_ACS_WFC_F435W 245.8976003 -26.5257784 3758.430 985.125
HST_10775_64_ACS_WFC_F606W 245.8979115 -26.5254936 2576.410 2606.114
  • 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-06T18:43:06+00:00Added an answer on June 6, 2026 at 6:43 pm

    This sounds like a job for Python’s CSV module. Each row read is returned as a list of strings.

    To borrow a short example from the documentation:

    Each row read from the csv file is returned as a list of strings. No
    automatic data type conversion is performed.

    A short usage example:

    [this simply prints out each row]

    import csv
    with open('some.csv', 'rb') as f:
        reader = csv.reader(f)
        for row in reader:
            print row
    

    You could get to specific columns by indexing into the rows with the index values as appropriate.

    Or if you want to do this “manually” (each row is separated by a ,):

    s = """HST_9578_02_ACS_WFC_F775W 245.8976441 -26.5255957 4339.570 1882.364,
    HST_10615_03_ACS_WFC_F435W 245.8976450 -26.5255138 2084.978 2101.122,
    HST_10120_02_ACS_WFC_F658N 245.8976758 -26.5255024 1778.055 1752.193,
    HST_10775_64_ACS_WFC_F606W 245.8977532 -26.5255296 2586.612 2603.519,
    HST_10775_64_ACS_WFC_F814W 245.8977532 -26.5255296 2586.612 2603.519,
    HST_9578_02_ACS_WFC_F775W 245.8978148 -26.5255491 4328.571 1885.712,
    HST_10120_02_ACS_WFC_F625W 245.8978053 -26.5254741 1769.711 1754.229,
    HST_10353_02_ACS_WFC_F435W 245.8976003 -26.5257784 3758.430 985.125,
    HST_10775_64_ACS_WFC_F606W 245.8979115 -26.5254936 2576.410 2606.114
    """
    
    bl = [[],[],[],[],[]]
    for r in s.split(','):
        for c in range(5):
            bl[c].append(r.split()[c])
    

    gives:

    bl[0]
    ['HST_9578_02_ACS_WFC_F775W', 'HST_10615_03_ACS_WFC_F435W', 'HST_10120_02_ACS_WFC_F658N', 'HST_10775_64_ACS_WFC_F606W', 'HST_10775_64_ACS_WFC_F814W', 'HST_9578_02_ACS_WFC_F775W', 'HST_10120_02_ACS_WFC_F625W', 'HST_10353_02_ACS_WFC_F435W', 'HST_10775_64_ACS_WFC_F606W']
    
    bl[1]
    ['245.8976441', '245.897645', '245.8976758', '245.8977532', '245.8977532', '245.8978148', '245.8978053', '245.8976003', '245.8979115']
    
    bl[2]
    ['-26.5255957', '-26.5255138', '-26.5255024', '-26.5255296', '-26.5255296', '-26.5255491', '-26.5254741', '-26.5257784', '-26.5254936']
    
    bl[3]
    ['4339.57', '2084.978', '1778.055', '2586.612', '2586.612', '4328.571', '1769.711', '3758.43', '2576.41']
    
    bl[4]
    ['1882.364', '2101.122', '1752.193', '2603.519', '2603.519', '1885.712', '1754.229', '985.125', '2606.114']
    

    EDIT/UPDATE:

    To combine the two approaches into one:

    import csv
    
    with open('so.csv') as f:
        bl = [[],[],[],[],[]]
        reader = csv.reader(f)
        for row in reader:
            for col in range(5):
                bl[col].append(row[col])
    

    The advantage of using with to open the file is that it will be automatically closed for you when you are done or if an exception occurs.

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

Sidebar

Related Questions

I want to read simple excel xml file to dictionary. I have tried to
I have an excel file that I want to embed in my C# assembly.
I have an Excel file with one column which is filled with numbers. I
I have a Excel File, i am able to read single row from Excel
I have an excel file with 10,000 rows in column A some values are
I'm using vb.net 2003 and I want to read excel file 2003 using OleDb
I have a huge xlsx file (aboutn 127 MB) and want to read using
I have downloaded latest POI version 3.5 . I want to read the Excel
I have a perl script read Excel file and parse using a perl module
I have a django view that I want to return an Excel file. The

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.