I want to write a class with a function that takes start and end of a range and returns a Pandas series object containing the numbers within that range. But I need to know how to run the function with pre-determined procedure when no arguments are given.
import pandas as pd
class customseries:
def range_series(self,a,b):
self.a = 0
self.b = 10
return pd.Series(range(a,b))
c = customseries()
c.range_series(5,10)
Here if I put:
- range_series() -> Should Return a pandas series from 1 to 10
- range_series(5) -> Should Return a pandas series from 5 to 10
- range_series(5, 10) -> Should Return a pandas series from 5 to 15
How can this be done?