Python Forum

Full Version: import 13 row from .csv file into array or list
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
HI

I have .csv file which contains 3 columns ( feature 1 , feature 2 , class )

I need to take 13 row each time with one class each time to pass it to machine learning classifier .  

so if the file contains

feature 1  feature 2   class
1                   1              1
2                   2              1
3                   3              1
4                   4              1
5                   5              1
6                   6              1
7                   7              1
8                   8              1
9                   9              1
10                 10            1
11                 11            1
12                 12            1
13                 13            1

it should be some thing like this

features                                                                                                         class
1 1  2 2  3 3  4 4  5 5   6  6  7 7  8 8  9 9  10 10  11 11 12 12   13 13             1
What have you tried so far?
Please show code