Category "python"

Geopy distance between two point tuples of (lat, lon) coordinates

I've been trying to measure geographic distance between points in a GeoDataframe (gdb['geometry']) and one specific point, let's say, b_xy. gdb['geometry'] is a

Is there a more Pythonic way to write this? Filling multiple lists to desired length

I'm struggling with making my lists of strings a DataFrame because they are different sizes. So, I'm running code to get the length of the largest list and then

Error Using Ajax when I load from a differente file with Django

Im using JaxaScript(Jquery with Ajax) and my HTML Page all in the same file, but when I tried to code my JS and HTML in different files, I get an error when try

k-diff sequences in a float array

Looking for an algorithm to find longest sequences (pairs, triplets, up to quadruplets) that are separated by a constant, non-integer difference k in a sorted a

Error: pandas hashtable keyerror

I have successfully read a csv file using pandas. When I am trying to print the a particular column from the data frame i am getting keyerror. Hereby i am shari

How to include Variables file that is part of an installed pip package

I'm currently having trouble including a Robot Framework "Variables" file that is contained within a python pip package. I can successfully include files in thi

Flask app can't load CSS file from static folder

So my file directory looks like this: /templates --base.html /static --/css ----base.css In the of my base.html file I have this line: <link rel="styleshee

running exec inside a function when calling a module

I'm trying to assign a module's attribute to a variable using exec inside a function. color is a str like: 'jet', 'seismic', 'nipy_spectral', or something else.

scikit-learn GridSearchCV() fit() performance improvement

I am using GridSearchCV() and its fit() method to build a model. I currently have this working, but would like to improve the accuracy of the model by supplying

SHAP explainer identifies wrong framework

I want to use the SHAP-DeepInterpeter on the Braindecode Shallow_FBCSP-Model which is based on pytorch. The training and testing works perfectly fine on the mod

ValueError: setting an array element with a sequence while using MLPCLassifier on classifier.fit

I have this dataset (shape is (36,2)). x is a numerical pattern, y is a binary class (0,1) x y [0.2, 0.3, 0.5 ..... 0.5] 0 [0.1, 0.4, 0.5 ..... 0.9] 1 and so

I keep getting 'None' when getting enviroment variables

I'm trying to keep my token in an enviroment variable, so I created the file .env, and I stored the TOKEN there: TOKEN=XXX When I run my .py file, I can't get

How to apply Target Encoding in test dataset?

I am working on a project, where I had to apply target encoding for 3 categorical variables: merged_data['SpeciesEncoded'] = merged_data.groupby('Species')['Wnv

pycaret.time_series.TSForecastingExperiment ImportError: cannot import name '_check_param_grid' from 'sklearn.model_selection._search'

I am getting the below error, while importing Pycaret time-series(beta) module in the databricks (we were running successfully earlier). Request your help in so

Share django transaction across threads

I've a problem where one API implemented in a django (3.2) web app running with gunicorn (gevent) has to fetch different prices from multiple APIs and store tho

Why is Tensorflow image classification model overfitting? [closed]

I've been working a food image classification model. I started off with the TensorFlow tutorial and modified the model (code below). The model

Scraping google play reviews

I am new to programming and I have recently tried to scrape google play reviews with python using the following program: from bs4 import BeautifulSoup import u

How to invoke Cloud Function from Cloud Scheduler with Authentication

I've looked everywhere and it seems people either use pubsub, app engine http or http with no auth. Not too many people out there showing their work for accessi

Python multiprocessing with macOs

I have a mac (MacOs 10.15.4, Python ver 3.82) and need to work in multiprocessing, but on my pc the procedures doesn’t work. For example, I have copied a

Sympy : simplification with expression substitution

I have several expressions involving the norm or norm squared of a vector u. I'd like to simplify these expressions by substituting a known value for the norm o