Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #62426

How to use the method loadtxt() of numpy neatly?

Newsgroups comp.lang.python
Date 2013-12-19 21:48 -0800
Message-ID <96f12116-29fa-4bce-bd4f-c218ca2ecc65@googlegroups.com> (permalink)
Subject How to use the method loadtxt() of numpy neatly?
From chao dong <neutronest@gmail.com>

Show all headers | View raw


    HI, everybody. When I try to use numpy to deal with my dataset in the style of csv, I face a little problem.
    
    In my dataset of the csv file, some columns are string that can not convert to float easily. Some of them can ignore, but other columns I need to change the data to a enum style.

    for example, one column just contain three kinds : S,Q,C. Each of them can declare one meaning, so I must convert them to a dict just like {1,2,3}
    
    Now the question is, when I use numpy.loadtxt, I must do all things above in just one line and one fuction. So as a new user in numpy, I don't know how to solve it.

    Thank you.

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

How to use the method loadtxt() of numpy neatly? chao dong <neutronest@gmail.com> - 2013-12-19 21:48 -0800
  Re: How to use the method loadtxt() of numpy neatly? rusi <rustompmody@gmail.com> - 2013-12-20 01:45 -0800
  Re: How to use the method loadtxt() of numpy neatly? Peter Otten <__peter__@web.de> - 2013-12-20 11:45 +0100

csiph-web