I am trying to write a function in python that essentially splits the original CSV file into multiple csv files and saves their names. The code that I have written so far looks like this:
def split_data(a, b, name_of_the_file):
part = df.loc[a:b-1]
filename = str(name_of_the_file)
part.to_csv(r'C:\path\to\file\filename.csv', index=False)
The main intention of the code is to name each file a different name, which is the input (name_of_the_file). The code seems to work, but only saves the file as filename.csv.