1
df = pd.read_excel('StartAdding.xlsx')

startfrom,endto = df.loc[df['Session'].str.contains(session_name, case=False),['Start','End']].squeeze()

n = 0

for user in users:
    
    if (int(startfrom) <= int(user['srno'])) and (int(user['srno']) <= int(endto)):
        n += 1
        if n % 50 == 0:
            sleep(900)

I'm getting ValueError: invalid literal for int() with base 10: 'Start' at line 84.

Any help or anyone know why this is happening? I am trying to read startfrom and endto from excel below. enter image description here

JiaHao Wang
  • 101
  • 3
  • 13
  • Please don't use pictures of text, just extract a [mcve] from your code and copy that into the question. That said, please also search for the error message online, it's trivial to find explanations! – Ulrich Eckhardt Jul 16 '21 at 05:59
  • You are reading the column headers (```Start```) and converting them to ```int```. That is why the error. Try ```for user in users[1:]``` – Ram Jul 16 '21 at 06:00

1 Answers1

0

You line 78 should be:

startfrom, endto = df.loc[df['Session'].str.contains(session_name, case=False), ['Start', 'End']].values.tolist()[0]

Instead of:

startfrom,endto = df.loc[df['Session'].str.contains(session_name, case=False),['Start','End']].squeeze()
U13-Forward
  • 69,221
  • 14
  • 89
  • 114