Category "python"

Convert simple expressions into JsonLogic format

Using python, I need to convert expressions into JsonLogic format. Expressions such as Boolean expressions, if else / ternary expressions, etc. Any suggestions

Selecting data from a pandas DataFrame

I have defined a pandas DataFrame, given the number of rows (index) and columns. I perform a series of operations and store the data in such DataFrame. The code

Value error in convolutional neural network due to data shape

I am trying to predict the of number peaks in time series data by using a CNN and keep on getting a data shape error. My data looks as follows: X = list of 520

DataFrame VWAP Does not match TradingView

Not sure why I cannot get my DataFrame VWAP calculations to TradingView version at this link: https://www.tradingview.com/support/solutions/43000502018-volume-w

WUnderground, Extraction of Extremes Today

As contributor to WUnderground not a problem to read via API-call the JSON-outputfile with Today's values for my station. That JSON-file has a series of numbere

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