Python Forum
Python: Automated Script to Read Multiple Files in Respective Matrices
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python: Automated Script to Read Multiple Files in Respective Matrices
#1
Hello,

I am a beginner and trying to automate a simple problem. I am reading multiple files one-by-one and saving the data in respective matrices. I would like to make my code short by automating (e.g., by looping).

Would appreciate any suggestions, the files are delimited and named numerically (File_1, File_2, etc.). Here is what I am doing as of now:

    file1 = np.loadtxt('File_1.txt', delimiter=',')
    file2 = np.loadtxt('File_2.txt', delimiter=',')
    ...

    matrix1 = file1[:,:]
    matrix2 = file2[:,:]
    ...
Reply


Messages In This Thread
Python: Automated Script to Read Multiple Files in Respective Matrices - by Robotguy - Jul-02-2020, 12:01 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Using a script to open multiple shells? SuchUmami 9 542 Apr-01-2024, 10:04 AM
Last Post: Gribouillis
  Eliminate entering QR - Whatsapp web automated by selenium akanowhere 1 3,099 Jan-21-2024, 01:12 PM
Last Post: owalahtole
  python convert multiple files to multiple lists MCL169 6 1,568 Nov-25-2023, 05:31 AM
Last Post: Iqratech
  splitting file into multiple files by searching for string AlphaInc 2 908 Jul-01-2023, 10:35 PM
Last Post: Pedroski55
  Is there a *.bat DOS batch script to *.py Python Script converter? pstein 3 3,285 Jun-29-2023, 11:57 AM
Last Post: gologica
Question Need help for a python script to extract information from a list of files lephunghien 6 1,111 Jun-12-2023, 05:40 PM
Last Post: snippsat
  script to calculate data in csv-files ledgreve 0 1,111 May-19-2023, 07:24 AM
Last Post: ledgreve
  Merging multiple csv files with same X,Y,Z in each Auz_Pete 3 1,180 Feb-21-2023, 04:21 AM
Last Post: Auz_Pete
  unittest generates multiple files for each of my test case, how do I change to 1 file zsousa 0 974 Feb-15-2023, 05:34 PM
Last Post: zsousa
  How to read in mulitple files efficiently garynewport 3 899 Jan-27-2023, 10:44 AM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020