QuestionId int64 74.8M 79.8M | UserId int64 56 29.4M | QuestionTitle stringlengths 15 150 | QuestionBody stringlengths 40 40.3k | Tags stringlengths 8 101 | CreationDate stringdate 2022-12-10 09:42:47 2025-11-01 19:08:18 | AnswerCount int64 0 44 | UserExpertiseLevel int64 301 888k | UserDisplayName stringlengths 3 30 ⌀ |
|---|---|---|---|---|---|---|---|---|
77,543,201 | 1,228,532 | Using `Unpack` on `TypeVar`s to dynamically generate function signatures | <p>I'm trying to dynamically generate the function signatures for child classes of <code>_AbstractGameObject</code>. I have successfully experimented with <code>Unpack</code>ing the concrete <code>TypedDict</code>s in the child classes but wondered why I need to do that if can define the <code>Unpack</code> in the base... | <python><mypy><python-typing> | 2023-11-24 12:36:47 | 1 | 653 | James N |
77,543,062 | 3,239,855 | Monitor function calls inside python contexts | <p>Using python I would like to:</p>
<ul>
<li>monitor execution of some 'selected' functions (I would like to record function name, execution time, etc.)</li>
<li>store these info only when functions are executed inside a context</li>
<li>if these contexts are nested, info should be recorded in all parent contexts</li>... | <python><python-dataclasses> | 2023-11-24 12:15:57 | 1 | 304 | hari |
77,542,849 | 12,454,639 | Very close to having a working django frontpage and Im not sure what is wrong | <p>Im close to being able to spin up and iterate on this django website that I am trying to launch.
I seem to be struggling with alternating 404 and 500 errors presenting as each of these two:</p>
<pre><code>[24/Nov/2023 11:19:56] "GET / HTTP/1.1" 500 145
[24/Nov/2023 11:20:07] "GET / HTTP/1.1" 404 ... | <python><django> | 2023-11-24 11:38:16 | 0 | 314 | Syllogism |
77,542,728 | 1,462,770 | Reproducible crawling behavior with Scrapy | <p>How can I make the <a href="https://docs.scrapy.org/" rel="nofollow noreferrer">Scrapy</a> crawler reproducible? By reproducibility, I mean that if we crawl the same website twice, we crawl it in exactly the same way. Therefore, we visit pages in the same order each time. Assume the website is static. In fact, if we... | <python><web-scraping><scrapy><web-crawler> | 2023-11-24 11:18:50 | 0 | 16,657 | Amir |
77,542,619 | 12,016,688 | What is the `ExceptionTable` in the output of `dis`? | <p>In <code>python3.13</code>, when I try to disassemble <code>[i for i in range(10)]</code>, the result is as below:</p>
<pre class="lang-py prettyprint-override"><code>>>> import dis
>>>
>>> dis.dis('[i for i in range(10)]')
0 RESUME 0
1 LOAD_NA... | <python><python-3.x><cpython><python-internals> | 2023-11-24 10:58:01 | 1 | 2,470 | Amir reza Riahi |
77,542,569 | 1,232,660 | Fix badly encoded character | <p>I visited a website that contained a character <code>ø</code> in the text. A character with unicode codepoint 248 (0xf8 in hexadecimal). Indeed, the Python console confirms that:</p>
<pre class="lang-py prettyprint-override"><code>>>> chr(248)
'ø'
</code></pre>
<p>But since I understand the text, I know tha... | <python><character-encoding> | 2023-11-24 10:50:02 | 2 | 3,558 | Jeyekomon |
77,542,461 | 10,694,589 | How to increase contrast and detect edges in a 16-bit image? | <p>My problem is with contrast enhancement and edge detection.
I would like to get a good Contrast stretching and and make it work the edge detection.</p>
<p>First of all, I read my images using rawpy because I have .nef files (Nikon raw).
I know that my images have a bit depth per color channel equal to 14 bits.
But I... | <python><opencv><image-processing><canny-operator><imutils> | 2023-11-24 10:33:56 | 1 | 351 | Suntory |
77,542,162 | 18,349,319 | How to configure certificate for fastapi app | <p>I created two applications (backend (fastapi. Works on 8000 port), frontend (reactjs. Works on 80 port)) they are communicate each with other.</p>
<p>My docker-compose file:</p>
<pre><code>version: '3.7'
services:
frontend:
container_name: "frontend"
build:
context: ./frontend
stop_sig... | <python><docker><deployment><ssl-certificate><fastapi> | 2023-11-24 09:47:17 | 2 | 345 | TASK |
77,542,112 | 15,991,297 | Vectorized Lookup in Dataframe Using Numpy Array | <p>Given a numpy array such as the one below, is it possible to use vectorization to return the associated value in column HHt without using a for loop?</p>
<pre><code>ex_arr = [2643, 2644, 2647]
for i in ex_arr:
h_p = df.at[i, "HHt"]
</code></pre>
<p>Example df:</p>
<div class="s-table-container">
<tab... | <python><pandas><numpy> | 2023-11-24 09:39:32 | 2 | 500 | James |
77,542,003 | 521,347 | Python Pubsub Subscriber client not pulling messages when filter is applied on subscription | <p>I am using Pubsub streaming pull subscription in my Python web application. When I am not applying any subscription filter, the subscriber client is able to successfully pull messages from the subscription.
However, if a subscription filter is applied, the subscriber stops pulling messages.If I go manually to the sp... | <python><google-cloud-pubsub><publish-subscribe> | 2023-11-24 09:20:49 | 1 | 1,780 | Sumit Desai |
77,541,799 | 12,200,808 | How to checkout the source code of keras 2.15.0 | <p>The latest version of <code>keras</code> in <code>pypi</code> is <code>2.15.0</code>:</p>
<p><a href="https://pypi.org/project/keras/" rel="nofollow noreferrer">https://pypi.org/project/keras/</a></p>
<pre><code>keras 2.15.0
pip install keras
Latest version
Released: Nov 7, 2023
</code></pre>
<p>But the latest rele... | <python><tensorflow><keras><pypi> | 2023-11-24 08:48:16 | 1 | 1,900 | stackbiz |
77,541,722 | 4,281,353 | pip mechanism of ```pip install ".[source-pt]"``` | <p><a href="https://pypi.org/project/deepdoctection/0.15/" rel="nofollow noreferrer">deepdoctection</a> PyPi has the pip installation description:</p>
<pre><code>cd deepdoctection
pip install ".[source-pt]"
</code></pre>
<p><a href="https://github.com/deepdoctection/deepdoctection" rel="nofollow noreferrer">d... | <python><pip> | 2023-11-24 08:36:32 | 0 | 22,964 | mon |
77,541,607 | 1,422,096 | High-level abstraction for serial communication | <p>On a hardware device with serial communication, I need to continously query "foo", forever, every second (for example to log temperature of the device). At a random timing, another thread may query "bar".</p>
<p>One option is to interrupt the "foo" queries, ask for "bar", and ... | <python><multithreading><serial-port><pyserial><abstraction> | 2023-11-24 08:17:28 | 1 | 47,388 | Basj |
77,541,537 | 3,270,926 | How to use intel IPP ippiRemap function using ctypes in python? | <p>I am trying to use ippiRemap from intel IPP library shared object (libipp.so).
by installing ipp using conda.</p>
<pre><code>conda install -c intel ipp
</code></pre>
<p>The library shared object files are installed in the environment directory. When trying to use <code>ippiRemap</code> function for image processing... | <python><c++><ctypes><intel-ipp> | 2023-11-24 08:08:40 | 1 | 623 | youssef |
77,541,530 | 1,581,090 | How can I fix error "Invalid rrule byxxx generates an empty set." using a MinuteLocator for matplotlib plots? | <p>I want to create a plot using Matplotlib to show a time along the x-axis. The following code is a complete minimum workable example:</p>
<pre><code>import random
from datetime import datetime
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import dates as mdates
times = np.arange(0, 5000, 60)
x =... | <python><matplotlib><python-dateutil> | 2023-11-24 08:07:03 | 1 | 45,023 | Alex |
77,541,498 | 10,623,444 | Applying Python UDF function per row in a polars dataframe throws unexpected exception 'expected tuple, got list' | <p>I have the following polars DF in Python</p>
<pre class="lang-py prettyprint-override"><code>df = pl.DataFrame({
"user_movies": [[7064, 7153, 78009], [6, 7, 1042], [99, 110, 3927], [2, 11, 152081], [260, 318, 195627]],
"user_ratings": [[5.0, 5.0, 5.0], [4.0, 2.0, 4.0], [4.0, 4.0, 3.0], [3... | <python><dataframe><user-defined-functions><python-polars> | 2023-11-24 08:00:48 | 2 | 1,589 | NikSp |
77,541,361 | 1,167,759 | LoRA Fine-Tuning on CPU Error: Using `load_in_8bit=True` requires Accelerate | <p>I'm trying to follow the instructions from the great blog post <a href="https://www.philschmid.de/fine-tune-flan-t5-peft" rel="nofollow noreferrer">Efficient Large Language Model training with LoRA and Hugging Face</a> to fine-tune a small model via LoRA. To prepare as much as possible, I'm trying to run everything ... | <python><huggingface-transformers><large-language-model> | 2023-11-24 07:27:30 | 1 | 962 | Niklas Heidloff |
77,541,350 | 5,462,398 | Calling Python(Code, executable or some other form) from Java | <p><strong>TLDR;</strong></p>
<p>I have a java desktop application that runs on Mac, Linux & Windows and I have a python library. I am trying to call the python package's function from Java. As long as python can be packaged in the installer of my application and will work on the user's machines without additional ... | <python><java> | 2023-11-24 07:25:25 | 1 | 1,348 | zur |
77,541,171 | 8,547,986 | Pyright ... (triple dot) is not allowed in this context | <p>I am on python 3.11 and i am using type hints for annotations. I have a function parameter which takes list of any length, all elements should of type str, for this when I do the following:</p>
<pre class="lang-py prettyprint-override"><code>def create_input(columns: list[str, ...]):
...
</code></pre>
<p>Pyrigh... | <python><python-typing><pyright> | 2023-11-24 06:44:55 | 0 | 1,923 | monte |
77,541,118 | 10,366,334 | Numpy indexing with ndarray and PyTorch tensor | <p>I find numpy array indexing works differently with ndarrray and PyTorch tensor of shape <code>(1,)</code> and want to know why. Please see the case below:</p>
<pre class="lang-py prettyprint-override"><code>import numpy as np
import torch as th
x = np.arange(10)
y = x[np.array([1])]
z = x[th.tensor([1])]
print(y, ... | <python><numpy><pytorch><numpy-ndarray> | 2023-11-24 06:29:39 | 1 | 314 | Nicolás_Tsu |
77,540,949 | 10,219,156 | df style apply to specific cells | <p>I have a dict which i create df</p>
<pre><code>data = {'BTC': {'PNL': 834.8485, 'FUNDING': 575.20837762, 'DELTA VOL': 18845436.3535, 'HEDGE VOL': 16444662.545, 'OI': 4598885.7407, 'DEFICIT': 149.35084}, 'BTC 4HR': {'PNL': 76.2125, 'FUNDING': 197.52681642, 'DELTA VOL': 1999585.538, 'HEDGE VOL': 1729156.5247, 'OI': No... | <python><pandas><list><numpy><dictionary> | 2023-11-24 05:44:24 | 1 | 326 | Madan Raj |
77,540,934 | 5,810,125 | how can i add active class to image slider dynamically in Django template? | <p>i have an image slider which does not show anything if the image does not have active class on it as it slides through a list of images.</p>
<pre><code>{% for v in m.value.images %}<div class="carousel-item active"> <div class="container">
<div class="carousel-caption&qu... | <javascript><python><html><django> | 2023-11-24 05:41:26 | 1 | 505 | Nsamba Isaac |
77,540,641 | 379,075 | Can you disable Pylint inline messages in Visual Studio Code? | <p>Is there a way to disable inline Pylint (v2023.10.1) messages in Visual Studio Code (version 1.84.2 on <a href="https://en.wikipedia.org/wiki/Windows_11" rel="nofollow noreferrer">Windows 11</a>)? For example, I'm referring to "Formatting a regular string which could be an f-string" in the image below.</p>... | <python><visual-studio-code><pylint> | 2023-11-24 03:57:55 | 1 | 1,490 | Dwayne Driskill |
77,540,541 | 11,225,821 | DRF self.paginate_queryset(queryset) doesn't respect order from self.get_queryset() | <p>i have a ListAPIView with custom get_queryset() where it ordered by a custom annotate() field called 'mentions'</p>
<p>i have customized my list function in ListAPIView, but when calling self.paginate_queryset() with the queryset i'm getting different result(not getting the first data from queryset</p>
<pre><code>c... | <python><django><django-rest-framework> | 2023-11-24 03:18:58 | 1 | 3,960 | Linh Nguyen |
77,540,502 | 2,850,913 | MLFlow install Python 3.10.12 with pyenv-win? | <p>I'm working with MLFlow 2.7.1 on Windows 10 and when I try to serve a model via <code>mlflow serve</code> it tries to use Pyenv to install Python 3.10.12. I installed the latest version of Pyenv Win with pip and updated via <code>pyenv update</code>, but when I run <code>pyenv install --list</code> it does not list ... | <python><python-3.x><pyenv><mlflow><pyenv-virtualenv> | 2023-11-24 02:56:27 | 1 | 750 | tail_recursion |
77,540,422 | 1,601,580 | How do I remove base64 strings from an arbitrary string? | <p>I have a string in Python. I want to remove base64 strings from it. I read about <a href="https://en.wikipedia.org/wiki/Base64#Decoding_Base64_with_padding" rel="nofollow noreferrer">the base64 spec</a> and <a href="https://stackoverflow.com/search?q=how%20to%20remove%20base64%20strings%20python%3F">looked around SO... | <python><regex><replace><base64><data-cleaning> | 2023-11-24 02:27:54 | 1 | 6,126 | Charlie Parker |
77,540,338 | 1,564,947 | How can I use Playwright to PUT multipart form-data in Python? | <p>I am trying to use Playwright to PUT multipart form-data with the Python API.
Here is the relevant <a href="https://playwright.dev/python/docs/next/api/class-apirequestcontext#api-request-context-put" rel="nofollow noreferrer">documentation</a>.</p>
<p>However, it's not clear how to structure the <a href="https://pl... | <python><http><multipartform-data><put><playwright-python> | 2023-11-24 01:55:23 | 1 | 2,879 | daviewales |
77,540,153 | 6,163,463 | Type hinting decorator which injects the value, but also supports passing the value | <p>I am trying to implement a decorator which injects <code>DBConnection</code>. The problem I am facing is that I would like to support both: passing the argument <strong>and</strong> depending on decorator to inject it. I have tried doing this with <code>@overload</code> but failed. Here is reproducible code:</p>
<pr... | <python><mypy><python-typing> | 2023-11-24 00:24:57 | 1 | 337 | Michal K |
77,540,116 | 5,394,072 | Where is the request argument coming from in pytest fixtures? | <p>I have a question with the request argument <a href="https://github.com/GokuMohandas/Made-With-ML/blob/540754392af9f49e637b491009586a61c54e2268/tests/model/conftest.py#L12" rel="nofollow noreferrer">in the following code</a>:</p>
<pre><code>@pytest.fixture(scope="module")
def run_id(request):
return re... | <python><pytest> | 2023-11-24 00:06:07 | 1 | 738 | tjt |
77,539,817 | 23,457 | How to get all declared or just typed parameters of a class | <p>How to write a function that prints out all attributes of a class with types?</p>
<pre class="lang-py prettyprint-override"><code>class Parent:
parent_param: str
parent_default: str | None = None
def find_params_meta(self):
...
# enter magic code, filter out methods and attributes starti... | <python><class><inspect> | 2023-11-23 22:03:41 | 2 | 4,959 | zalun |
77,539,710 | 12,415,855 | Getting allways the same values when iterating using Selenium? | <p>i try to collect some data using the following code:</p>
<pre><code>import time
import os
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.support.ui import WebDriverWait
fr... | <python><selenium-webdriver><beautifulsoup> | 2023-11-23 21:31:00 | 2 | 1,515 | Rapid1898 |
77,539,700 | 726,730 | Setting QT_AUTO_SCREEN_SCALE_FACTOR cause QTableWidget gridline and headerView border line mis-aligned | <p>Example:</p>
<p>File: <code>table.py</code></p>
<pre class="lang-py prettyprint-override"><code># -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'table.ui'
#
# Created by: PyQt5 UI code generator 5.15.9
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run a... | <python><pyqt5><qtablewidget><screen-size> | 2023-11-23 21:27:45 | 1 | 2,427 | Chris P |
77,539,624 | 6,458,245 | Do I need to add every version of Python to PATH? | <p>I've been getting this error when using pip to install:
"WARNING: The script foo is installed in '/Users/bar/Library/Python/3.9/bin' which is not on PATH."</p>
<p>Do I need to remember to add to PATH everytime I update to a new version of Python and everytime I update to a new shell? What's a permanent sol... | <python><macos><shell><pip><path> | 2023-11-23 21:07:32 | 2 | 2,356 | JobHunter69 |
77,539,458 | 2,036,930 | Using pytest and hypothesis, how can I make a test immediately return after discovering the first counterexample? | <p>I'm developing a library, and I'm using <a href="https://hypothesis.readthedocs.io/" rel="nofollow noreferrer">hypothesis</a> to test it.
I usually sketch out a (buggy) implementation of a function, implement tests, then iterate by fixing errors and running tests.
Usually these errors are very simple (e.g., a typo),... | <python><python-hypothesis> | 2023-11-23 20:19:51 | 1 | 920 | statusfailed |
77,539,376 | 9,985,849 | Different ways to create dictionary in python | <p>I was exploring different ways to create a dictionary in Python 3 (3.11.1). ChatGPT suggested that I can create a dictionary by using the following syntax:</p>
<pre><code>my_dict = dict('key1'='value1', 'key2'='value2', 'key3'='value3')
</code></pre>
<p><a href="https://i.sstatic.net/vJOfB.png" rel="nofollow norefer... | <python><dictionary> | 2023-11-23 20:00:21 | 1 | 468 | Akshay Katiha |
77,539,206 | 3,861,775 | Add noise to parameters of ensemble in JAX | <p>I use the following code to create parameters for an ensemble of models stored as list of lists holding tuples of weights and biases. How do I efficiently add random noise to all parameters of the ensemble with JAX? I tried to use <code>tree_map()</code> but run into many errors probably caused by the nested structu... | <python><jax> | 2023-11-23 19:14:34 | 2 | 3,656 | Gilfoyle |
77,539,171 | 1,843,511 | Pydantic: computed field dependent on attributes parent object | <p>As you can see from my example below, I have a computed field that depends on values from a parent object.</p>
<p>A parent has children, so it contains an attribute which should contain a list of Children objects. But I want a computed field for each child that calculates their allowance based on the parent object.<... | <python><python-3.x><pydantic> | 2023-11-23 19:06:59 | 0 | 5,005 | Erik van de Ven |
77,539,057 | 13,881,506 | LINQ query expression vs using IEnumerable.Where and IEnumerable.Select | <p>I'm coming to C# from Python where we have generator comprehensions such as</p>
<pre><code>nums = range(2, 10)
evenSquares = (num*num for num in nums if num % 2 == 0)
for evenSquare in evenSquares:
print(evenSquare)
</code></pre>
<p>The above would print</p>
<pre><code>4
16
36
64
</code></pre>
<p>I was looking for... | <python><c#><linq><generator><ienumerable> | 2023-11-23 18:36:09 | 0 | 1,013 | joseville |
77,538,965 | 11,517,893 | Set variable to an expired session out of a view in Django | <p>I’m trying to set a variable to an <strong>expired session</strong> out of a view in Django.</p>
<p>I’m aware of django’s documentation on <a href="https://docs.djangoproject.com/en/4.2/topics/http/sessions/#using-sessions-out-of-views" rel="nofollow noreferrer">Using sessions out of views</a>. But in my case, I try... | <python><django><session-variables> | 2023-11-23 18:13:33 | 2 | 363 | Zatigem |
77,538,948 | 7,529,256 | AWS Lambda - security token expired exception on performance testing, changed code - not working | <p>I have an AWS Lambda function which connects to dynamo db (cross-account) using sts.client (boto3 python).</p>
<p>It does a simple task of fetching data based on a query. This code works absolutely fine almost all the time.</p>
<p>However, we find it failing strangely during performance tests.</p>
<p>For example :
T... | <python><amazon-web-services><aws-lambda><boto3> | 2023-11-23 18:09:01 | 0 | 1,584 | Viv |
77,538,837 | 10,485,253 | How to add python type check for a Callable with a defined argument and kwargs | <p>What I have is a function as a parameter. This function will always need to take a dictionary, and then can optionally take any number of keyword arguments. See code below for a simplified example:</p>
<pre class="lang-py prettyprint-override"><code>def my_func(func, **kwargs):
my_map = {'a': 1, 'b': 2}
func... | <python><python-typing> | 2023-11-23 17:46:41 | 1 | 887 | TreeWater |
77,538,835 | 3,002,584 | RuntimeWarning shows once and then disappears - how to make it persistent? | <p>When running Python in interactive mode, <code>RuntimeWarning</code> is issued once and then disappears.</p>
<p>Here's an example session:</p>
<pre class="lang-py prettyprint-override"><code>>> import numpy as np
>> arr = np.array([np.inf])
>>
>> arr - arr # <-- first time
>> <st... | <python><numpy><warnings> | 2023-11-23 17:46:26 | 1 | 10,690 | OfirD |
77,538,784 | 148,736 | How do I install a pip python fused_kernels library on a GPU CUDA machine? | <p><a href="https://github.com/EleutherAI/gpt-neox/blob/5dd366539803dbf1fd725cc057013fd002a4cfd4/requirements.txt#L28" rel="nofollow noreferrer">https://github.com/EleutherAI/gpt-neox/blob/5dd366539803dbf1fd725cc057013fd002a4cfd4/requirements.txt#L28</a></p>
<pre><code>fused-kernels @ file:///fsx/hailey/math-lm/gpt-neo... | <python><pip><gpu><nvidia> | 2023-11-23 17:34:31 | 1 | 5,101 | Andrew Arrow |
77,538,730 | 499,721 | Cannot unpickle an instance of a class which inherits from `time` | <p>Consider the following class, which inherits from <code>datetime.time</code>:</p>
<pre><code>class TimeWithAddSub(time):
_date_base = date(2000, 1, 1)
def __new__(cls, hour=0, minute=0, second=0, microsecond=0, tzinfo=None):
obj = super(TimeWithAddSub, cls).__new__(cls, hour, minute, second, microse... | <python><time><pickle> | 2023-11-23 17:26:09 | 2 | 11,117 | bavaza |
77,538,602 | 110,963 | Deadlock with asyncio.Semaphore | <p>I have asyncio code that sometimes freezes in a deadlock, which should not be possible in my opinion. As reality always wins over theory, I must obviously be missing something. Can somebody spot a problem in the following code and tell me why it is possible at all that I can run into a deadlock?</p>
<pre><code>async... | <python><python-asyncio><semaphore> | 2023-11-23 17:00:05 | 1 | 15,684 | Achim |
77,538,420 | 4,056,146 | using yaml.safe_load and hasattr | <p>I have the following code that reads from a yaml file and needs to know if the property "ethernets" exists in it. I use "ethernets1" below to see how the code behaves when the property does not exist.</p>
<pre class="lang-py prettyprint-override"><code>#!/usr/bin/python
import yaml
import simpl... | <python><yaml><hasattr> | 2023-11-23 16:32:02 | 1 | 3,927 | xinthose |
77,538,397 | 7,684,584 | as400 I series JDBC Connect | <p>I have been trying to connect as400 (IBM DB2 i series) server using JDBC however the code I have written is neither giving any exception nor printing anything. Can any one please help with if I am doing anything wrong or required to change any server side configuration.</p>
<pre><code>import jaydebeapi
import os
imp... | <python><db2><ibm-midrange> | 2023-11-23 16:29:06 | 1 | 1,812 | DKM |
77,538,019 | 12,427,902 | How to convert dates to UTC taking into account winter and summer time? | <p>My objective is to convert a list of dates to the correct UTC format, i.e.: taking into consideration winter and summer time. Dates were scrapped from a chat.</p>
<p>I am Switzerland based which uses (CET) UTC+01:00 during the winter and (CEST) Central European Summer Time during the summer i.e. UTC+02:00.</p>
<p>He... | <python><pandas><date><datetime><utc> | 2023-11-23 15:26:25 | 1 | 509 | plonfat |
77,537,902 | 12,845,199 | Polars map users with more than one event | <pre><code>df = pl.LazyFrame({'col1':['a','a','b','b','c','c'],'col2':['undefined','defined','defined','defined','undefined','undefined']})
</code></pre>
<p>I have the following DF</p>
<p>Imagine I want to select the rows where col2 has more than two different values when it is grouped by col1.
And I want to select tho... | <python><python-polars> | 2023-11-23 15:07:16 | 1 | 1,628 | INGl0R1AM0R1 |
77,537,787 | 1,692,384 | import logic in python - for some modules we follow the structure from A.B.C import D, but for some modules we can bypass that and do from A import E | <p>i'm having trouble figuring out the importing logic in python, i'll use an existing example from the langchain library</p>
<p>for module name langchain.chains.retrieval_qa.base.VectorDBQA
a direct import works, i.e.</p>
<pre><code>from langchain import VectorDBQA
</code></pre>
<p>but for another module name langchai... | <python><import><module><logic> | 2023-11-23 14:49:39 | 1 | 399 | Black Dagger |
77,537,779 | 18,904,265 | How do I use pip, pipx and virtualenv of the current python version after upgrading? | <p>This is the first time I am upgrading python (from 3.11.3 to 3.12.0) and some questions came up along the way. I think I have somehow understood how Path works on windows, but am not getting the complete picture right now. At the moment I have the issue, that python and pip still by default use the old python instal... | <python><windows><pip><virtualenv><pipx> | 2023-11-23 14:48:18 | 1 | 465 | Jan |
77,537,765 | 5,888,928 | Type hinting in Pycharm for dynamically generated classes | <p>I'm trying to get Pycharm's linter to stop complaining when I use a dynamically created class via the Python <code>type( )</code> function. A simplified version of the actual code looks like the following.</p>
<p>Yes, it's weird to be working with the class object like that, but in the real code, it makes sense (SQ... | <python><sqlalchemy><pycharm><python-typing> | 2023-11-23 14:46:06 | 2 | 460 | Roy Wood |
77,537,463 | 736,662 | How to use the pandas df | <p>I create a df like this:</p>
<pre class="lang-py prettyprint-override"><code>df_ts_ids = pd.read_csv('C:\\share\\pythonProject\\TS_ID.csv').head(10)
</code></pre>
<p>And I have this function:</p>
<pre class="lang-py prettyprint-override"><code>def set_ts_ids():
ts_ids = df_ts_ids.sample()["TS_ID"].iloc... | <python><pandas><locust> | 2023-11-23 13:56:20 | 2 | 1,003 | Magnus Jensen |
77,537,307 | 1,084,174 | ERROR: Cannot install tflite-model-maker (The conflict is caused by other modules) | <p>I am trying to use tflite-model-maker package in one of my Kaggle notebook. It shows module not found then I tried to install it using,</p>
<pre><code>!pip install tflite_model_maker
</code></pre>
<p>However, it yields the following error:</p>
<pre><code>.....
ERROR: Cannot install tflite-model-maker==0.1.2, tflite-... | <python><jupyter-notebook><pip><anaconda><kaggle> | 2023-11-23 13:34:47 | 1 | 40,671 | Sazzad Hissain Khan |
77,537,303 | 3,740,652 | Dagster unable to import module | <p>I'm new to Dagster and I'm struggling importing my module into the Dagster code.
This is my project structure.</p>
<pre class="lang-bash prettyprint-override"><code>.
├── pyproject.toml
├── README.md
├── setup.cfg
├── setup.py
├── my-project
│ ├── assets.py
│ ├── __init__.py
│ ├── __pycache__
│ │ ├── asset... | <python><import><python-module><dagster> | 2023-11-23 13:33:47 | 1 | 372 | net_programmer |
77,537,125 | 955,273 | ASAN memory leaks in embedded python interpreter in C++ | <p>Address Sanitizer is reporting a memory leak (multiple actually) originating from an embedded python interpreter when testing some python code exposed to c++ using <code>pybind11</code>.</p>
<p>I have distilled the code down to nothing other than calling <code>PyInitialize_Ex</code> and then <code>PyFinalizeEx</code... | <python><c++><address-sanitizer> | 2023-11-23 13:05:59 | 1 | 28,956 | Steve Lorimer |
77,537,067 | 20,399,144 | Use of a single LineString to display two data fields | <p>I have a recurring problem for which I cannot find an easy solution, whereas I guess there is one.</p>
<p>I have a dataset representing road traffic data at a street level. This dataset is associated with a road network graph, where each edge represents a road and each node represents an intersection. For each edge,... | <python><plot><geopandas><shapely> | 2023-11-23 12:57:45 | 1 | 438 | R_D |
77,536,952 | 6,797,207 | Issue with using kmeans on filtered pandas data | <p>I have imported a CSV file, and filtered two columns. Very standard and working as expected. However, as soon as i run a KMeans test the outcome is unexpected. I am either running it on the entire dataset (not the filtered data) or on the wrong data.</p>
<pre><code># Load data
data = pd.read_csv('ISD.csv', encoding=... | <python><pandas><k-means> | 2023-11-23 12:39:27 | 1 | 897 | ben121 |
77,536,655 | 14,004,940 | Change percentage legend colour of lightweight-charts-python | <p>I was implementing <a href="https://github.com/louisnw01/lightweight-charts-python" rel="nofollow noreferrer"><strong>lightweight-charts-python</strong></a> library that is python equivalent for tradingview's lightweight-charts library.</p>
<p>In that I wanted to have a label showing open, high, low, close and perce... | <python><lightweight-charts> | 2023-11-23 11:52:33 | 2 | 916 | Mr. Techie |
77,536,632 | 8,930,751 | Same message is being received by multiple receivers using event hubs | <p>An event hub is created in Azure. This event hub has $default consumer group. It has 32 partitions.</p>
<p>There is one sender to this event hub which sends messages at some particular frequency. Now there are multiple receivers to this event hub. The code to send and receive is written in Python exactly as per <a h... | <python><python-3.x><azure><azure-eventhub> | 2023-11-23 11:48:54 | 1 | 2,416 | CrazyCoder |
77,536,610 | 10,836,309 | Filling nulls after merge - but only to the newly merged columns | <p>I have two dataframes that I am merging:</p>
<pre><code>import pandas as pd
df = pd.DataFrame({'ID': [1,2,3,4],
'Column A': [2, 3, 2, 3],
'Column B': [None, None, 3, None]})
df2 = pd.DataFrame({'ID': [1,2,4],
'Column C': [2, 3, 22]})
df = df.merge(df2, on='ID',... | <python><pandas> | 2023-11-23 11:46:17 | 1 | 6,594 | gtomer |
77,536,582 | 1,711,271 | Build a LaTeX label programmatically in matplotlib | <p>I can render hardcoded LaTeX expressions in matplotlib labels, no problem:</p>
<pre><code>import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0., 2.* np.pi, 20)
y = 2. * np.pi * np.stack((np.sin(x), np.cos(x)))
fig, ax = plt.subplots(2, 1, figsize=(6, 8), dpi=200, constrained_layout=True)
i=0
curre... | <python><matplotlib><plot><f-string> | 2023-11-23 11:42:18 | 1 | 5,726 | DeltaIV |
77,536,463 | 1,994,377 | How do you write a VSCode run configuration that will run the current Python file as a module? | <p>VSCode automatically generates something like this:</p>
<pre><code> {
"name": "Foobar",
"type": "python",
"request": "launch",
"module": "project.folder.foobar",
"ju... | <python><visual-studio-code> | 2023-11-23 11:21:52 | 1 | 7,042 | Sarien |
77,536,435 | 6,694,814 | Excel file corrupted after bulk saving with Python | <p>The aim of my work is just to save multiple Excel Macro files with exactly the same name.
I used the openpyxl library for it. The only thing, which changes in my file is the number att the end.</p>
<p>My code looks as follows:</p>
<pre><code> from openpyxl import Workbook, load_workbook
wb = load_workbook('Collecti... | <python><excel> | 2023-11-23 11:16:56 | 1 | 1,556 | Geographos |
77,536,328 | 3,575,623 | Test_step returns no loss values | <p>I have been working for some time with a VAE model based off of <a href="https://keras.io/examples/generative/vae/" rel="nofollow noreferrer">this</a>example, working with binary data so it has been modified.</p>
<p>Recently, the computing cluster I was working on suffered a fault and my most recent version of my sc... | <python><tensorflow><keras><autoencoder> | 2023-11-23 10:59:50 | 1 | 507 | Whitehot |
77,536,080 | 4,346,886 | Python IntelliJ style 'search everywhere' algorithm | <p>I have a list of file names in python like this:</p>
<pre><code>HelloWorld.csv
hello_windsor.pdf
some_file_i_need.jpg
san_fransisco.png
Another.file.txt
A file name.rar
</code></pre>
<p>I am looking for an IntelliJ style search algorithm where you can enter whole words or simply the first letter of each word in the ... | <python><intellij-idea><n-gram><file-search> | 2023-11-23 10:19:52 | 2 | 822 | Adam Griffiths |
77,535,978 | 10,667,216 | Issue with Pickling in Top2Vec v1.0.34 | <p>I recently upgraded to Top2Vec version 1.0.34 and encountered an issue with pickling the model.
Specifically, I'm getting following error:</p>
<pre><code>---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[18]... | <python><pickle><top2vec> | 2023-11-23 10:07:17 | 1 | 483 | Davood |
77,535,863 | 6,240,756 | Sort list with letters, numbers and special characters | <p>I know this kind of question has already been asked several times but I cannot find a proper answer to my problem.</p>
<p>I have a list of strings containing (or not) any kind of characters, letters, numbers, and special characters (<code>-</code> or <code>_</code>).</p>
<p>I would like to sort this list but having ... | <python><sorting> | 2023-11-23 09:52:20 | 3 | 2,005 | iAmoric |
77,535,857 | 2,583,346 | python plotly - heatmap with different data above and below diagonal | <p>I'm trying to create a heatmap based on two different matrices with identical dimensions but different data, so that the values for matrix1 are shown below the diagonal and the values for matrix2 are shown above the diagonal. Here is a simple example:</p>
<pre><code>import numpy as np
import pandas as pd
import plot... | <python><plotly><heatmap> | 2023-11-23 09:51:33 | 0 | 1,278 | soungalo |
77,535,830 | 16,027,663 | Vecotorized Lookback with Two Numpy Arrays | <p>Is it possible to vectorize lookbacks using two Numpy arrays? In example one below I need to "loop" through each value in first_arr and check if any of the previous 4 values contain 3 or more values from second_arr. If the condition is true the value in first_arr should be added to result_arr.</p>
<p>If th... | <python><numpy> | 2023-11-23 09:48:15 | 2 | 541 | Andy |
77,535,771 | 7,766,158 | Zip deployment of Azure function do not trigger the import of requirements | <p>I want to deploy some Azure functions through Terraform.</p>
<pre><code>resource "azurerm_storage_account" "function_storage" {
name = var.storage_account_name
resource_group_name = var.resource_group_name
location = var.location
acc... | <python><azure><terraform><azure-functions> | 2023-11-23 09:40:27 | 1 | 1,931 | Nakeuh |
77,535,702 | 903,051 | Convert ImageMagick command to Python | <p>I have the following ImageMagick command that works very well for removing grid lines from a table image:</p>
<pre><code>convert test.png -background white -deskew 40% -write mpr:img \
\( mpr:img -morphology close rectangle:30x1 -negate \) \
\( mpr:img -morphology close rectangle:1x30 -negate \) \
-evaluate-sequenc... | <python><opencv><python-imaging-library><imagemagick><wand> | 2023-11-23 09:29:22 | 1 | 543 | mirix |
77,535,500 | 8,849,755 | Importing a Function from External Module Without Colliding with Local Module Names in Python | <p>I have the following files:</p>
<pre><code>/somewhere/my_project/main.py
/somewhere/my_project/utils.py
/somewhere/else/utils.py
</code></pre>
<p>and I need to import a function from <code>/somewhere/else/utils.py</code> into <code>main.py</code>. Usually I do <a href="https://stackoverflow.com/a/4383597/8849755">th... | <python><import> | 2023-11-23 08:58:41 | 3 | 3,245 | user171780 |
77,535,380 | 4,056,181 | Minimum number of digits for exact double-precision and the fmt='%.18e' of numpy.savetxt() | <p>I want to save 64-bit (double-precision) floating point numbers to a text file in Python using NumPy's <a href="https://numpy.org/doc/stable/reference/generated/numpy.savetxt.html" rel="nofollow noreferrer"><code>savetxt()</code></a>. The default format is <code>fmt='%.18e'</code> which gives 19 significant decimal ... | <python><numpy><floating-point><binary><precision> | 2023-11-23 08:36:07 | 0 | 13,201 | jmd_dk |
77,535,331 | 14,471,688 | How can I perform XOR between every elements of two 2D numpy arrays by saving the memory usage efficiently? | <p>I am not familiar with XOR operations and I was wondering if there is an efficient way to perform XOR operation for every elements between two 2D NumPy arrays by saving the memory usage.</p>
<p>Here is my toy example:</p>
<pre><code># Example arrays
u_values = np.array([[True, True, True, True, True, True, False, Tr... | <python><numpy><bit-manipulation> | 2023-11-23 08:25:24 | 0 | 381 | Erwin |
77,535,074 | 6,900,729 | Can I rely on garbage collector to close asynchronous database connections in Python? | <p>My team is working on an asynchronous HTTP web server implemented in Python (CPython 3.11 to be exact). We're using Redis for data storage and connect to it with the help of the <a href="https://redis-py.readthedocs.io/en/stable/index.html" rel="nofollow noreferrer">redis-py</a> library. Since the HTTP server is asy... | <python><asynchronous><redis><garbage-collection><connection-pooling> | 2023-11-23 07:37:10 | 1 | 456 | Alex F |
77,534,891 | 139,150 | More than 6 characters string repeated | <p>I am trying to find the repeated strings (not words) from text.</p>
<pre><code>x = 'This is a sample text and this is lowercase text that is repeated.'
</code></pre>
<p>In this example, the string ' text ' should not return because only 6 characters match with one another. But the string 'his is ' is the expected va... | <python><awk><sed><grep> | 2023-11-23 07:04:20 | 4 | 32,554 | shantanuo |
77,534,387 | 4,281,353 | keras.Model.fit does not work correctly with generator and sparse categorical crossentropy loss | <p><code>tf.keras.Model.fit(x=generator)</code> does not work correctly with
<code>SparseCategoricalCrossentropy</code>/<code>sparce_categorical_crossentropy</code> loss function with a generator as training data. The same symptom reported in <a href="https://stackoverflow.com/questions/64910527/accuracy-killed-when-us... | <python><tensorflow><machine-learning><keras><generator> | 2023-11-23 04:41:21 | 1 | 22,964 | mon |
77,534,243 | 12,242,085 | How to combine Cross Validation and Early Stopping Round in LSTM model? | <p>I would like to combine Cross Validation and Early Stopping Round in LSTM model in Python. I would like to make cross validation on 3 folds and stop learning my LSTM model if for 3 consecutive epchos there is no improvement in the mean AUC of the 3 folds from the cross-validation.</p>
<p>In this way, I would like to... | <python><machine-learning><lstm><cross-validation><auc> | 2023-11-23 03:40:32 | 0 | 2,350 | dingaro |
77,534,184 | 12,178,648 | Not able to update Django model with HTMX button click | <p>I am using Django, Tailwind CSS, and HTMX.</p>
<p>I am trying to update my Django model (<code>Item</code>) which starts as <code>None</code> to use a dropdown <code>select</code> to change the color then use a button to Save and update the <code>Item.color</code> on the Django model. The HTML shows up, and I am abl... | <python><django><tailwind-css><htmx> | 2023-11-23 03:20:17 | 1 | 1,715 | sepulchre01 |
77,534,100 | 9,443,671 | Is there any way to merge overlapping audio segments into one with very low latency? | <p>I've this problem where I'm faced with overlapping audio segments: in particular, audio segment <code>t</code> overlaps with audio segment <code>t+1</code> in the last couple of words (e.g. <code>t = "I like to move"</code> and <code>t+1 = "to move in circles all day"</code>). Is there any way th... | <python><arrays><audio><pydub> | 2023-11-23 02:47:16 | 1 | 687 | skidjoe |
77,534,017 | 16,171,413 | Python's built in sum function taking forever to compute sums of very large range of values in a list | <p>This works well and returns <strong>249999500000</strong>:</p>
<pre><code>sum([x for x in range(1_000_000) if x%2==0])
</code></pre>
<p>This is slower but still returns <strong>24999995000000</strong>:</p>
<pre><code>sum([x for x in range(10_000_000) if x%2==0])
</code></pre>
<p>However, larger range of values such ... | <python><sum><list-comprehension> | 2023-11-23 02:12:15 | 3 | 5,413 | Uchenna Adubasim |
77,534,012 | 219,153 | How to define globals for this timeit call? | <p>This Python 3.11 script benchmarks function <code>f</code>:</p>
<pre><code>import numpy as np, timeit as ti
def f(a):
return np.median(a)
a = np.random.rand(10_000)
m = None
fun = f'm = f(a)'
t = 1000 * np.array(ti.repeat(stmt=fun, setup=fun, globals=globals(), number=1, repeat=100))
print(f'{fun}: {np.amin(t)... | <python><global><timeit> | 2023-11-23 02:11:16 | 1 | 8,585 | Paul Jurczak |
77,533,990 | 22,875,576 | Installed django in virtual env, but I can't import | <p>I installed Django in virtual env.</p>
<p><a href="https://i.sstatic.net/z5jBI.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/z5jBI.png" alt="enter image description here" /></a></p>
<p><a href="https://i.sstatic.net/BQkTS.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/BQkTS.png" alt=... | <python><django> | 2023-11-23 02:05:39 | 0 | 462 | solverfox |
77,533,783 | 179,234 | flask app Failed to serve js generate from vite. Error: Failed to load module script | <p>I have a webapp where the backend is build with python (flask) and the frontend is build with nodejs.</p>
<p>For the frontend, I run the following to generate static files:</p>
<pre><code>npm install
npm run build
</code></pre>
<p>This is my vite.config.ts</p>
<pre><code>import { defineConfig } from "vite"... | <python><node.js><flask><azure-web-app-service><vite> | 2023-11-23 00:30:22 | 1 | 1,417 | Sarah |
77,533,755 | 2,347,063 | Apply a method on blobs in a container without downloading blobs from Azure blob storage | <p>I have a large number of containers in my Azure blob storage account. Each container contains several files/blobs of different formats (e.g., txt or json.) I need to compute the hash of these files and store the hash in a database. The way we're doing it now is that we download the blobs in a container to our local ... | <python><azure><azure-blob-storage><azure-storage> | 2023-11-23 00:17:38 | 1 | 2,629 | Pedram |
77,533,733 | 1,035,897 | Excluding folders starting with a dot in google drive API query | <p>I am using <code>Python</code> client for <strong>google drive API</strong>.</p>
<p>I want to enumerate folders that has a name that does not start with a dot ('.').</p>
<p>My naive query to find the folders looks like this:</p>
<pre><code>query = f"""
{root_folder_id}' in parents
and mimeType... | <python><google-drive-api><google-drive-shared-drive><flysystem-google-drive> | 2023-11-23 00:11:51 | 1 | 9,788 | Mr. Developerdude |
77,533,721 | 11,192,275 | Scipy stats t-test for the means and degrees of freedom | <p>I am using the stats module from scipy and in particular the function <code>ttest_ind</code>. I want to extract information related to the degrees of freedom when I apply this test. According to the SciPy v1.11.4 documentation, <a href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.ttest_ind.html#... | <python><probability><scipy.stats> | 2023-11-23 00:07:03 | 1 | 456 | luifrancgom |
77,533,604 | 8,006,845 | Execution timing with context manager | <p>I was looking for a solution for timing code execution.
Of course, I found all sorts of solutions mostly suggesting the use of <code>timeit</code> module - which is pretty cool - or just using the <code>time</code> module. Neither of those really provides what I'm after.</p>
<p>I wanted a simple solution that</p>
<u... | <python><timing><execution-time><contextmanager><timeit> | 2023-11-22 23:29:28 | 0 | 763 | Gergely M |
77,533,488 | 16,674,436 | NLP pre-processing on two columns in data frame gives error | <p>I have the following data frame:</p>
<pre><code>gmeDateDf.head(2)
</code></pre>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>title</th>
<th>score</th>
<th>id</th>
<th>url</th>
<th>comms_num</th>
<th>body</th>
<th>timestamp</th>
</tr>
</thead>
<tbody>
<tr>
<td>It's not about the money, it'... | <python><pandas><dataframe><nlp><nltk> | 2023-11-22 22:54:17 | 1 | 341 | Louis |
77,533,480 | 998,248 | Is multiprocessing.Queue generic or not (pyright)? | <p>I started using pyright recently (over mypy) and it's finding a lot of issues that weren't coming up with mypy. For example</p>
<pre class="lang-py prettyprint-override"><code>from multiprocessing import Queue
queue: Queue = Queue() # Type of "queue" is "Queue[Unknown]" [reportUnknownVariableTy... | <python><python-typing><pyright> | 2023-11-22 22:49:14 | 1 | 2,791 | Anthony Naddeo |
77,533,405 | 7,366,596 | Pandas: How to convert datetime objects into float | <p>Running the MRE below gives me the following output:</p>
<pre><code> c1 c2 c3
0 2023-11-12 10:36:00 2023-11-12 03:00:00 0 days 07:36:00
1 2023-11-12 00:41:00 2023-11-11 00:00:00 1 days 00:41:00
</code></pre>
<pre><code>import pandas as pd
lines = [
&quo... | <python><pandas><dataframe> | 2023-11-22 22:29:18 | 2 | 402 | bbasaran |
77,533,274 | 785,404 | How can I type annotate a decorator that takes optional arguments? | <p>Let's say I define a decorator like this:</p>
<pre class="lang-py prettyprint-override"><code>def my_decorator(func=None, *, param=42):
if func is None:
return functools.partial(my_decorator, param=param)
...
</code></pre>
<p>This decorator can be used like this</p>
<pre class="lang-py prettyprint-ov... | <python><mypy><python-typing> | 2023-11-22 21:53:49 | 2 | 2,085 | Kerrick Staley |
77,533,242 | 4,213,362 | Finding minimum of 4 columns in postgres with sqlalchemy (computed sqlalchemy model properties) | <p>I am trying to convert a psql query to SQLAlchemy.
The model that I have has virtual/computed fields and thus raw sql is not something that solves my problem.</p>
<pre><code> query = """
SELECT MIN(LEAST(delta_cell_v1, delta_cell_v2, delta_cell_v3, delta_cell_v4)) , MAX(GREATEST(delta_cell_... | <python><postgresql><sqlalchemy> | 2023-11-22 21:45:00 | 1 | 811 | Vishesh Mangla |
77,533,081 | 22,437,734 | Unable to install packages with pip in VS code | <p>I am trying to install <code>Flask</code> with the following command:</p>
<p><code>pip install flask</code></p>
<p>But pip returns:</p>
<pre><code>Requirement already satisfied: flask in /home/john/anaconda3/lib/python3.11/site-packages (3.0.0)
Requirement already satisfied: Werkzeug>=3.0.0 in /home/john/anaconda... | <python><visual-studio-code><terminal><pip><python-import> | 2023-11-22 21:00:47 | 2 | 473 | Gleb |
77,532,987 | 14,385,099 | Subset MULTIPLE specific rows and columns to update cell value | <p>I have a dataframe that looks like this:</p>
<pre><code> Onset = [17,18,19,20,21]
Event = ['ArrowsTask', 'SelfReframeNeg', 'Memory', 'SocialReframeNeg', 'Cue']
Response = [1,2,3,4,5]
df = pd.DataFrame({'Event':Event,'Onset':Onset, 'Response':Response})
</code></pre>
<p>If<code>Event</code> == 'ArrowsT... | <python><pandas> | 2023-11-22 20:44:51 | 1 | 753 | jo_ |
77,532,861 | 1,422,096 | With a single serial link, how to read continuous data every second (polling), and do other queries in the meantime? | <p>I communicate with a hardware device via serial link RS232 (no other option available).</p>
<ul>
<li>I need to continuously poll some data "foo", every second (if possible).</li>
<li>Sometimes I also need to ask the device for other data, such as "bar" and "baz"</li>
</ul>
<p>Of course,... | <python><multithreading><serial-port><pyserial><polling> | 2023-11-22 20:16:37 | 0 | 47,388 | Basj |
77,532,707 | 889,349 | bigram calculation - Memory error, large file problem | <p>Here is a code for bigram calculation from the text corpus:</p>
<pre><code>import sys
import csv
import string
import nltk
from nltk import word_tokenize
from nltk.tokenize import RegexpTokenizer
from nltk.util import ngrams
from collections import Counter
tokenizer = RegexpTokenizer(r'\w+')
with open('hugefile... | <python><nltk><n-gram> | 2023-11-22 19:42:56 | 1 | 3,402 | XTRUST.ORG |
77,532,632 | 11,013,417 | How to proxy all inherited methods in python | <p>I want to proxy all inherited methods of a class. I need to do this because I want to add some information before forward the method call. I've something like:</p>
<pre class="lang-py prettyprint-override"><code>class Father():
def fatherMethodOne(self):
print("This is father method one")
... | <python><proxy> | 2023-11-22 19:26:36 | 0 | 351 | Matheus |
77,532,617 | 9,604,370 | AttributeError: module 'os' has no attribute 'add_dll_directory' when importing "pandas" library in Azure Function | <p>I'm endeavoring to deploy an Azure Function application that relies on various libraries, including numpy, torch, and pandas (you can find all the prerequisites listed in the attached image). While the application runs smoothly on my <strong>Ubuntu 22.0.4</strong> laptop, I encounter a persistent issue upon deployme... | <python><pandas><azure><ubuntu><azure-functions> | 2023-11-22 19:21:33 | 1 | 409 | Arthur Vaz |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.