Reputation: 477
Here is my code so far
def sbc(): #splits up dataframe by account
accounts = []
acc = raw_input("Enter account abbreviations one at a time. Enter 'end' to load media lists.")
frame = rlf()
while True:
if acc == 'end':
break
else:
accounts.append(acc)
for ac in accounts:
frame = frame[frame['Campaign'].str.startswith(ac)]
path = r'C:\\Users\\CP\\Documents\\Python_WL\\'+str(ac)+str(time.strftime("%d.%m.%Y"))+'.xls'
if len(frame) > 50:
frame.to_excel(path)
I want to be able to have multiple entries in 'account', however, when I run the program it only allows me to input one value. I doubly confused because another portion of code does repeat in the way I want it to for 'account' that code being:
def rlf(): #removes low fill rate
frame = rbs()
inputted_fill_rate = raw_input("Fill Rate cutoff? (Format: 0.nn): ")
return frame[frame['Fill Rate'] >= float(inputted_fill_rate)]
Upvotes: 0
Views: 55
Reputation: 76194
Move the raw_input
call to inside the loop. You probably also want to de-indent the for
loop.
def sbc(): #splits up dataframe by spotx account
accounts = []
frame = rlf()
while True:
acc = raw_input("Enter account abbreviations one at a time. Enter 'end' to load media lists.")
if acc == 'end':
break
else:
accounts.append(acc)
for ac in accounts:
frame = frame[frame['Campaign'].str.startswith(ac)]
path = r'C:\\Users\\CP\\Documents\\Python_WL\\'+str(ac)+str(time.strftime("%d.%m.%Y"))+'.xls'
if len(frame) > 50:
frame.to_excel(path)
Upvotes: 1