[SciPy-User] calculate new values in csv using numpy

Marc Shivers marc.shivers at gmail.com
Mon Jul 18 08:20:52 EDT 2011


The 3rd column would be:
[a[2] for a in table]

On Mon, Jul 18, 2011 at 8:16 AM, Johannes Radinger
<johradinger at googlemail.com> wrote:
> okay so just to post the result I get from:
>
> table = numpy.genfromtxt("/path/to/file.csv", names=['s1','s2','p'],
> dtype="float,float,float", delimiter=';' , skip_header=1)
>
> the result looks like this:
>
> [(30.633520000000001, 1046.5956699999999, 0.48749999999999999)
>  (9517.6940400000003, 26364.107199999999, 0.26041999999999998)
>  (3102.9560099999999, 0.0, 1.0)...
> [(30.633520000000001, 1046.5956699999999, 0.48749999999999999)]
>
> I can access with table[x] the x-row of that array, but how can I
> access
> the columns? table[:,2] doesn't work.
>
> /joh
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>



More information about the SciPy-User mailing list