0

Hi why do I get this error and how do I correct it?

File "<ipython-input-451-471e59eff2c7>", line 1, in <module>
    range(6,31,7)

TypeError: 'DatetimeIndex' object is not callable
weekend_prime = []
weekends = []
weekday_prime=[]

def createWeekendData_Jan():
    for dayy in range(6,31,7): #all Sat. and Sun. of Jan.
        day_str = str(dayy)
        if(len(day_str)==1):
            day_str = '0'+day_str
        for hours in range(1,24):
            hours_str = str(hours)
            if(len(hours_str)==1):
                hours_str = ' 0'+hours_str
            else:
                hours_str = ' '+hours_str    
            weekends.append('2018-01-'+day_str+hours_str) 

createWeekendData_Jan()
print(weekends)  
vurmux
  • 9,420
  • 3
  • 25
  • 45
user2922935
  • 439
  • 4
  • 12

0 Answers0