Category "python"

How to chain, and then "unchain" a nested list?

I have a nested list that I need to chain, then run metrics, then "unchain" back into its original nested format. Here is example data to illustrate: from iter

azure blob python library - hanging on readinto() function

I have been struggling with an application hang, randomly, I have a very large number of files to download (~100k), after a random number the script will hang,

Extracting a .7z File into a Pandas Data Frame

I am Using a Jupyter notebook (google colab) to try and extract data from a .7z file into a pandas dataframe, using linux commands. The data is from http://untr

Error in from torch.utils.data import utils

Following is the code used with PyTorch 1.0.1 import torch import torch.utils import torch.multiprocessing as multiprocessing from torch.utils.data import DataL

use getpass in visual studio code

I am using this code: import getpass pwd = getpass.getpass(prompt = 'Please enter password:') Unfortunatley I cannot enter anything in the terminal. Am I miss

Real time detections not happening without creating a 5 second delay

I trained a deeplearning model (EfficientnetB0) and now using OpenCV, I want to make real time predictions on the model. But I am unable to do so without creati

How can i get it to increment and print whenever i press the key, not just once?

With the below program, whenever I press the "a" key, the keypresses variable increments by 1. The problem is, if I don't immediately let go fo the key, the key

Empty output using trino dbapi in python

I am getting empty output in the below code but when I remove the part of and I get the desired output. Can anyone clarify if there is any error in syntax of be

Installation error OpenCV 4.5.5 from source code in Windows

I was trying to install OpenCV-4.5.5 from source on my windows machine. This machine has the latest Nvidia drivers as well as CUDA 11.6, I did not run into any

python replace env params in a string which is not a path

Patterns I can receive can vary and I have used line1 = "$ABC/xyz" line2 = "123_$ABC_xyz" line3 = "abc_$XYZ_123_def_$ABC" line4 = "$XYZ_def_abc" exp = os.path.e

What does the .shape represent in Python?

I wanted to know what this represents, meaning, what does this tell me: len(array.shape) the array being a random np.array Thank you!

Alter multiple column comments simultaneously in spark/delta lake

Short version: Need a faster/better way to update many column comments at once in spark/databricks. I have a pyspark notebook that can do this sequentially acro

How can i flip Case from upper to lower case and from lower to upper case in python3

My problem here is that i am trying to flip the letter cases for example: Experiment = "ChocoLate" if str.isupper(Experiment): print(str.lower(Experiment))

Problem scraping Bet365 with headless mode

A few days ago I started the development of a bot to capture data/results from virtual sports (specifically football) at Bet365 (note: I know this is not allowe

AttributeError: module 'cv2' has no attribute 'VideoCapture'

I had some problems with Opencv - cv2 in Python. This attribute problem also happens with "imread." I tried to uninstall and reinstall with contrib-Opencv,but i

Calculate Decay Rate in Python

I have dataset which somewhat follows an exponentional decay df_A Period Count 0 1600 1 894 2 959 3 773 4 509 5 206 I want

How to retrieve file paths from a tf.data.Dataset created with from_tensor_slices() and shuffled after every epoch

First of all, I would like to say that this is my first question in stackOverflow, so I hope that the question as a whole respects the rules. I realize that the

Create numpy array from function applied to (multiple) pandas columns

I have pd.DataFrame containing rows of values: import pandas as pd df = pd.DataFrame({"col1": [1, 2, 3, 4, 5, 6], "col2": [6, 5, 4, 3, 2, 1]}) I now want to f

Is there a way to call opstrat package function in dash (python)

I have a project for the university and I need somehow to call opstrat plots in dash and I don't think it is supported. Opstrat library has very specific plots

copy/clone of keras subclassed models with custom attributes

I have a subclassed model with some custom attributes like this: class MyModel(tf.keras.Model): def __init__(self, *args, my_var, **kwargs): super()