Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Why Series object is not callable

Hello everyone, I am trying to run this code. I am getting this error 'Series' object is not callable in line no 22
print(cf_with_same_uprstrike)
21 print(cf_with_same_uprstrike.dtypes)
---> 22 cf_with_same_uprstrike = cf_with_same_uprstrike.loc[cf_with_same_uprstrike['EXP_DATE '].dt.month() == df_aheadof_starttime['datetime'][ind].month()]
23 total_cf_val=cf_with_same_uprstrike['OPEN_PRICE '].sum()
24 # cf_with_same_uprstrike = cf_with_same_uprstrike.loc[cf_with_same_uprstrike]

TypeError: 'Series' object is not callable

######code

class data:
def init(self, date, open_price, strike_price=0):
self.date = date
self.open_price = open_price
self.strike_price = strike_price

startdate = datetime.datetime(2012, 2, 1)
df_aheadof_starttime = df.loc[df['datetime'] >= startdate]
print(df_aheadof_starttime.head(20))

aryc = []

for ind in df_aheadof_starttime.index:
# print(df_aheadof_starttime['datetime'][ind])
cf_with_same_uprstrike = cf.loc[(cf['STR_PRICE '] == df_aheadof_starttime['nearest_upperstrike_price1'][ind])]
# print(cf_with_same_uprstrike['Date'])
cf_with_same_uprstrike = cf_with_same_uprstrike.loc[cf_with_same_uprstrike['Date'] == df_aheadof_starttime['datetime'][ind]]
cf_with_same_uprstrike['EXP_DATE '] = cf_with_same_uprstrike['EXP_DATE '].astype('datetime64[ns]')
print(cf_with_same_uprstrike)
print(cf_with_same_uprstrike.dtypes)
cf_with_same_uprstrike = cf_with_same_uprstrike.loc[cf_with_same_uprstrike['EXP_DATE '].dt.month() == df_aheadof_starttime['datetime'][ind].month()]
total_cf_val=cf_with_same_uprstrike['OPEN_PRICE '].sum()
# cf_with_same_uprstrike = cf_with_same_uprstrike.loc[cf_with_same_uprstrike]
aryc.append(data(df_aheadof_starttime['datetime'][ind],total_cf_val,cf_with_same_uprstrike['STR_PRICE ']))

Thank You in advance