Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #110702
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Michael Selik <michael.selik@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: fastest way to read a text file in to a numpy array |
| Date | Tue, 28 Jun 2016 14:29:56 +0000 |
| Lines | 30 |
| Message-ID | <mailman.83.1467124225.2358.python-list@python.org> (permalink) |
| References | <37b46ad8-8318-4d67-a65c-7dd7a50a3848@googlegroups.com> <CAGgTfkOJC3Ws6aQtVq=e2g7rb8xqChMieJ9Sok93A65bL2dMNg@mail.gmail.com> <CA+1uRFxz-kTa8uCHNZLkZ5Xj2XkafNPLXSyGADYawedcqeL+wQ@mail.gmail.com> <CAGgTfkPTRhG_pc5q2QzbV8WqwZbhJNy+LYe6TAJg-jwmtcNp-w@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| X-Trace | news.uni-berlin.de yAcbcc8l2bS+9RVUVd2TZgVhnEYbR11fkS0mX8ulgC/Q== |
| Return-Path | <michael.selik@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'subject:text': 0.04; 'array.': 0.07; 'lines.': 0.07; 'subject:file': 0.07; 'cc:addr :python-list': 0.09; 'closest': 0.09; '2016': 0.16; 'coordinates': 0.16; 'numpy': 0.16; 'received:io': 0.16; 'received:mail- qk0-x22a.google.com': 0.16; 'received:psf.io': 0.16; 'subject:array': 0.16; 'subject:fastest': 0.16; 'wrote:': 0.16; 'email addr:gmail.com>': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'cc:no real name:2**0': 0.22; 'fit': 0.23; 'header:In-Reply-To:1': 0.24; 'wondering': 0.25; 'point.': 0.27; 'points': 0.27; 'define': 0.27; 'message- id:@mail.gmail.com': 0.27; 'fastest': 0.27; 'format,': 0.27; 'function': 0.28; 'bad.': 0.29; 'probably': 0.31; 'option': 0.31; 'problem': 0.33; 'tue,': 0.34; 'file': 0.34; 'received:google.com': 0.35; 'skip:: 10': 0.35; 'something': 0.35; 'possible.': 0.36; 'subject:: ': 0.37; 'skip:x 10': 0.40; "you'll": 0.61; 'distance': 0.63; 'one-time': 0.66; 'repeat': 0.67; 'million': 0.74; 'subject:read': 0.84; 'task,': 0.91; 'broadcasting': 0.93 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wubwfo/lmXn39dtnwDIKFVNlZN3QYHwcjSZOdLBcLh8=; b=Zgz0rDsZTRXgwUB+hSq7aNIGPPyRH3RUfOiY6fCAe5UxNmbS6TEImQieR7HsxknHEi U2nvGGh3hRNGE0+XTO9+YwNl185HRMW+NLFbixM0MaHuZvDcGtGcwanGTHh2THqivm47 fUxT6NLFCoZDbmEhEVi9CT5RRILsocrzucC62gdy/RWl3TehOUBJqYdTlT4ML+RV/dDg nWHQUkm7fn0ZNowYwTtIF6bYTruZA0Jhd61l0Rj05jw6RxrT+sSIy4RNkpOsbPuF28KJ aeeD1EFVOr5HHf6xZwgvWx+Y3ZpG8nW7WGs5PDUUkLqkTVorIGLcdgmbIYD5jBGheykL Cy7Q== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wubwfo/lmXn39dtnwDIKFVNlZN3QYHwcjSZOdLBcLh8=; b=VWIv7Q/tv8VElAkIZWsyFB89mENI+yWRMcX8IpHvxBjrsaYVkBesoheXchII25zTq+ fUHyLtO12jRdYmiOY7zmhal43a2pj4rsvkm+kCnFCylBYzxZl05jMEv1Al5uKUbbbI3W irQSp0zAfPcz7bl4Jth39cE5a1Sbjt5oyCvy9jrDBHzVQL5YY09i+1FGYqhVUUOJcH36 dnewcBJUVB7pWpiblhDn8l0FOdVkGvJrN6DO1kPulDj4zgyK9789PbBduIgQD14oh/Sc WOu0kNdj/KchA7pNOUZop7J72IZU/jcK21g4glyfMRlXZjbahNu43j1Az/4XCTqNRTxk IGiA== |
| X-Gm-Message-State | ALyK8tJ1wiYM8TwWnC5Tf+4HOY/5LqkaOUkVIU73YGD6a8ndFk8E7hS2AoBPnr9r7Uu5CBR4nZfakkkgYLjvNA== |
| X-Received | by 10.55.50.19 with SMTP id y19mr2426344qky.18.1467124206627; Tue, 28 Jun 2016 07:30:06 -0700 (PDT) |
| In-Reply-To | <CA+1uRFxz-kTa8uCHNZLkZ5Xj2XkafNPLXSyGADYawedcqeL+wQ@mail.gmail.com> |
| X-Content-Filtered-By | Mailman/MimeDel 2.1.22 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.22 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| X-Mailman-Original-Message-ID | <CAGgTfkPTRhG_pc5q2QzbV8WqwZbhJNy+LYe6TAJg-jwmtcNp-w@mail.gmail.com> |
| X-Mailman-Original-References | <37b46ad8-8318-4d67-a65c-7dd7a50a3848@googlegroups.com> <CAGgTfkOJC3Ws6aQtVq=e2g7rb8xqChMieJ9Sok93A65bL2dMNg@mail.gmail.com> <CA+1uRFxz-kTa8uCHNZLkZ5Xj2XkafNPLXSyGADYawedcqeL+wQ@mail.gmail.com> |
| Xref | csiph.com comp.lang.python:110702 |
Show key headers only | View raw
On Tue, Jun 28, 2016 at 10:08 AM Hedieh Ebrahimi <hemla21@gmail.com> wrote: > File 1 has : > x1,y1,z1 > x2,y2,z2 > .... > > and file2 has : > x1,y1,z1,value1 > x2,y2,z2,value2 > x3,y3,z3,value3 > ... > > I need to read the coordinates from file 1 and then interpolate a value > for these coordinates on file 2 to the closest coordinate possible. The > problem is file 2 is has around 5M lines. So I was wondering what would be > the fastest approach? > Is this a one-time task, or something you'll need to repeat frequently? How many points need to be interpolated? How do you define distance? Euclidean 3d distance? K-nearest? 5 million can probably fit into memory, so it's not so bad. NumPy is a good option for broadcasting the distance function across all 5 million labeled points for each unlabeled point. Given that file format, NumPy can probably read from file directly into an array. http://stackoverflow.com/questions/3518778/how-to-read-csv-into-record-array-in-numpy
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
fastest way to read a text file in to a numpy array Heli <hemla21@gmail.com> - 2016-06-28 06:45 -0700
Re: fastest way to read a text file in to a numpy array Michael Selik <michael.selik@gmail.com> - 2016-06-28 14:00 +0000
Re: fastest way to read a text file in to a numpy array Michael Selik <michael.selik@gmail.com> - 2016-06-28 14:29 +0000
Re: fastest way to read a text file in to a numpy array Cody Piersall <cody.piersall@gmail.com> - 2016-06-28 09:37 -0500
Re: fastest way to read a text file in to a numpy array Heli <hemla21@gmail.com> - 2016-06-30 08:49 -0700
Re: fastest way to read a text file in to a numpy array Christian Gollwitzer <auriocus@gmx.de> - 2016-06-30 23:02 +0200
csiph-web