Category "python"

'_ctypes' module missing when python is installed via pyenv

I am trying to set up an environment using pyenv and homebrew on Ubuntu 20.04. There are no problems with my system install of python. However, when I install a

trying to send data from one script in python to another script

I am trying to write a script so when an IP address can't be seen a message gets sent with a telegram letting me know which computer is offline I have been able

When is a class decorator called?

I am using the stanza NLP library which uses a decorator to register processors. Stanza has a help page for building your own processors here They use a class

How does ctypes define the class for C structure with function pointer only and init the variable in python?

I'm working on the python with ctypes to call the c so file, but the c file define the structure with function pointer // mem ==================================

Combine multiple dataframes wit pandas

I use the following script to measure the average RGB color of the picture in a selected path. I tried to make 1 dataframe with pd.concat but it doesn't work ou

Cannot Access the Local Host on Python 127.0.0.1:8000 in browser

from django.contrib import admin from django.urls import path, include urlpatterns = [ path('admin/', admin.site.urls), path('products/'),include('prod

Building a Random Forest Classifier with equal output probabilities to a Decision Tree Classifier

I have been trying to build a RandomForestClassifier() (RF) model and a DecisionTreeClassifier() (DT) model in order to get the same output (only for learning p

Blender Addon in file menu

I have created a blender addon watching videos as I do not have knowledge of python. So I want to place that addon in Blender file menu but it is deleting all t

How can I get path of 3rd party app in Django settings.py

I install django_celery_beat app in Django settings.py file INSTALLED_APPS = [ ..., 'django_celery_beat', ] It has its own locale dir. As I understand I need

How to skip pycaret data type validation step in docker

While we create a pycaret setup, e.g.: from pycaret.regression import all exp_reg101 = setup(data = data, target = 'Price', session_id=123,preprocess=False) I

Zernike moment as Shape descriptor doesn't work

I m working to create a CBIR, I want to use Zernike moment to get shape feature of a query image. I try to implement it by following this tutoriel: https://pyim

Calling function from for loop - issue with parameters: NameError: name 'row' is not defined

I am calculating commute distances (home to offices) for all employees. This works for a single office with this piece of code: #Calculate distances from home t

Extract heading and content from an HTML page using a visual approach in Python

I'm looking for a way to extract the heading and content from raw HTML. There are a couple of Python packages out there which does this (Newspaper3k, python-rea

How to replace jupyter-notebook magic with python script

I have been using some jupyter notebook magics such as %matplotlib inline. How to load them using python script instead of % signs. Using jupyter %load_ext sql

Evaluating strings without eval()

In Python, can I evaluate a string (eg. “math.sin(3)+max(5,3)”) without using the dreaded eval(), and preferably with Decimal precision? Note: it is

Nested bar plots with three y axis using seaborn package

Using the python seaborn package I was trying to plot the nested bar graphs with three different y-axes as shown in the below figure: And the code that I have

group time stamps based on intervals

I have a dataset that looks like this: main_id time_stamp aaa 2019-05-29 08:16:05+05

asyncio.run() cannot be called from an event loop

I'm trying to call a function in async function and the problem is asyncio.run() don't work in a loop event Here is the RuntimeError: asyncio.run() cannot be c

Function not executing in telethon

If I start the client at the beginning of the script api_id = 123254534 api_hash = '124324235543' client = TelegramClient('parslon', api_id, api_hash) client.st

Check if number should be C++ float or C++ double using python

I am working on a simple C++ code generator created by excel parsing and I will need to distinguish between number type. I can deduce integer size (e.g. uint_32