Category "python"

calculationg the mean from each Dataframe column

I've to write a function (column_means), that calculates the mean of each column from Dataframe and give me a list of means at the end. I'm not allowed to use t

how to print time in python in customized format? [duplicate]

how can I print time in format using python 220429 first two letters are last two digits of 2022, midle one are month and last two are day in

Dataframe extracted from email, ValueError: Cannot index with multidimensional key

A dataframe extracted from email (email saved to local disk, ".msg"), that I am not able to read its content. The dataframe extracted from email, when wrote to

Data problem: identifying data rows where colleagues have reached a consensus

I have a table that shows the results of four colleagues trying to classify several objects as either a, b, c or d. If the colleagues were able to agree on the

find top performing list of category which have highest number of orders in django

models.py class Line_items(models.Model): id = models.AutoField(primary_key=True) product = models.ForeignKey('Products' , on_delete=models.DO_NOTHING ) cl

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