Quantcast
Channel: Active questions tagged python - Stack Overflow
Browsing all 20436 articles
Browse latest View live

BeautifulSoup scraping returns no data

I want to scrape a page from a website that includes the following HTML:<div class="section"><div ng-bind="1" class="item even">First item</div><div ng-bind="2" class="item...

View Article


'azure.iot.device.common.transport_exceptions.ConnectionDroppedError:...

I have multiple devices on Azure IOT hub, which I am trying to connect, send telemetry message and disconnect. This process is happening in multithread operation i.e., each device's operation is taking...

View Article


How to assign an image output from one pipeline to another pipeline?

I have these two pipelines in my Jupyter notebook.## Loading Diffusion Pipelinefrom diffusers import DiffusionPipelineimport torch##Image Generatingpipe =...

View Article

Accelerate and bitsandbytes is needed to install but I did

I'm trying to load quantization likefrom transformers import LlamaForCausalLMfrom transformers import BitsAndBytesConfigmodel = '/model/'model = LlamaForCausalLM.from_pretrained(model,...

View Article

How to properly perform kriging with external drift in python using pykrige

I have some groundwater levels that I would like to interpolate over a region. I also want to take into consideration the effect of the topography. Thus, I did some research and it seems to be pretty...

View Article


TypeError: Circle() takes 1 positional argument but 2 were given in Python...

I'm working on a shapes implementation in Python 3.10.12 and encountering a TypeError when trying to create a Circle object. Here's the relevant code:Here is the code for shape.pyclass Shape: def...

View Article

PATCH and PUT don't work as expected when pytest is interacting with REST...

I am building an API using the django REST framework.To test this API I am using pytest and the test client like so:def test_doesnt_find(self, client): resp = client.post(self.url, data={'name':...

View Article

AWS Glue returns 'ClientError: An error occurred (403) when calling the...

I am running a glue job in AWS account 'A', and accessing a file from s3 in AWS account 'B'. I have access to both accounts. When I run the code to pull sed file:bucket = 'bucket-name'filename =...

View Article


Image may be NSFW.
Clik here to view.

Python + facebook Prophet error in forecasting

Tell me what I'm doing wrong. I insert a time series into the prophet input, I get a forecast, but it looks like a repeating pattern. And absolutely nothing like the forecast.import pandas as pdimport...

View Article


Flask Docker Container Issues

I have a few questions that I am hoping someone can answer here. I realize I have knowledge gap and I am hoping someone here can fill it or at least point me towards the right direction.I had built a...

View Article

This account is not available: Unable to switch user in python alpine docker...

I have a simple DockerfileFROM python:3.10-alpine# Set environment variablesENV PYTHONDONTWRITEBYTECODE 1ENV PYTHONUNBUFFERED 1# Set argumentsARG USERNAME=jpgARG USER_DIR=/home/$USERNAMEARG...

View Article

Sphinx extension error (sphinxprettysearchresults): for event...

In my Sphinx project (Python 3.12.1, Sphinx 7.2.6 under Windows 10), when trying to generate the output HTML code using the "sphinx-build -E" command, I get the following persistent error:"Extension...

View Article

Pandas read_csv dtype read all columns but few as string

I'm using Pandas to read a bunch of CSVs. Passing an options json to dtype parameter to tell pandas which columns to read as string instead of the default:dtype_dic= { 'service_id':str, 'end_date':str,...

View Article


How to keep substring until character is found in Polars DataFrame?

I am working with a Polars DataFrame that contains a column with values like this:shape: (3, 2)┌──────────────┬──────────────┐│ A │ B ││ --- │ --- ││ str │ str │├──────────────┼──────────────┤│...

View Article

Polars join on array items without explode/groupby

a follow up from Polars lazyframe - add fields from other lazyframe as struct without a `collect`.I now want to join on array items. Currently the only way i know of doing this would be to first...

View Article


Fill nulls in Python Polars lazyframe by groups, conditional on the number of...

I have a large (~300M rows x 44 cols) dataframe and I need to fill in null values in certain ways depending on the characteristics of each group.For example, say we havelf = pl.LazyFrame(...

View Article

Polars - Flatten rows into columns, aggregating by column values

I'm trying to write a script in Polars that would flatten a list of prices per date and minute. The catch is I want to incrementally aggregate into columns and zero out values in the future. For...

View Article


How to create column based on other DataFrame row filter?

I have a LazyFrame called "hourly_data", which contains a hourly datetime column called "time".I also have a DataFrame called "future_periods", which contains two datetime columns called "start", the...

View Article

python diff SequenceMatcher - patching a list

i patch a list to look like another:a = [x for x in "qabxcd"]b = [x for x in "abycdf"]c = a[:]s = SequenceMatcher(None, a, b)for tag, i1, i2, j1, j2 in s.get_opcodes(): print ("%7s a[%d:%d] (%s)...

View Article

setting an array element with a sequence requested array has an inhomogeneous...

import osimport numpy as npfrom scipy.signal import *import csvimport matplotlib.pyplot as pltfrom scipy import signalfrom brainflow.board_shim import BoardShim, BrainFlowInputParams, LogLevels,...

View Article
Browsing all 20436 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>