Category "python"

Chaining Pandas DataFrame Styles

*edited DataFrame random generator I have 2 dfs, one used as a mask for the other. rndm = pd.DataFrame(np.random.randint(0,15,size=(100, 4)), columns=list('ABCD

how to apply a format on multiple excel files at once (hide gridlines & autofit columns)

I'm trying to apply a specific format on an iterate excel files, i need to hide the gridlines and autofit columns width, i tried many codes and styles but no on

Python's tqdm progress bar in IDLE

I have problems using the Python tqdm progress bar with IDLE. Instead of displaying a dynamic progress bar, as it happens in Jupyter, IDLE prints new progress

CV2 cap.set(1,idx); cap.read(), Does it Read Frame idx or Frame idx+1

In CV2 will this chunk of code read the frame for the given frame number or the next frame? desiredFrames = [3,5,7,n] cap = cv2.VideoCapture("somefile") for id

Separate field name and value from long line in python

I have python custom data like this: (item_id[s]-b2tc34x;item_name[s]-Fan Blade;item_price[i]-2450)(item_id[s]-b3td42h;item_name[s]-Fan Cable) note: parentheses

list of strings exist within a list of dict keys?

I have a list of strings: ignore_list = ["new job", "encountered error", "SLA"] and a list of dictionaries: ticket_list = [{"Title": "new job to action", "Leve

Add 1 hour to time from user input

I'm coding a script that asks the user for a time (24 hour format), and then adding 1 hour to the inputted time. Later on in my script, I add the time that it g

Read edgelist of directed Graph

I am trying to apply different clustering methods to my networkx Graph, which is quite big (2631 edges and 2179 nodes). For that to work I would like to build/l

Analysing words in dataset based on training data

I have a training dataset for eg. Letter Word A Apple B Bat C Cat D Dog E Elephant and I need to check the dataframe

ExceptionIgnored error: SIGALRM Timeout handler

I made a custom timeout handler using the SIGALRM signal but very rarely I get an error saying that TimeoutException was 'ignored'. Timeout handler code: def ti

What would be the correct merge function in this pandas dataframe?

df.head() index match_datetime country league home_team away_team home_odds draw_odds away_odds predicted_home_sco

using argparse, getting KeyError

import argparse import imutils import cv2 as cv ap = argparse.ArgumentParser() ap.add_argument("-i", "--input image", required=True, help='Input the Image') a

Read images from url and put them on a dataframe column with the label to another column in python

I would like to read images from url and place them on a pandas dataframe column and place label to another another column. How can I do that please help. Below

Raise an error when a key is duplicated in a dictionary

I've created a code that reads in a text file and converts the lines to a dictionary. How do I raise an error if there is more than one key with the same value?

Python - Keras : Merge two models into one sequential

How do create one model sequential with two models? I have two models, one a Keras application (vgg16 model) and a custom model and I would like to merge them i

how to send information(data) from a FastAPI server(client) to another FastAPI(model)

I am a newbie in RESTful API... so I am trying to deploy two servers (client and model). The main idea is : Client uploads his images on the client server, the

Nested list creation from a single list with given range [duplicate]

I have a list li = [1,2,3,4,5,6,7,8,9] How do I form a nested list for a given range? lets say if the range is 3 I want the output as [[1,2,3]

Why is lambda not working property 'value'?

this df2['CLINE_TYPE']: Increase_FALSE Decrease Increase_FALSE Increase_SUPERPOSITION Decrease_FALSE Increase Increase_SUPERPOSITION Decrease_FALSE Increase Inc

Word2Vec + CNN Overfitting

Currently I'am training my Word2Vec + CNN for Twitter sentiment analysis about COVID-19 vaccine domain. I used the pre-trained GoogleNewsVectorNegative300 word

Why doesn't text fit in rectangle drawn

I created a rectangle using Zelle graphics.py and wrote text of 10 points into many lines down the long narrow rectangle. Words fit from the left to right side