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 ='montreal_30m.tif')
band =
POI = pd.read_csv('montreal_poi.csv',header=None)

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

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!