1. I would like to ask how can I adjust array.csv like this:
    ,,,-00.000146400000, 0.08000,
    ,,,-00.000146200000, 0.00000,
    ,,,-00.000146000000, 0.00000,
    ,,,-00.000145800000, 0.00000,

so I can have in first column -00.000146400000 and in second column 0.08000? (thanks, I am begginer).

  1. How can I pick out information(number) from 20 separate files to one file? (thanks!)
1 Year
Discussion Span
Last Post by Gribouillis

Hi I'm taking a guess, but i think you are looking to build a 2D array. If that is the case, you will need to read the whole file in order to know how many rows it has, as that will give you the dimenssions of the first column of the array ([line numbers][2]). At the same time that you are readin, you can build a string from the data. A while-loop will help you on that.
Once the string is build you can just transverse it and to read the values between commas and store that into the array. A couple for-loops will help you on that.

For the 20 separated files, you will have to open them one by one.

Edited by losh177


I recommend using the built-in csv module to read csv files. You can simply use

import csv
with open('eggs.csv', newline='') as csvfile:
    spamreader = csv.reader(csvfile, delimiter=',')
    data = [row[3:] for row in spamreader]

Edited by Gribouillis

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.