After going through some lectures on class and objects, what I have understood is that if a function is a part of a class then it can be accessed by object which is known as method and if a function is outside a class, then it can be accessed directly.
So for example -
1)
def introduce():
return 'My name is Joseph'
student1 = introduce()
Here since introduce is not within any class , we directly used introduce function and the result shall be 'My name is Joseph' which shall be stored in student1
2)
class room():
def introduce(self):
return 'My name is Joseph'
student1 = introduce()
a = student1.introduce()
Here this introduce function
is inside room class and therefore to use it we have to associate a object with a class and then use it
Now going by this lets take an example of Pandas
we have a function named as - pandas.read()
I think pandas is a class but then here does it mean that pandas is a object and a read()
is a function inside pandas ? Am I missing something ?
Shouldn't this be the case ?
df = pandas() # making an object of pandas class
df.read() # then accessing the read function inside pandas class
Kindly assist me