Python - Read and split lines from text file into indexes.

Discussion in 'App Development' started by OTM-Options, Apr 28, 2015.

  1. quite impressive. Aside the memory issues for large files pandas seems to be quite capable in importing text files.

    It takes me 1.7s running your code. You seem to be running on a pretty good SSD drive. Btw, I tested within Anaconda/Spyder on top of Python 3.4. This comes close to the 1.3s it takes C# to import the data (the rest is taken up with parsing the data into strong types)

     
    #71     May 14, 2015
  2. Quiet1

    Quiet1

    So on Windows (8.1) on same machine but with original 3yo SSD I get 1.25s (worst of 3) to read a million lines (compared to 1.15s on Ubuntu).

    Both Pythons are 3.4 via Anaconda with Jetbrains PyCharm (by far the best Python IDE imho).

    Like for like, Python can read the file into a list (without any parsing) in ~ 0.56s on windows.
     
    #72     May 16, 2015
  3. Really Quite performant, no question. Though some of your numbers do not really seem to add up. You earlier said it took you 1.27s with saving the CSV out and 1.15s without on your Linux box. The performance number to export the data to CSV seems extremely unrealistic.

     
    #73     May 16, 2015
  4. Quiet1

    Quiet1

    double checking the time to save now on my laptop (ie not same machine) I get about 0.17s to save the data to csv - meaning time from before file-open to after file-close only. So seems ballpark ok to me given i'd expect my desktop to be faster.
     
    #74     May 16, 2015
  5. Thanks for checking. According to your performance metric and assuming a floating point number of size 8 bytes would amount to at least a required throughput of 440mb/sec which is definitely within the specs of most modern ssd drives.

    Again, quite respectable hardware performance (we have by now almost moved away from actual Python performance and into hardware prrformance) but also thanks for showing that Python and Pandas is quite performant in respect to raw text ex and import (among others).

     
    #75     May 16, 2015
  6. btw, I like Spyder and also Visual Studio as it brings everything together for me on my Windows machine.

     
    #76     May 16, 2015
  7. Butterfly

    Butterfly

    jesus, what a poorly written python code,

    so unpython !!! you should be shot !!!

    This is really a simple task, can't believe you can't even figure it out on your own. Sounds like you are a college student. That's the problem with the new Facebook generation, no programming skills.
     
    #77     May 16, 2015