Category "python"

How To write a function to Check for a Sequence of integers in an array in python

I'm trying to figure out why the code I wrote to find a sequence of integers in any given array is not catching all the instances. Could you help, please? Here'

How to encrypt JSON in python

I have a JSON file. I am running a program, in python, where data is extracted from the JSON file. Is there any way to encrypt the JSON file with a key, so that

Linearregression of two dataframes

I have two dataframes: df = pd.DataFrame([{'A': -4, 'B': -3, 'C': -2, 'D': -1, 'E': 2, 'F': 4, 'G': 8, 'H': 6, 'I': -2}]) df2 looks like this (just a cutout; i

Problems with ABC/Interfaces using pydantic + Mixins pattern

Im trying to implement Mixin patter while Im using Pydantics BaseClass to facilitate the instantiation and validation of data from my class. The problem is that

How to adapt emcee to work with odeint numerical solution

I'm trying to constrain the function with the use of MCMC methods (emcee) without the analytical form of this function. I'm using the odeint to obtain the funct

How can I save the output of a convolution layer with and without a dilation rate as images

I want to save a image file to see about difference using convolution layer with dilation rate and without that. Of course I can search images about that, but I

how I can make my code much faster in python [closed]

Today I tried to answer one question with python but when I give it big inputs, output will come after 30 seconds. Question : in first line w

Can I use itertools.count to add values in a column, resetting at a certain point?

I'm trying to create a list of timestamps from a column in a dataframe, that resets after a certain time to zero. So, if the limit was 4, I want the count to ad

Cannot install any packages with pip I got this error ImportError: cannot import name 'appdirs'

When I try install any packages with pip or use pip I got the following error: ImportError: cannot import name 'appdirs' an Example: !pip install tweepy Tra

Why Python String auto convert into Date in microsoft excel

I am writing data into a CSV file. file contains data related to student marks like 6/10, which means 6 out of 10. here the issue is when I open this file with

Docker and playwright

Hi i have a instrucions that i need to isntall playwright inside of docker. This is my dockerfile FROM python:3.9 EXPOSE 8000 WORKDIR /fastanalytics COPY /re

how do I make a sphere rotate around another sphere in ursina, python

from ursina import * # update sphere_2 rotation def update(): line.rotation_y += 1 sphere_2.rotation_y += 1 app = Ursina() sphere_1 = Entity(model = '

panda df not showing all rows after loading from MS SQL

I'm using Pandas with latest sqlalchemy (1.4.36) to query a MS SQL DB, using the following Python 3.10.3 [Win] snippet: import pandas as pd

TypeErropr when running model_main_tf2.py

when running model_main_tf2.py on visual studio code 2022, I am receiving a type error. i will leave the code i am running, and the error statement below. i am

tkinter radio buttons are selected by default

I am using radio button selection to change a label widget in my window, I've just written this code to save myself having to write essentially the same thing f

`pymdownx.highlight` --- where do I find the "highlight" stylesheet used by syntax highlighting on fenced blocks?

I've been trying to write a Flask app which automatically converts Markdown into an HTML that will get served as the response. Consider the following toy snippe

Netmiko "Timed-out reading channel, data not available." for Juniper

I am using netmiko ConnectionHandler to push simple config to a Juniper device. But not sure why its throwing "Timed-out reading channel, data not available." t

Python pandas df.copy() ist not deep

I have (in my opinion) a strange problem with python pandas. If I do: cc1 = cc.copy(deep=True) for the dataframe cc and than ask a certain row and column: p

CyberArk ITATS004E Authentication failure for User in python script

I'm trying to implement a python script that executes local bash scripts or simple commands on remote CyberArk machines. Here is my code: if __name__ == '__main

ValueError: Shapes (None, 1) and (None, 3) are incompatible

I have a 3 dimensional dataset of audio files where X.shape is (329,20,85). I want to have a simpl bare-bones model running, so please don't nitpick and address