Python Forum
Assigning data read from CSV to class
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Assigning data read from CSV to class
#1
Hello friends . How can I use the data I read from CSV with the help of classes? Can you help?
Reply
#2
@faruk61,
Your question is way too generic, do you have a class which you want to use to read the csv ? Why do you want to use classes in the first place ?

import pandas as pd 
df = pd.read_csv(filepath) # where filepath represents the location of your csv file 

You can simply use pandas to read it as shown above
Reply
#3
Do you want to instantiate objects using data from the file?
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Help with to check an Input list data with a data read from an external source sacharyya 3 317 Mar-09-2024, 12:33 PM
Last Post: Pedroski55
  How to read module/class from list of strings? popular_dog 1 421 Oct-04-2023, 03:08 PM
Last Post: deanhystad
  Correctly read a malformed CSV file data klllmmm 2 1,813 Jan-25-2023, 04:12 PM
Last Post: klllmmm
  Read nested data from JSON - Getting an error marlonbown 5 1,309 Nov-23-2022, 03:51 PM
Last Post: snippsat
  Read data via bluetooth frohr 9 3,142 Jul-10-2022, 09:51 AM
Last Post: frohr
  Write and read back data Aggie64 6 1,811 Apr-18-2022, 03:23 PM
Last Post: bowlofred
  How to read rainfall time series and insert missing data points MadsM 4 2,123 Jan-06-2022, 10:39 AM
Last Post: amdi40
  Assigning a new value to variable uriel 1 1,568 Dec-04-2021, 02:59 PM
Last Post: Underscore
  [Solved] Using readlines to read data file and sum columns Laplace12 4 3,464 Jun-16-2021, 12:46 PM
Last Post: Laplace12
  Looping to read data in database CEC68 1 1,677 Sep-24-2020, 08:54 PM
Last Post: scidam

Forum Jump:

User Panel Messages

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