Python Forum
Assigning data read from CSV to class - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Assigning data read from CSV to class (/thread-25899.html)



Assigning data read from CSV to class - faruk61 - Apr-15-2020

Hello friends . How can I use the data I read from CSV with the help of classes? Can you help?


RE: Assigning data read from CSV to class - UGuntupalli - Apr-15-2020

@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


RE: Assigning data read from CSV to class - buran - Apr-15-2020

Do you want to instantiate objects using data from the file?