Index 156 is out of bounds for axis 0 with size 1

I am trying to find elevation of points from the .csv file by taking in the lat and long coordinates for those points and finding the related pixel in the DEM (tif file). But I am getting an error and I don’t know how to resolve this. Error queries in internet are like “index x is out of bounds for axis 0 with size x”, but none suits my issue. Please help me with this. This is the link to the datafiles - data

import geopandas as gp
import matplotlib.pyplot as plt
import rasterio as rio
import shapely as sh
import pandas as pd

raster = rio.open('montreal_30m.tif')
band = raster.read()
POI = pd.read_csv('montreal_poi.csv',header=None)

# find elevation for each POI
for i in range(len(POI)):
    px,py=raster.index(POI[3][i],POI[2][i])
    elevation = band[px,py] ------------------------------------- # index 156 is out of bounds for axis 0 with size 1# This is the error
    print(elevation)

Hi There,

I am not sure this is a psychopy specific error (more a general python one) so it might also be worth exploring stack overflow for solutions to errors like this (for example here is a relevant similar error post).

This error looks like it is likely to do with the size of the array now being as large as you expect, so I would advise printing the length of elevation to check it out and then see why the size of band is not as you expect.

Hope this helps send you in the right direction!
Becca