October 22, 2024
Chicago 12, Melborne City, USA
python

Return current angle of turtle in Python?

How can I get the current angle of the turtle? I need to check if the turtle is facing east or west (positive or negative) to make a DVD Video Screensaver. I’ve looked through every turtle function and through StackOverflow and I can’t find anything. You need to sign in to view this answers

Read More
python

Tensorflow errors: cuFFT, cuDNN, cuBLAS and “Assertion '__n < this->size()' failed”

I just started with TF and Keras and found out that I can’t run these on my computer. I’ve notice the problem first in jupyter notebook, and than recreate it in a python file. The code to reproduce (main.py): import os os.environ["KERAS_BACKEND"] = "tensorflow" import keras from keras import layers from keras import ops print("pass")

Read More
python

I can't install the Spacy library using the terminal in VSCode on Windows 10

I am trying to install the Spacy library in VSCode in a folder with a virtual environment. The output appearing in the terminal is excessively long; I will share it with a [pastebin](https://pastebin.com/xK9UYbEy) later. My version of Python is Python 3.13.0 and pip is pip 2.42, so they are up to date. I think the

Read More
python

Cannot connect to postgres databes over prisma python client. “prisma.engine.errors.EngineConnectionError: Could not connect to the query engine”

I am trying to use prisma python client to connect to postgres which is deploied locally in docker. However it always report error prisma.engine.errors.EngineConnectionError: Could not connect to the query engine. Can anybody help to resolve this issue? Note: I am using Nextjs as front-end and Python as backend, prisma works fine in nextjs and

Read More
python

how to convert string datetime representation to datetime field in pandas?

I have a csv , with text data (sample below) . id | name | date 123 | abc | 2024-08-05T21:00:26:074Z 456 | efg | 2024-08-05T21:34:30.502z I want to filter the data based on date field , for this , i tried to read/convert datetime string to date field but get , following error =>

Read More
python

Blending a LaTeX document with python package pylatexenc

I want to blend a LaTeX document. I thought I would use the pylatexenc package to parse the document, then run through the input structure blend the existing text and output the resulting structure. Is there an example program that I can derive the rest from for my own? I tried it, but had difficulty

Read More
python

botocore.errorfactory.AccessDeniedException: An error occurred (AccessDeniedException) when calling the GetCelebrityInfo operation:

I’m trying to run some of the rekognition examples from the "amazon-rekognition-developer-guide" github repo. I’ve created a user account with full Rekognition access and set the profile as per the instructions and can run the "python-detect-faces.py" on an image in an S3 bucket, but when I go to test others, I get an access denied

Read More
python

LookupError: unknown encoding: 'b'utf8''

I don’t know why, but I am getting a lookup error with an unknown encoding found, ‘b’utf8” when I try to scrape and parse Walmart’s web page. I have already set the encoding to utf-8 and also tried removing BOM, according to this post: lxml LookupError occured. Arguments: ("unknown encoding: 'b'utf-8-sig''",). Appreciate any help or

Read More
python

Run only a single chunk's worth of data without creating a Dask graph of all my chunks?

# Template xarray based on Earth Engine import numpy as np import pandas as pd import dask import xarray as xr # Define the dimensions time = pd.date_range("2020-12-29T18:57:32.281000", periods=3) X = np.linspace(-421600, 486700, 9084) Y = np.linspace(-599200, 458500, 10578) # Create a data array with random data for each variable data = np.random.rand(len(time), len(X), len(Y)).astype(np.float32)

Read More
python

How to have Mixed Linestyles and Colors in Matplotlib

I would like to create a line chart with two different line styles in a single chart while customizing the color in each line on a pandas dataframe. For example, if the below customer spends over 100, they are flagged as a "Premium" customer. Otherwise, they are a "Standard" customer. My goal is to plot

Read More