coordinates

How could I pair up x and y generated by np.meshgrid using python?

How could I pair up x and y generated by np.meshgrid using python? Question: I’m trying to generate a 2-dim coordinates matrix using python. I’m using x=np.linespace(min, max, step) y=np.linespace(min, max, step) X, Y = np.meshgrid(x, y) to generate x and y coordinates, where X like: [[0. 1. 2. 3. 4.] [0. 1. 2. 3. …

Total answers: 2

Split a Pandas column into multiple columns

Split a Pandas column into multiple columns Question: I have some coordinates in a csv file, formatted as [51.447084, -0.081564] that i’m reading into a pandas dataframe. I want to split them into 2 separate columns. I’ve tried df[[f’Column {i}’ for i in range(2)]] = df[‘event_location’].tolist() which didn’t work as my output was: event_location Column …

Total answers: 1

Folium initial map coordinates location not working

Folium initial map coordinates location not working Question: I’m using folium to plot some coordinates and every time I run the code it opens the map at some default coordinates instead of the ones I’ve defined. I tried: import folium import pandas as pd # includes only an example route, dict contains N keys with …

Total answers: 1

Changing the position of coordinate points randomly in a graph using python

Changing the position of coordinate points randomly in a graph using python Question: I have a dataframe of 16 coordinate points. import pandas as pd import matplotlib.pyplot as plt data = {‘x’: [-0.3162277660168379967, -0.3162277660168379967, -0.9486832980505139901, 0.3162277660168379967, 0.9486832980505139901, -0.3162277660168379967, -0.3162277660168379967, -0.9486832980505139901, 0.9486832980505139901, 0.3162277660168379967, 0.3162277660168379967, 0.3162277660168379967, 0.9486832980505139901, -0.9486832980505139901, -0.9486832980505139901, 0.9486832980505139901], ‘y’: [-0.9486832980505139901, 0.3162277660168379967, 0.9486832980505139901, 0.3162277660168379967, -0.3162277660168379967, 0.9486832980505139901, …

Total answers: 1

Pyautogui taking screenshot of a region like sharex does

Pyautogui taking screenshot of a region like sharex does Question: I am trying to make a program using pyautogui to screenshot a part of my screen. Everything is working as I intend it to, except when I click on the screenshot button, the only way I found to make it possible for me to choose …

Total answers: 1

How to convert window coords into turtle coords (Python Turtle)

How to convert window coords into turtle coords (Python Turtle) Question: I am trying to create a program to move the turtle to where the mouse is. I am doing: import turtle t = turtle.Turtle() canvas = turtle.getcanvas() while True: mouseX, mouseY = canvas.winfo_pointerxy() t.goto(mouseX, mouseY) but the turtle keeps moving off the screen. I …

Total answers: 3

Calculate lat/lon of 4 corners of rectangle using Python

Calculate lat/lon of 4 corners of rectangle using Python Question: I need to find the latitude and longitude coordinates of the four corners of a rectangle in a Python script, given the center coordinate, length, width, and bearing of the shape. Length and width are in statute miles, but honestly converting those to meters is …

Total answers: 3

Round decimals of numbers in Python

Round decimals of numbers in Python Question: I have a list, each row contains 4 floats (should represent a bounding box) [[7.426758, 47.398349, 7.850835593464796, 47.68617800490421], [7.850835593464796, 47.398349, 8.274913186929592, 47.68617800490421], [8.274913186929592, 47.398349, 8.698990780394388, 47.68617800490421]] I would like to round each float to 6 decimal places. I tried to round the numbers using pandas, but it also …

Total answers: 1