Issue
Hi Guys, I am trying to create a training, validation and test dataset in python for bike sharing dataset using Object oriented programming.
I have first created a method called "DATALOADER" to read the file and then split the data into train, validation and test set. However, I am facing some challenges while executing the code.
Pasting the code above and error response below. Need some help with that.
Error Message: **--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-29-29ec681918b0> in <module> ----> 1 dataloader = Dataloader('C:/Users/pbhal/Downloads/hour.csv/hour.csv') 2 train, val, test = dataloader.getData() 3 fullData = dataloader.getFullData() 4 5 category_features = ['season', 'holiday', 'mnth', 'hr', 'weekday', 'workingday', 'weathersit']
TypeError: Dataloader() takes no arguments**
I was trying to create a train, validation and test set out of hour.csv datafile. However , it did not work out
Solution
You have a typo, you should use __init__
(two underscores) instead of _init_
. This means that your class does not have an initialization method defined, and the fallback (the Python class object
I think) does not receive any argument.
You can validate that this is the issue with a small empty class:
class Example:
pass
a = Example() # Works
b = Example(1) # Fails with "TypeError: Example() takes no arguments"
Answered By - aaossa
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.