'Matching specific indices of columns using pandas

I wrote the following code (it is part of the code) where I am adding crosses in specific positions to several images. I get the coordinates of the positions for each image from a CSV file. I wrote a code but it adds all the positions on all images. I want to add the marks that represent the positions that correspond to their image. Could you help?

import pandas as pd
from osgeo import gdal  
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import os
import glob


for image in target_data['Region']:
    images_path = os.path.join('path',str(image)+'*.TIF')
    full_name = (glob.glob(images_path))
    if full_name == []:
        print( image + ' does not match any region in the specified path')
    else:
        print(full_name[0])
        print(type(full_name[0]))
        img =  gdal.Open(full_name[0], gdal.GA_ReadOnly)
        rb = img.GetRasterBand(1)
        img_array = rb.ReadAsArray())
        imgplot = plt.imshow(img_array)
        plt.imshow(img_array) # plot image
        x = target_data['X'] # X is a column in the CSV file that has all the X_coordinates
        y = target_data['Y'] #Y is a column in the CSV file that has all the Y_coordinates
        size = 50 # size of marker
        plt.scatter(x, y, size, c="r", marker="+") # plot markers
        plt.show()

You can find a sample of the data in this link. I am not sure if I can share an image from my data, so it would be appreciated if you try it on any image online.

https://easyupload.io/vlpkl7

The column 'Region' represents the images' names in my folder



Solution 1:[1]

The app is looking for the API_SECRET_KEY config value to be defined, but it is not. This is causing the params.API_SECRET_KEY.length line to error, as it cannot call .length on params.API_SECRET_KEY due to it resolving as undefined.

You can follow the Heroku documentation to add this config value to your Heroku app. It seems as though the blog has it mislabeled as SHOPIFY_API_SECRET_KEY so you may just need to rename that config value to match what your application is expecting. You may hit the same error with SHOPIFY_API_KEY just being API_KEY as well, so be on the look out.

heroku config:set API_SECRET_KEY whateverYourKeyIs

Solution 2:[2]

The correct config vars are:

SHOPIFY_API_KEY

SHOPIFY_API_SECRET

I furthermore had to configure HOST and SCOPES.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dan Starner
Solution 2 Robert Walther