Python Forum
import 13 row from .csv file into array or list
Thread Rating:
  • 2 Vote(s) - 3.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
import 13 row from .csv file into array or list
#1
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
Reply
#2
What have you tried so far?
Please show code
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Video doing data treatment on a file import-parsing a variable EmBeck87 15 2,670 Apr-17-2023, 06:54 PM
Last Post: EmBeck87
  How do I add comments from a text-file to an array of folders? clausneergaard 2 1,735 Feb-08-2023, 07:45 PM
Last Post: Larz60+
  Import XML file directly into Excel spreadsheet demdej 0 803 Jan-24-2023, 02:48 PM
Last Post: demdej
  functional LEDs in an array or list? // RPi user Doczu 5 1,523 Aug-23-2022, 05:37 PM
Last Post: Yoriz
  How from sklearn.datasets import load_diabetes change to import to CSV file Anldra12 0 1,816 Dec-25-2021, 07:20 PM
Last Post: Anldra12
  How to import file and function in another folder SriRajesh 1 3,082 Dec-18-2021, 08:35 AM
Last Post: Gribouillis
  Python - Import file sequence into Media Pool jensenni 1 2,082 Feb-02-2021, 05:11 PM
Last Post: buran
  LIST or ARRAY Comparison and change of value nio74maz 0 1,670 Dec-21-2020, 05:52 PM
Last Post: nio74maz
  2d Array adds last element to entire list waiteup 2 2,026 Nov-19-2020, 08:25 PM
Last Post: bowlofred
Smile Import error with local file colt 1 1,878 Nov-08-2020, 07:56 AM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020