Category "python"

Python task in azure

I'm trying to run this python task in azure pipeline. - task: PythonScript@0 inputs: scriptSource: 'inline' script: | import json i

Why the sum "value" isn't equal to the number of "samples" in scikit-learn RandomForestClassifier?

I built a random forest by RandomForestClassifier and plot the decision trees. What does the parameter "value" (pointed by red arrows) mean? And why the sum of

Python: split a video based on file size for streaming

I'm trying to figure out how to stream a video where the video is uploaded to google drive in pieces and downloaded in pieces for streaming. How do I split the

Update dataframe 1 using two columns in dataframe 2 in python

I want to update Freq column in df1 using Freq column in data frame 2 as shown below, data = {'Cell':[1,2,3,4,'10-05','10-09'], 'Freq':[True, True,True,True,Tru

Pygame Issue with importing a rectangle for a game [closed]

I have a small question about placing a rectangle in pygame. When I run the code i dont see a rectangle. Does anyone knows how to fix this? im

Is there a way to increase speed for video processing with opencv? [duplicate]

out = cv2.VideoWriter(output_file, codec, fps, (width,height)) while video.isOpened(): has_frame, image = video.read() if has_frame:

Accessing other classes attributes in Python

I want to design specific class hierarchy consisting of three classes: Certificate, Organization, User. Both Certificate and Organization seem to me to be kinda

How to add functionality to widgets (PyQt5 ) in separate .py

I'm struggling to understand the general structure of how to work with PyQt. I want to have my main file class MainWindow(qtw.QMainWindow): def __init__(self, *

How to upload and use images on heroku django

so i make this app in which you can make products. And those products have an image that was saved in a file while i was using this app localy. I deployed my ap

how to do advanced unit tests python

I am pretty new at unit tests and have seen fairly basic examples of mocks and doing asserts that test the return value of a function. I have a fairly advanced

How do I put gravity on a character in ursina engine?

(Python Ursina Engine) How can I add gravity on ursina engine?? Here is the code that I'm using: https://github.com/pokepetter/ursina/blob/master/samples/terrar

How to send form data to MongoDB using Flask

I'm a student and trying to make a simple image uploading API using form data and MongoDB. But I'm having hard time solving errors. I think it's the server side

What is the best mechanism to send data through queues in a multithreaded program?

I am making a multi-threaded application, where a main process sends messages to the appropriate thread through a queue. My doubt is in the part of the thread:

How Do I Upload A File To As A multipart/form-data using requests Library?

I Want To Upload A File To A Remote Server Through REST API, using python requests Library. The Server Has Provided The Below Form. <form enctype="multipart/

AttributeError: Can't get attribute 'PandasIndexAdapter' on <module 'xarray.core.indexing'

I am trying to unpickle a file but i get this error while running the following code: import pickle import pandas as pd import numpy unpickled_df = pd.read_pick

unrecognized character in header of csv

import csv def readCSV(filename, begin_date="01/07/2020", end_date="30/09/2020"): file = open(filename) csvreader = csv.reader(file) header = []

Is there unstack in NumPy?

There is np.stack in NumPy, but is there an opposite np.unstack same as tf.unstack?

fileinput.hook_compressed gives me strings sometimes, bytes other times

I'm trying to read lines from a number of files. Some are gzipped, and others are plain text files. In Python 2.7, I have been using the following code and it w

VSCode does not use conda environment when starting from the terminal

I'm using Visual Studio Code (VSCode) to do some Python programming on a Mac. I use conda for my Python environments. When I open a folder from within VSCode (u

Tensorflow doesn't work with gpu - too much memory is used. How to solve it?

I use tensorflow for image classification (20 classes) with convolutions. My dataset contains about 20000 train images and 5000 test images. Images (RGB) have 2