''builtin_function_or_method' object is not iterable, for loop with list

I wish to do the following iteratively for a list of files of the form 'name.csv':

  1. Read the file in with pandas,
  2. Apply a function "datacropper" to the file
  3. Generate a .csv of the updated file using the pandas .to_csv command, with name of the form 'cut-name.csv'.

These steps all work separately outside of a for loop. However, when I iterate over the files, I get the error:

TypeError: 'builtin_function_or_method' object is not iterable

Below is my attempt. How can I bypass this error?

nameslist = ['pi89_1','pi89_ph7_1','pi89_ph7p48','pi89_ph6p49','pi89_ph7_2']

for i in range(len(nameslist)): 
    nameslist[i] = pd.read_csv("/path/to/file/" + str(nameslist[i]) + ".csv", index_col = 0)
    nameslist[i] = datacropper(str(nameslist[i]), 400, 800)
    nameslist[i].to_csv("/path/to/file/" + 'cut-' + str(nameslist[i]) + ".csv")


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source