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
  How to write variable in a python file then import it in another python file? tatahuft 4 997 Jan-01-2025, 12:18 AM
Last Post: Skaperen
  JSON File - extract only the data in a nested array for CSV file shwfgd 2 1,120 Aug-26-2024, 10:14 PM
Last Post: shwfgd
  import a function from another file using relative path paul18fr 6 3,310 Aug-01-2024, 06:40 AM
Last Post: paul18fr
Video doing data treatment on a file import-parsing a variable EmBeck87 15 5,777 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 2,696 Feb-08-2023, 07:45 PM
Last Post: Larz60+
  Import XML file directly into Excel spreadsheet demdej 0 1,609 Jan-24-2023, 02:48 PM
Last Post: demdej
  functional LEDs in an array or list? // RPi user Doczu 5 2,837 Aug-23-2022, 05:37 PM
Last Post: Yoriz
  How from sklearn.datasets import load_diabetes change to import to CSV file Anldra12 0 2,738 Dec-25-2021, 07:20 PM
Last Post: Anldra12
  How to import file and function in another folder SriRajesh 1 5,617 Dec-18-2021, 08:35 AM
Last Post: Gribouillis
  Python - Import file sequence into Media Pool jensenni 1 2,979 Feb-02-2021, 05:11 PM
Last Post: buran

Forum Jump:

User Panel Messages

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