Quantcast
Browsing all 13951 articles
Browse latest View live

scipy.ndimage import measurements. how to import 'label'

from pylab import *from scipy.ndimage import measurementsL = 100pv = [0.2,0.3,0.4,0.5,0.6,0.7]z = rand(L,L)for i in range(len(pv)): p = pv[i] m = z<p lw, num = measurements.label(m) area =...

View Article


Reordering a list of tuples to match the value of the next element in the list

If I have a list of tuples like this [(1, 3), (-6, 3), (1, 7)] and i would like to return a list like this [(7, 1),(1, 3), (3, -6)]. What can I do?, any ideas on how to sort the tuples. The essential...

View Article


raise DistutilsError(str(e)) from e distutils.errors.DistutilsError

I've made a recommendation system using python 3.9.2 using surprise library. Then my employer asked if i could make a website demonstrating the recommendation system. So I made one using flask. The...

View Article

Pyenv - Switching between Python and PySpark versions without hardcoding...

I have trouble getting different versions of PySpark to work correctly on my windows machine in combination with different versions of Python installed via PyEnv.The setup:I installed pyenv and let it...

View Article

ValueError: Found input variables with inconsistent numbers of samples in...

I'm encountering a ValueError in my Python code when trying to perform time series prediction using an LSTM model. The error specifically states:ValueError: Found input variables with inconsistent...

View Article


Image may be NSFW.
Clik here to view.

Python tesseract OCR to identify each digits within an independent and small...

I'm trying to utilize pytesseract or tesserocr to extract numbers from images. Have gone through few answers around this and have applied those, and those didn't solve my problem.For an example if I've...

View Article

Am I able to use just the sitemap for crawling? [closed]

I have a crawling project and I'm wondering whether I can use only the sitemap to pull the URLs. I want to get all the articles on blog pages for a bunch of websites. If I can stick with the sitemap,...

View Article

How can I copy API connections from my original resource group to another...

I'm trying to copy API connections from my source resource group to another resource group to serve a backup RG. The code I'm currently using is moving the API connection to another RG, so the target...

View Article


Methods with the same name in one class in Python

How can I declare a few methods with the same name, but with different numbers of parameters or different types in one class?What must I change in the following class?class MyClass:""""""...

View Article


Is there any option to return column/row value in pandas instead of printing

dataframe machineHi, Above is my data frame I want to execute .csh launch for given machine, is there any way to iterate and execute .csh instead of printing value using iterrows.for idx, row in...

View Article

Python - Rolling Indexing in Polars library?

I'd like to ask around if anyone knows how to do rolling indexing in polars?I have personally tried a few solutions which did not work for me (I'll show them below):What I'd like to do: Indexing the...

View Article

How to install ChartDirector?

I am trying to install the ChartDirector module for python. I downloaded, expanded it and put it in /Users/MyName/anaconda/lib/python2.7/site-packages/ChartDirector along with all the other modules I...

View Article

random positioned continuous sublist from list [closed]

I have a listL = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]I want to create a sublist w from L of fixed size length 4 . Start and stop are w are randomly chosen. Valid W are shown below[1,2,3,4]...

View Article


Context and logging(flask+pytest) for silenium

I am testing (pytest) an application on "Flask", I have an "href" link that I want to test (it makes a transition to another page), the problem is that this link I have by convention appears on the...

View Article

Outdated - CS50's Introduction to Programming with Python: Code does not break

I'm using the CS50's tutorials to teach myself python. I am trying to solve the 'Outdated' problem in problem set 3. The code works when I input date as 9/8/1636(i.e., correctly transforms date to...

View Article


SQLAlchemy error in Python 3.11 when trying to initialize a table; It used to...

Running the code below. It used to run in version Python 3.8. Recently I upgraded to 3.11 and it stopped working. I upgraded both sqlalchemy and pyodbc.I have longer code but posting up to the first...

View Article

Is Python type safe?

According to WikipediaComputer scientists consider a language "type-safe" if it does not allow operations or conversions that violate the rules of the type system.Since Python runtime checks ensure...

View Article


Unable to read PDF file and extract text

def input_pdf_text(uploaded_file): # Open the PDF file in binary mode with uploaded_file as file: # Create a PdfReader object to read the PDF reader = pdf.PdfReader(file) text=""# Loop through each...

View Article

Vs code, enviroment variables breaks

after I change my path in Environment Variables. my vs code shows this when I try to edit a python file.We detected an issue with one of your environment variables that breaks features such as...

View Article

Image may be NSFW.
Clik here to view.

Retrieve text from video frames via pytesseract

I've been searching through posts trying to find ways of improving performance on the below script but can't seem to get anything to make much difference. Through tests I've managed to conclude that...

View Article
Browsing all 13951 articles
Browse latest View live