Python Forum
class constructor with dataframe
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
class constructor with dataframe
#2
So you mean something like this, but with a dataframe
class student:
    def __init__(self, name):
        self.name = name

    def introduction(self):
        print('Hi, I\'m %s' %self.name)

nameList = ['Mark', 'Mary', 'Luke', 'Sally', 'Lerry']
studentList = []
for student in nameList:
    studentList.append(student(student))

for student in studentList:
    student.introduction()
Reply


Messages In This Thread
class constructor with dataframe - by UGuntupalli - Jun-11-2019, 05:35 PM
RE: class constructor with dataframe - by SheeppOSU - Jun-11-2019, 08:13 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Why doesn't calling a parent constructor work with arbitrary keyword arguments? PurposefulCoder 4 1,006 Jun-24-2023, 02:14 PM
Last Post: deanhystad
  Cannot convert the series to <class 'int'> when trying to create new dataframe column Mark17 3 8,657 Jan-20-2022, 05:15 PM
Last Post: deanhystad
  Not including a constructor __init__ in the class definition... bytecrunch 3 12,212 Sep-02-2021, 04:40 AM
Last Post: deanhystad
  How to apply a class method to an entire dataframe column tirtha9 1 5,204 Jan-03-2021, 04:44 AM
Last Post: klllmmm
  syntaxerror when entering a constructor MaartenRo 2 2,026 Aug-03-2020, 02:09 PM
Last Post: MaartenRo
  error in constructor overriding in python3 srm 1 1,853 Jul-18-2019, 12:21 PM
Last Post: ichabod801
  This constructor takes no arguments Friend 2 5,384 Jun-26-2019, 02:54 PM
Last Post: Friend
  Overload of constructor psosmol 2 2,845 Apr-17-2019, 05:10 AM
Last Post: psosmol
  Constructor Rajesh1978 2 3,245 May-22-2018, 05:18 PM
Last Post: micseydel
  I'm trying to make a constructor without hardcoding all of the values RedSkeleton007 7 4,544 Apr-05-2018, 11:12 AM
Last Post: buran

Forum Jump:

User Panel Messages

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