-1

Create a program, presidents.py, that takes two arguments. These arguments will correspond to the start and stop of a slice, respectively. It will slice the heights column in the president_heights.csv files.

x = input("Enter first number:")
y = input("Enter second number:")
result = df.iloc[:x,y].mean(axis=0) print(result)

Getting error:

Location based indexing can only have \[integer, integer slice (START point is INCLUDED, END point is EXCLUDED), listlike of integers, boolean array\] types

Woodford
  • 3,746
  • 1
  • 15
  • 29

1 Answers1

0

You need to cast the input to an int

x = int(x)
y = int(y)
BCT
  • 193
  • 8
  • When i added the input to in; i am getting this error now:- IndexError: single positional indexer is out-of-bounds – Kunal Sen Mar 21 '22 at 21:53