Q:

Data Analysis: TypeError: 'module' object is not callable

Im cleaning some data and encountered the TypeError and I haven't been able to figure out exactly what is wrong with my code. Any help would be greatly appreciated, thank you!
# use loop to merge date and time into DateTime (w/progress bar)
def create_datetime_axis(daf):
    datetime_axis = []
    for row_n in tqdm(range(len(daf))):
        srs = daf.iloc[row_n, :]
        datetime_axis.append(datetime.strptime(''.join((srs['DATE'], srs['TIME'])), '%m/%d/%Y%H:%M').strftime('%m/%d/%Y %H:%M'))
    return datetime_axis
In [61]:

# drop the TIME column and replace the DATE column with the new and improved DATETIME
filtered_df = df.copy()
filtered_df['DATE'] = create_datetime_axis(filtered_df)
filtered_df.drop('TIME', axis=1, inplace=True)
filtered_df.rename(columns={'DATE':'DATETIME'}, inplace=True)
filtered_df

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-61-f651516bbd66> in <module>
      1 # drop the TIME column and replace the DATE column with the new and improved DATETIME
      2 filtered_df = df.copy()
----> 3 filtered_df['DATE'] = create_datetime_axis(filtered_df)
      4 filtered_df.drop('TIME', axis=1, inplace=True)
      5 filtered_df.rename(columns={'DATE':'DATETIME'}, inplace=True)

<ipython-input-60-0e8f272e1aee> in create_datetime_axis(daf)
      2 def create_datetime_axis(daf):
      3     datetime_axis = []
----> 4     for row_n in tqdm(range(len(daf))):
      5         srs = daf.iloc[row_n, :]
      6         datetime_axis.append(datetime.strptime(''.join((srs['DATE'], srs['TIME'])), '%m/%d/%Y%H:%M').strftime('%m/%d/%Y %H:%M'))

TypeError: 'module' object is not callable

A:

I think you need to change it to: 
# use loop to merge date and time into DateTime (w/progress bar)
def create_datetime_axis(daf):
    datetime_axis = []
    for row_n in tqdm.tqdm(range(len(daf))):
        srs = daf.iloc[row_n, :]
        datetime_axis.append(datetime.strptime(''.join((srs['DATE'], srs['TIME'])), '%m/%d/%Y%H:%M').strftime('%m/%d/%Y %H:%M'))
    return datetime_axis

or change your import tqdm to from tqdm import tqdm

