Category "python"

Infer type from subclass method return type

I'm trying to infer a type from the returned type of a subclass method. So far I haven't been able to make this work without making Parent a generic class (whic

What is a lifecycle of Aiohttp application when used together with Gunicorn?

A project I'm working on uses Gunicorn and Aiohttp to implement a web server. It all starts with something like this: # main.py class GunicornApp(gunicorn.

Problem in performing peak calling with macs2

I am trying to install the WACS algorithm which is an extension of macs2 callpeak (available on software page of Perkinslab). In the process, I created a new co

how to read .FIC .NDX file with Python

I want to read a .fic file and extract data using python, this file is created by old version windev is any solution exist ? I found these files in the database

How can I group elements in pandas series based on how many times they repeat?

I have this example_series: 0 False 1 False 2 False 3 False 4 False 5 False 6 False 7 False 8 False 9 False 10 False

What is the best way to work with classes that subclass from Generic types?

Assume we are given a generic class definition such as: from dataclasses import dataclass from typing import TypeVar, Generic, List T1 = TypeVar('T1') T2 = Ty

TypeError: __init__() got an unexpected keyword argument 'as_tuple'

While I am testing my API I recently started to get the error below. if request is None: > builder = EnvironBuilder(*args, **kwargs) E

Assign outcome from SQL query to column

I have a dataframe (test_df) that looks like this: dq_code dq_sql Results ID_24 select 'A' as B, 'B' as

Python Jupyter Notebook: Embed an interactive plot in the _repr_html_() method of a class

I am trying to embed an interactive graph in the _repr_html_() method of a class C. What I have tried so far does not seem to be working in my Jupyter Notebook.

Doxygen's double hash-tags / number-signs (##) are not PEP8 conform (E266)

To document class members in Python for Doxygen you have to annotate them with two number-signs / hash-tags (##). class Foo: def __init__(self): ## This i

Bilinear interpolation on quadrilateral

I am interpolating data from the vertices of a quadrilateral to any random point inside the quadrilateral. I implement this by first doing a coordinate transfor

finding the first instance of a 10 digit number after a different search parameter in python using regex

I have a binary file in which I need to find if it contains a error message "MCPS" and if it does, I need to find first instance of a 10 digit number after that

How to get rid of red underlines in PyCharm? [duplicate]

I do not know how to get rid the red underlines in PyCharm IDE? How to resolve this tackle?

update dictionnary through a list

I have this problem in my dictionary I have this list : l=['a','b','c'] so I'd like to append it in my list of dictionary d=[{ "type": "text",

Issue with the prediction error plot using the yellowbrick library (regression)

I have three models for regression: linear regression: using ols_regressor = sm.OLS() random forest: using rf = RandomForestRegressor() artificial neural networ

PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: after installing python-certifi-win32

I installed python-certifi-win32 package and after that, I am getting below error, when I import anything or pip install anything, the fail with the final error

How to change from reading files to sys.stdin.readlines()

Here is my original code. f = open("p3.in","r") while True: n = f.readline() print(n) if n == 0: break Map = [[0 for i in range(n)] for

Epipolar line using essential matrix for calibrated camera is wrong

I wanted to get the essential or fundamental matrix for calibrated cameras (R, T, Ks are given). There are two cameras. Is this step correct to get the essentia

Any efficient analogue of argsort for array of indices with NumPy?

I have an array of indices like a = [2, 4, 1, 0, 3] and I want to transform it into np.argsort(a) = [3, 2, 0, 4, 1]. The problem is that argsort has O(n*log(n))

How to make joining a voice channel by numeric code?

I have a question, please tell me how to implement slash command as in the screenshot. (I mean /join number). I will be extremely grateful. Thanks in advance fo