Category "python"

Trigger A Python Script By Using JavaScript

I am doing a little project where i have prepared the back end in python and the graphic user interface woth HTML, CSS & JS. The python script doesn't requi

Azure Function App running old code when deployments are successful

My Linux Python function app is refusing to run the most recent code deployed to it. I've tried deploying via Visual studio code and GitHub which does work as I

Trigger A Python Script By Using JavaScript

I am doing a little project where i have prepared the back end in python and the graphic user interface woth HTML, CSS & JS. The python script doesn't requi

How to insert this values into the database properly?

I have a file name log.txt It's structure it's kind of like this: 2022-04-28 22:33:02,290\\INFO\\Database connection established 2022-04-28 22:33:07,470\\INFO\\

python random_sample to generate values

I am currently using random_sample to generate weightage allocation for 3 stocks where each row values add up to 1 and I rounded them to 2dp. weightage=[] n = 0

Searching for matching attributes

My special objects have one list of attribute-values (that is a varying list of abbreviated strings of short but differing length meaning some capabilities of a

How to extract data from Excel and output in txt file along with modified string using Python?

I have excel file with 2 tabs. First tab is "Summary" and 2nd tab is "Employee". The format of excel looks like below. Please note that below excel is for showc

Searching for matching attributes

My special objects have one list of attribute-values (that is a varying list of abbreviated strings of short but differing length meaning some capabilities of a

How to draw a vertical line with double left click while using blitting in matplotlib?

I'm trying to write a program which would let user to create vertical line on the chart in the place of double left click. Actually I already can write this kin

Create new column using keys pair value from a dataframe column

I have a data frame with many column. One of the column is named 'attributes' and in it has a list of dictionary with keys and values. I want to extract each ke

python converting a list of strings into variable names [duplicate]

Ok so Basically I have this list. pets = ["mypets","herpets","hispets"] and as this list was generated from reading the lines of a text file t

Python error TypeError: list indices must be integers or slices, not tuple

def convert(data): new_data = [] for id_users in range(1, nb_users + 1): id_movies = data[:,1][data[:,0] == id_users] id_ratings = data[:,2][data[:,0]

I don't understand how nodes work in a linked list [closed]

I have a basic understanding of usage of nodes, like node = node.next, and self.head, and things like node.next = self.head self.head = new_no

Flask SQLAlchemy Foreign Key Relationships

I'm having a lot of trouble getting my head around foreign keys and relationships in SQLAlchemy. I have two tables in my database. The first one is Request and

Packaging a Python script and the modules it needs

I developed a Python script that uses some libs (Pandas, Numpy, bs4, etc.). The problem is that the customer environment is shared, so I cannot install these li

Remove element from a list based on condition in pandas dataframe

a= {'A' : [1, 2,3,4], 'B' : ['FOOTBALL','BASKETBALL','HANDBALL','VOLLEYBALL'], 'C' : [[5,10,15,40],[1,4],[20,10,40],[10,40]] } How can I remove the element 40

Discord.py commands not running

** ** UPDATE: SOLVED Hi, So im making a bot with the code below in python and i cant figure out why the commands arent working in discord. the only one that wor

Asking the user for input until they give a valid response

I am writing a program that accepts user input. #note: Python 2.7 users should use `raw_input`, the equivalent of 3.X's `input` age = int(input("Please enter yo

Perform sklearn DBSCAN on PySpark dataframe column

I have a Spark dataframe that looks like this: +-----+----------+--------+-----+ |key1 |date |variable|value| +-----+----------+--------+-----+ | A49|2022

Upload file from html when block public access is true

I am using django-s3direct to file upload https://github.com/bradleyg/django-s3direct Using IAM role setting because I upload the file from the server on ECS co