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 โ |
|---|---|---|---|---|---|---|---|---|
78,826,639 | 1,914,781 | remove zero data at the end of a string | <p>I would like to remove the <code>0x00</code> at the end of a string with python3. I try to use <code>rstrip()</code> but it not work.</p>
<pre><code>x = bytearray([0x30,0x31,0x32,0x33,0x00,0x00])
y = x.decode()
z = y.rstrip()
print(z)
</code></pre>
<p>How can I get output of <code>z</code> value as <code>123</code> ... | <python> | 2024-08-02 17:39:33 | 3 | 9,011 | lucky1928 |
78,826,617 | 4,515,940 | docker - install python-pip on php-fpm-alpine is extremely slow | <p>I'm trying to install <code>python-pip</code> on my app</p>
<pre><code>FROM php:7.2-fpm
....
RUN apt-get install -y python-pip
</code></pre>
<p>This is taking more than 2 hours and its still not complete. Checking <code>htop</code> it shows no problem om RAM or Disk consume.</p>
<p>I found an article saying that Lin... | <python><linux><docker><alpine-linux> | 2024-08-02 17:32:15 | 1 | 1,835 | anderlaini |
78,826,482 | 718,529 | Fail to initialize model using GemmaVertexAIModelGarden | <p>I try initializing an <code>llm</code>, following an official tutorial in Colab: <a href="https://colab.research.google.com/github/google/generative-ai-docs/blob/main/site/en/gemma/docs/integrations/langchain.ipynb#scrollTo=bhIHsFGYjtFt" rel="nofollow noreferrer">Get started with Gemma and LangChain</a>. The tutoria... | <python><google-colaboratory><langchain><google-cloud-vertex-ai><gemma> | 2024-08-02 16:39:55 | 1 | 687 | chanp |
78,826,381 | 8,436,290 | Why Langchain HuggingFaceEmbeddings model dimension is not the same as stated on HuggingFace | <p>I was using langchain HuggingFaceEmbeddings model: dunzhang/stella_en_1.5B_v5.
When I look at <a href="https://huggingface.co/spaces/mteb/leaderboard" rel="nofollow noreferrer">https://huggingface.co/spaces/mteb/leaderboard</a>, I can see that the model is 8192.
But when I do</p>
<pre><code>len(embed_model.embed_que... | <python><langchain><large-language-model><huggingface> | 2024-08-02 16:12:09 | 1 | 467 | Nicolas REY |
78,826,349 | 769,933 | Polars cross join without reversed or equal entries | <p>I'm joining two identical columns and am only interested in combinations (not permutations). Currently, I can perform a full cross-join and, subsequently, filter out the unwanted rows.</p>
<pre class="lang-py prettyprint-override"><code>import polars as pl
df1 = pl.DataFrame({"a": range(3)})
df2 = pl.Data... | <python><dataframe><python-polars><cross-join> | 2024-08-02 16:04:35 | 2 | 2,396 | gggg |
78,826,249 | 4,810,328 | modify global variable in a decorated function | <p>I have a decorator which inits a global dict which I want to modify within the decorated function. I have tried an implementation something like below:</p>
<pre><code>def decorator():
def inner_function(func):
global_dict = {}
print("Inner function")
ret = func()
return ... | <python><decorator><python-decorators> | 2024-08-02 15:36:44 | 0 | 711 | Tarique |
78,826,206 | 7,791,036 | NameError: name '_LanguageModel' is not defined | <p>I am trying to initialize vertexai llm in langchain library.</p>
<pre><code>from langchain_community.llms.vertexai import VertexAI
llm = VertexAI(
max_output_tokens=1024,
temperature=0.2,
top_p=0.8,
top_k=40,
verbose=True,
)
</code></pre>
<p>I get the following error ... | <python><langchain><large-language-model><google-cloud-vertex-ai> | 2024-08-02 15:24:11 | 2 | 1,125 | vivekpadia70 |
78,826,183 | 5,043,192 | Can't import custom python package in my project | <p>I'm trying to create a package in Python using Poetry and then use it in another project. However after importing the package, I'm unable to use it. The project doesn't recognize it.</p>
<p><strong>Library</strong></p>
<p>pyproject.toml:</p>
<pre><code>[tool.poetry]
name = "python-lib-example"
version = &q... | <python><package><python-poetry> | 2024-08-02 15:20:00 | 1 | 839 | Michal |
78,826,115 | 12,785,645 | How to make a barplot with a double grouped axis using Pandas | <p>I am working on a plot where I want to show two groups on one axis and a third group as fill-value.
The problem is, that when I plot it, the y-axis shows values in tuples:</p>
<pre><code>data_dict = {'major_group': list(np.array([['A']*10, ['B']*10]).flat),
'minor_group': ['q ','r ','s ','t ']*5,
'legend_group':np.... | <python><pandas><bar-chart> | 2024-08-02 15:02:19 | 2 | 463 | saQuist |
78,826,085 | 14,649,310 | Elasticsearch RequestError(400) 'search_phase_execution_exception' | <p>I have a simple python app that uses Elasticsearch to store documents for Pokemon using this mapping:</p>
<pre><code>{
"mappings": {
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "objec... | <python><elasticsearch><huggingface><text-embedding-ada-002> | 2024-08-02 14:55:23 | 1 | 4,999 | KZiovas |
78,826,008 | 11,163,122 | Why does __init__.py break namespace packaging? | <p>This package structure works fine for namespace packaging:</p>
<pre class="lang-none prettyprint-override"><code>โโโ ๎ฟ pkg
โ โโโ ๎ฟ module
โ โ โโโ ๎ a.py
โ โโโ ๎ pyproject.toml
โโโ ๎ฟ subfolder
โโโ ๎ฟ pkg
โ โโโ ๎ฟ module
โ โโโ ๎ b.py
โโโ ๎ pyproject.toml
</code></pre>
<p>However, when I add an <code... | <python><setuptools><python-packaging><pyproject.toml><namespace-package> | 2024-08-02 14:36:48 | 0 | 2,961 | Intrastellar Explorer |
78,825,950 | 13,757,692 | How to calculate gradient of data on non-orthogonal ordered grid? | <p>I have a grid of xy-coordinates that I generate using <code>np.meshgrid</code>. The spacing in x-direction is constant, the y-coordinates are scaled, as a function of x. In this specific case, this results in a cloud of points that lie on a trapezoid, with a side length of 2 on the left and 1 on the right side. I ha... | <python><numpy><gradient> | 2024-08-02 14:21:41 | 0 | 466 | Alex V. |
78,825,756 | 3,415,543 | Python Arcade 2.6.17 UIInputText register UITextEvent handler | <p>How do you register an event handler for the above.</p>
<p>I create one as follows:</p>
<pre><code>inputText: UIInputText = UIInputText(text='5', height=18, width=100, font_size=12, text_color=color.BLACK)
</code></pre>
<p>But cannot figure out how to register a callback/handler that gets called whenever a user typ... | <python><arcade> | 2024-08-02 13:30:52 | 1 | 555 | Sequestered1776Vexer |
78,825,554 | 1,418,090 | How to install TensorFlow 2.16 on Macbook Pro M2? | <p>I currently use TensorFlow 2.13.1 (<code>tensorflow-macos</code>) with TF-metal (1.0.0). I want to migrate to TensorFlow 2.16.1 to keep up with the updates.</p>
<p>In the <a href="https://blog.tensorflow.org/2024/03/whats-new-in-tensorflow-216.html" rel="nofollow noreferrer">update website</a>, they say the followin... | <python><tensorflow><pip><conda><apple-silicon> | 2024-08-02 12:40:19 | 1 | 438 | Umberto Mignozzetti |
78,825,285 | 8,040,928 | Running adb reboot command from python | <p>Running the adb reboot command from code always produces an error. In fact, the device reboots and when adb reboot commend run directly from terminal everything is ok, but I don't know how to handle this correctly in python code (unfortunately all chat GPTt suggestions fail). Probably the connection is lost when reb... | <python><android><android-emulator><subprocess><adb> | 2024-08-02 11:36:47 | 1 | 603 | Janek Podwysocki |
78,825,246 | 21,348,174 | Revit API how to filter elements from Revit Links | <p>Im using Python, pyRevit and Revit 2021</p>
<p><strong>Main goal</strong></p>
<p>I want to use the <code>FilteredElementCollector</code> in order to collect specific elements within Revit Links linked in my project.</p>
<p><strong>My problem</strong></p>
<p>My question is how do I collect only the elements that are ... | <python><revit-api><revitpythonshell><pyrevit> | 2024-08-02 11:29:32 | 1 | 435 | IdoBa |
78,825,079 | 159,072 | autocorrelation using FFT | <p>I am trying to translate this Python routine into C#:</p>
<pre><code>import numpy as np
def autocorr(x):
if not hasattr(x[0], "__len__"):#Check if one dimentional array
length=len(x)
N_padding=2 ** np.ceil(np.log2(2*len(x) - 1)).astype('int')#padding size is next power of 2 from 2*leng... | <python><c#><fft> | 2024-08-02 10:49:48 | 1 | 17,446 | user366312 |
78,825,070 | 3,333,319 | Pydantic unknown type during serialization | <p>I need to serialize a python dataclass (<code>MainObj</code> in the MWE below) which contains other plain-python nested objects, however the snippet below throws an exception.</p>
<p>mwe.py (entry point)</p>
<pre class="lang-py prettyprint-override"><code>from mainobj import MAIN_OBJ_TA, MainObj
from myobj import My... | <python><serialization><python-dataclasses><pydantic-v2> | 2024-08-02 10:46:28 | 1 | 973 | Sirion |
78,825,029 | 7,478,839 | How should I correctly configure tasks when using sockets in python? | <p>I have this small snippet which I intend to have function as a server, I have managed to get the socket to connect to the client but cannot send data due to errors.</p>
<pre class="lang-py prettyprint-override"><code>import asyncio
import json
import socketio
from aiohttp import web
ALLOWED_ORIGINS = ["http://... | <python><coroutine><python-socketio> | 2024-08-02 10:34:44 | 2 | 330 | KE Keronei |
78,825,011 | 4,451,521 | RunnableSequence instead of LLMChain throws an error (updating from deprecated langchain) | <p>When I have this code first</p>
<pre><code>from langchain_community.llms import HuggingFacePipeline
from transformers import AutoTokenizer
import transformers
import torch
model="meta-llama/Llama-2-7b-chat-hf"
tokenizer=AutoTokenizer.from_pretrained(model)
pipeline=transformers.pipeline(
"text-g... | <python><langchain><huggingface> | 2024-08-02 10:29:18 | 2 | 10,576 | KansaiRobot |
78,824,996 | 1,779,973 | Run an async function from a sync function within an already-running event loop | <p>In my Python application, I have a sync function <code>boo()</code> that is called inside a <strong>running event loop</strong>. <code>boo()</code> has to get some data from <code>foo(arg1, arg2)</code>, which is an <strong>async</strong> function.</p>
<p>Unfortunately, I can't turn <code>boo()</code> into an async ... | <python><async-await><python-asyncio><future><coroutine> | 2024-08-02 10:26:32 | 3 | 536 | Ido |
78,824,983 | 2,810,305 | Python str subclass with lazy evaluation of its value (for argparse) | <p>I am building a command-line program that uses <a href="https://docs.python.org/3/library/argparse.html" rel="nofollow noreferrer"><code>argparse</code></a>.
In the (assumed-to-be) rare case of a wrong call, <code>argparse</code> will show a description string supplied when creating the <code>ArgumentParser</code>.<... | <python> | 2024-08-02 10:21:56 | 1 | 40,070 | Lutz Prechelt |
78,824,890 | 5,865,411 | SQLAlchemy: Error can't emit change event | <p>So, I have these 2 dto classes:</p>
<pre class="lang-py prettyprint-override"><code>class ProjectDTO(DB):
__tablename__ = 'projects'
__table_args__ = {'schema': 'postgres'}
id = Column(Integer, primary_key=True)
serial = Column(UUID(as_uuid=True), unique=True, nullable=False, server_default=text('(u... | <python><sqlalchemy> | 2024-08-02 09:58:51 | 0 | 909 | dev-x |
78,824,885 | 1,504,016 | Python : filter set/list of tuple based on cardinality property | <p>I'm looking for a way to filter a set (or list) of tuples based on the number of times an
item appears in one of the other of the position of the tuple.</p>
<p>My current goal is a bit complex so I divided the problem in three smaller steps.</p>
<p><strong>1. Let's start with the simplest case, only a single value w... | <python><list><functional-programming><tuples><python-itertools> | 2024-08-02 09:58:13 | 2 | 2,649 | ibi0tux |
78,824,882 | 386,861 | Voila output to html - can't see output file | <p>This is a simple query about the useful voila module in python</p>
<p>I've got a jupyter notebook called voila_testing.ipynb - although it could be any notebook.</p>
<p>It is hosted on Sharepoint and all I want to do is is output the voila results into an html file as not too many people can access the jupyter noteb... | <python><pandas><visual-studio-code><jupyter-notebook><voila> | 2024-08-02 09:57:35 | 0 | 7,882 | elksie5000 |
78,824,872 | 2,641,187 | distinguishing homogeneous and heterogeneous tuples in python function overloads | <p>Suppose I have an interface <code>Base</code> with a lot of implementations</p>
<pre class="lang-py prettyprint-override"><code>from abc import ABC
class Base(ABC): ...
class A(Base): ...
class B(Base): ...
class C(Base): ...
# ...
class Z(Base): ...
</code></pre>
<p>Now I want to define a composite class that hol... | <python><python-typing><mypy> | 2024-08-02 09:56:35 | 1 | 931 | Darkdragon84 |
78,824,869 | 4,596,240 | Changes in child processes variables not reflected in parent object | <p>I have a parent class in Python that can start a process in a child class. The child class has a <em>multiprocessing.Process</em> that changes some variables. I would expect changes to be visible for the parent class since the object is created there, but somehow, the variables are not shared. The process is started... | <python><multithreading><multiprocessing> | 2024-08-02 09:55:21 | 1 | 838 | Ignacio |
78,824,644 | 10,200,497 | What is the best way to return the group that has the largest streak of negative numbers in a column? | <p>My DataFrame is:</p>
<pre><code>import pandas as pd
df = pd.DataFrame(
{
'a': [-3, -1, -2, -5, 10, -3, -13, -3, -2, 1, 2, -100],
}
)
</code></pre>
<p>Expected output:</p>
<pre><code> a
0 -3
1 -1
2 -2
3 -5
</code></pre>
<p>Logic:</p>
<p>I want to return the largest streak of negative ... | <python><pandas><dataframe> | 2024-08-02 09:10:10 | 2 | 2,679 | AmirX |
78,824,489 | 1,195,001 | Python: wait for all threads to reach one point in the code before continuing | <pre><code>def setsystemdate(epoch)
# set system date to epoch
# this function uses a huge amount of file pointers that I want to keep open for efficiency
def longrunningfunc(elem1, start_time, end_time):
for newdate in range(start_time, end_time, 100000):
setsystemdate(newdate)
# need to chang... | <python><python-multithreading> | 2024-08-02 08:28:59 | 1 | 344 | Kiwy |
78,823,898 | 7,959,614 | Measure balanceness of a weighted numpy array | <p>I have player <code>A</code> and <code>B</code> who both played against different opponents.</p>
<div class="s-table-container"><table class="s-table">
<thead>
<tr>
<th>player</th>
<th>opponent</th>
<th>days ago</th>
</tr>
</thead>
<tbody>
<tr>
<td>A</td>
<td>C</td>
<td>1</td>
</tr>
<tr>
<td>A</td>
<td>C</td>
<td>2<... | <python><numpy><counter> | 2024-08-02 05:29:45 | 2 | 406 | HJA24 |
78,823,831 | 4,915,008 | How to LEFT OUTER JOIN without foreign key using django orm | <p>I have following Models:</p>
<pre class="lang-py prettyprint-override"><code>class User(Model):
###
user fields
###
class CaseModel(Model):
id = # django build in id field
owner = models.ForeignKey('User')
###
other fields
###
class DraftMessageModel(Model):
entity_id = model... | <python><django><postgresql><django-queryset><django-orm> | 2024-08-02 04:56:36 | 1 | 1,165 | Kholdarbekov |
78,823,804 | 2,707,864 | Where is it specified the path to look for kernel.json, to select the jupyter kernel in anaconda? | <p>I am launching an Anconda prompt from a Windows shortcut.
Its target is <code>%windir%\System32\cmd.exe "/K" %PYTHONDIR%\Scripts\activate.bat root</code>,
with <code>PYTHONDIR=C:\Users\User1\Anaconda\</code>.</p>
<p>At the prompt I get</p>
<pre><code>(base) C:\Users\User1\Documents> jupyter kernelspec l... | <python><json><anaconda><kernel><jupyter> | 2024-08-02 04:42:33 | 1 | 15,820 | sancho.s ReinstateMonicaCellio |
78,823,339 | 20,087,266 | Type hinting list of child classes when the original list is of the parent's type in Python | <p>Given a variable with the type hint <code>list[ParentItem]</code>, how can one assign another list to it with the type hint <code>list[ChildItem]</code>, where <code>ChildItem</code> is derived from <code>ParentItem</code>, without triggering linter type checking errors?</p>
<p>Consider the following contrived, mini... | <python><python-typing> | 2024-08-01 23:32:51 | 1 | 4,086 | Kyle F. Hartzenberg |
78,823,052 | 13,578,682 | What does "python3 -t" do? | <pre><code>$ python3 -t -c 'print("hello world")'
hello world
</code></pre>
<p>What does <code>-t</code> do? It's not mentioned in <code>python3 --help</code>.</p>
<p>Usually unknown options cause a non-zero exit code, like</p>
<pre><code>$ python3 -r
Unknown option: -r
usage: python3 [option] ... [-c cmd | -... | <python><command-line> | 2024-08-01 21:09:11 | 1 | 665 | no step on snek |
78,822,863 | 3,711,985 | pip and system python (3.12.4) don't work properly anymore after installing pyenv | <p>I installed pyenv to run an old code on python 3.7.17. Now I need to go back to version 3.12.4 which is the system python (before installing pyenv). But right now I can't even run pip :/</p>
<pre><code>โ ~ pip install <CLI-package-name>
pyenv: pip: command not found
The `pip' command exists in these Python v... | <python><pyenv><pyenv-virtualenv> | 2024-08-01 20:05:19 | 1 | 5,842 | Birish |
78,822,817 | 759,991 | TemplateSyntaxError Could not parse the remainder | <p>I have this bit of jinja2 in my Django template:</p>
<pre><code>{% for filesystem, total_quota, total_usage, df_usage in totals_by_filesystem %}
<tr>
<td>{{ filesystem }}</span></td>
<td>{{ total_quota | filesizeformat }}</td>
<td>{{ total_usage | filesizeforma... | <python><django><jinja2> | 2024-08-01 19:47:45 | 2 | 10,590 | Red Cricket |
78,822,798 | 20,122,390 | Can explicitly invoking the garbage collector in Python have side effects in this case? | <p>can anyone help me with this?
When I call the heal_client method, and gc.collect() is executed, it successfully closes my database connection (just what I need). Is there something wrong with this approach, specifically with calling gc.collect() ?
(This code is part of a larger context involving asyncio and other li... | <python><garbage-collection> | 2024-08-01 19:41:11 | 0 | 988 | Diego L |
78,822,778 | 798,099 | In python, is there a way to print the user provided name (not the value) of a variable that is supplied to a function? | <p>I would like to print out the name of a variable that is supplied when a function is used in Python.</p>
<p>The goal is to use the supplied name in some printed text.</p>
<p>There are multiple questions dealing with similar topics, but I am unable to find an exact solution or approach.</p>
<p>I am running Python 3 o... | <python><variables><debugging> | 2024-08-01 19:34:49 | 1 | 401 | blue and grey |
78,822,692 | 1,609,514 | How to register dependencies programmatically in a Python DVC pipeline | <p>I want to run a sequence of experiments and each experiment will use certain input data files (dependencies), each of which I want to prepare when an experiment is run. (Some experiments will use the same input data sets so they won't need to be re-generated during subsequent experiments).</p>
<p>At first I thought ... | <python><dependencies><pyyaml><dvc> | 2024-08-01 19:08:17 | 2 | 11,755 | Bill |
78,822,565 | 892,621 | Inlining external jsonschema references with Python | <p>I have a question similar to <a href="https://stackoverflow.com/questions/47054088/fully-expanding-ref-references-in-a-json-schema-with-python">this one</a> except all I want to do is take external references and inline them.</p>
<p>For example, let's say I have a schema like this one:</p>
<pre><code>{
"$de... | <python><json><reference><jsonschema><inlining> | 2024-08-01 18:30:24 | 1 | 682 | papercrane |
78,822,540 | 18,769,241 | How to grab an object from the ground placed in front of NAO? | <p>I want to make NAO grab a ball placed in front of him at (0,0)-(y,z) refrence and placed on the ground, I want the robot to grab it with the right hand (the ball being fit to its hand), for that I have developed the following code (using joint angles based arm movement as stated in the docs: <a href="http://doc.alde... | <python><nao-robot><choregraphe> | 2024-08-01 18:25:17 | 0 | 571 | Sam |
78,822,168 | 2,287,458 | Use polars when-then-otherwise on multiple output columns at once | <p>Assume I have this dataframe</p>
<pre class="lang-py prettyprint-override"><code>import polars as pl
df = pl.DataFrame({
'item': ['CASH', 'CHECK', 'DEBT', 'CHECK', 'CREDIT', 'CASH'],
'quantity': [100, -20, 0, 10, 0, 0],
'value': [99, 47, None, 90, None, 120],
'value_other': [97, ... | <python><dataframe><python-polars> | 2024-08-01 16:56:20 | 2 | 3,591 | Phil-ZXX |
78,822,093 | 6,503,917 | On VSCode, when using #%% cells, shift-enter no longer executes a cell in the interactive window and moves to the next cell | <p>On VSCode, when using #%% cells, shift-enter no longer executes a cell in the interactive window and moves to the next cell. It used to work for many years, but now shift-enter on some line of code throws an error in a new window titled 'Python REPL'. I can still use control-enter to execute a cell in the interactiv... | <python><visual-studio-code> | 2024-08-01 16:37:46 | 3 | 419 | javid |
78,821,975 | 1,924,830 | Can non-displayed fields of a Django model be altered during custom form validation but before committing model's data? | <p>for the last few weeks I've been working on my first Django project: a database to register all incoming orders from Customers for a generic enterprise. Let's assume that each one of the sale reps could be assigned to a specific Customer for a whole natural year and assignments may vary from one year to another (i.e... | <python><django><django-models><django-forms> | 2024-08-01 16:08:51 | 2 | 303 | grover999 |
78,821,828 | 18,595,760 | Intellisense issue when importing requests module in vscode | <pre><code>import sys
import requests
print(sys.executable)
r = requests.get("https://google.com")
print(r.status_code)
</code></pre>
<p>I wrote some simple code as above. Intellisense works well when inputting "requests.get()" while it stopped working when inputting "r.status_code". It s... | <python><visual-studio-code><python-requests><pylance> | 2024-08-01 15:35:06 | 1 | 317 | test1229 |
78,821,744 | 20,944,710 | How to Scale YOLOv8 Inference using Databricks | <p>I have successfully trained a YOLOv8 model using the Ultralytics Python package and now aim to run inference on 100 million images stored in an S3 bucket. Currently, I have a Databricks notebook with GPU acceleration that performs inference, but I don't know how to scale this.</p>
<p>From the Databricks documentatio... | <python><databricks><yolo><mlflow><yolov8> | 2024-08-01 15:20:03 | 1 | 316 | Bindestrich |
78,821,557 | 9,571,463 | Assigning an Attribute to a @staticmethod in Python | <p>I have a scenario where I have objects with static methods. They are all built using an outside <code>def build_hello()</code> as class variables.</p>
<pre><code>def build_hello(name: str):
@staticmethod
def hello_fn():
return "hello my name is "
# Assign an attribute to the staticmeth... | <python><class><static-methods> | 2024-08-01 14:42:22 | 2 | 1,767 | Coldchain9 |
78,821,465 | 1,471,980 | how do you performn division calculation on number of columns over a common column in pandas | <p>I have this data frame:</p>
<pre><code>Node Band 5-May 12-May 19-May 26-May 2-June
Server1 10000 800 1000 12000 12500 500
Server2 30000 600 3000 12000 12500 500
Server3 17000 1500 12000 12500 500 1000
</code></pre>
<p>I need to cal... | <python><pandas> | 2024-08-01 14:19:48 | 2 | 10,714 | user1471980 |
78,821,429 | 7,343,051 | Diagonal line from start to endpoints in log x-scale matplotlib | <p>I am trying to plot a diagonal line from point (0, 0) to (1, 1) in <code>matplotlib</code> using a logarithmic x-scale. This is the MWE:</p>
<pre class="lang-py prettyprint-override"><code>plt.plot([0, 1], [0, 1])
plt.xscale('log')
plt.show()
</code></pre>
<p>I would expect to see an exponential function in such a l... | <python><matplotlib><xscale> | 2024-08-01 14:13:19 | 1 | 314 | gasar8 |
78,821,371 | 2,562,927 | Django query to sum the n largest related values | <p>I have a db that tracks players' scores over a number of games. I want to create a leaderboard using each player's 4 highest scoring games.</p>
<p>Here are my models:</p>
<pre><code>class Event(models.Model):
name = models.CharField(max_length=120)
class Player(models.Model):
name = models.CharField(max_len... | <python><sql><django> | 2024-08-01 14:01:14 | 1 | 1,133 | desired login |
78,821,355 | 10,517,777 | Clone git repository and install python packages in a shared folder path | <p>I have a python project in a git repository and I am creating an azure pipeline to do the following tasks for that project:</p>
<ol>
<li>If git repository does not exist on a shared folder path, then clone it, else pull the last code.</li>
<li>If virtual environment folder (.venv) does not exist on a shared folder p... | <python><azure-pipelines-yaml> | 2024-08-01 13:57:58 | 2 | 364 | sergioMoreno |
78,821,132 | 401,173 | How do I get the AWS Glue Job CDK construct to update the script asset? | <p>I have a Glue Job and an S3 Asset defined in CDK. The resources create correctly but the update of the script file does not trigger the Glue Job to update its script in the resource.</p>
<p>How do I get the job to update when I update the content of the asset?</p>
<pre><code> dynamodb_etl_job_script = s3_assets.A... | <python><aws-glue><aws-cdk> | 2024-08-01 13:05:58 | 0 | 3,241 | Josh Russo |
78,820,957 | 9,885,747 | Understanding File Access in Databricks File System (DBFS) versus Volumes with Python and Spark | <p>I am currently trying to read and display a file from the Databricks File System (DBFS), but I encountered an issue. Here is the code I was using:</p>
<pre><code>file_path = "/dbfs/cluster-logs/use_case/default_job_cluster/cluster_id/init_scripts/cluster_id/20240801_proxy-init.sh.stderr.log"
with open(fil... | <python><apache-spark><file-io><filesystems><databricks> | 2024-08-01 12:26:26 | 0 | 1,685 | DataBach |
78,820,951 | 1,749,980 | EasyOCR inconsistent in recognizing letter "e" when by itself | <p>I have a function in Python which reads text in Portuguese with EasyOCR. For some reason it doesn't always recognize the <strong>"e"</strong> between bigger words, which is a <strong>common connector word in this language.</strong></p>
<p>Is there any way in which I could force EasyOCR to recognize the &qu... | <python><ocr><easyocr> | 2024-08-01 12:24:47 | 1 | 448 | Anika |
78,820,861 | 17,194,313 | Fold or "unpivot" similar column names (with matching prefix) into structs using Polars | <p>I have a wide polars data frame that follows a very consistent pattern</p>
<pre class="lang-py prettyprint-override"><code>import polars as pl
pl.Config(tbl_cols=10)
schema = [
'x-latest', 'x-mean', 'x-std',
'y-latest', 'y-mean', 'y-std',
'z-latest', 'z-mean', 'z-std'
]
df = pl.DataFrame([range(n, n... | <python><dataframe><python-polars> | 2024-08-01 12:04:13 | 1 | 3,075 | MYK |
78,820,475 | 7,766,155 | Cannot import OllamaEmbedding from llama_index.embeddings.ollama | <p>I get error:</p>
<pre><code>---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Cell In[3], line 1
----> 1 from llama_index.embeddings.ollama import OllamaEmbedding
ModuleNotFoundError: No module named 'llama_inde... | <python><python-3.x><pip><llama-index><ollama> | 2024-08-01 10:38:23 | 2 | 301 | AmirWG |
78,820,362 | 4,941,009 | VSCode quick fix does not suggest imports from a Python package in the same workspace | <h2> Overview </h2>
I have a VSCode workspace which contains two directories. In one is my main application, in another is a common package used by this application and a couple of others.
<pre><code> # main-app.code-workspace
"folders": [
{
"path": "."
},
{
&quo... | <python><visual-studio-code><python-poetry><pylance> | 2024-08-01 10:09:30 | 0 | 468 | EmmaO91 |
78,820,328 | 3,186,922 | How to add the instana span context to HTTP headers? | <p>Service A got an instana span (say <code>spanX</code>) and I need to send this spanX to service B via an HTTP call to make a child span (say <code>spanY</code>) out of it. I read through and found that in OpenTelemetry <code>TextMapPropagator</code> can be used to inject span to HTTP headers. But couldn't find a doc... | <python><open-telemetry><instana> | 2024-08-01 10:00:53 | 1 | 6,332 | Hari Krishnan |
78,820,308 | 2,697,895 | How can I call a Java class method from Python? | <p>I am making an Android app in Python using <code>briefcase</code> from <code>BeeWare</code> that must start a service. And I have this code...</p>
<p>This is the relevant code from file <strong>MainActivity.java</strong>:</p>
<pre><code>package org.beeware.android;
import com.chaquo.python.Kwarg;
import com.chaquo.... | <python><java><chaquopy> | 2024-08-01 09:56:28 | 1 | 3,182 | Marus Gradinaru |
78,820,057 | 10,200,497 | How can I find the maximum value of a dynamic window and the minimum value below it? | <p>This is my DataFrame:</p>
<pre><code>import pandas as pd
df = pd.DataFrame(
{
'a': [3, 1, 2, 5, 10, 3, 13, 3, 2],
}
)
</code></pre>
<p>Expected output is creating a <code>a_max</code> and <code>a_min</code>:</p>
<pre><code> a a_max a_min
0 3 NaN NaN
1 1 3 1
2 2 3 1
... | <python><pandas><dataframe> | 2024-08-01 09:07:51 | 1 | 2,679 | AmirX |
78,820,055 | 546,465 | Why is attn_mask in PyTorch' MultiheadAttention specified for each head separately? | <p>PyTorch <a href="https://pytorch.org/docs/stable/generated/torch.nn.MultiheadAttention.html#torch.nn.MultiheadAttention" rel="nofollow noreferrer">MultiheadAttention</a> allows to specify the attention mask, either as 2D or as 3D. The former will be broadcasted over all N batches the latter allows one to specify spe... | <python><pytorch><large-language-model><transformer-model><multihead-attention> | 2024-08-01 09:07:23 | 1 | 4,712 | Bastiaan |
78,819,839 | 6,036,210 | Stripe Webhook timeout on localhost with FastAPI | <p>I have an issue with a stripe webhook, which I am running locally for the test.</p>
<pre><code>async def my_webhook_view(request: Request, db: Session = Depends(get_db)):
payload = await request.body()
sig_header = request.headers.get('stripe-signature')
event = None
try:
event = stripe.Webho... | <python><stripe-payments><fastapi><webhooks> | 2024-08-01 08:19:57 | 0 | 435 | TropicalViking |
78,819,386 | 10,576,322 | Python docker: remove unused dependencies to reduce image size | <p>I dockerize an python app that has a dependency on a package that has dependency in numpy, pandas, scipy, etc..</p>
<p>Actually in the actual app only part of that dependencies are actually used.</p>
<p>But when I install the application in dockerfile, all the wheels are downloaded and unpacked. Which leads to an la... | <python><docker> | 2024-08-01 06:18:49 | 1 | 426 | FordPrefect |
78,819,169 | 10,294,812 | Comparing different methods of rolling back database changes in pytest tests for SQLAlchemy | <p>I'm working on a project that uses FastAPI and SQLAlchemy asynchronously. <br>
I've written pytest tests for this project and have successfully implemented database rollback after each test run. <br>
I've found two different implementation methods, but I'm unsure about the differences between them. Are both methods ... | <python><postgresql><sqlalchemy><fastapi> | 2024-08-01 04:46:16 | 1 | 492 | ACE Fly |
78,819,158 | 2,256,085 | Analytical solution suffering from lack of precision | <p>I'm attempting to use python to solve the following analytical solution (eq. 4 <a href="https://onepetro.org/SPEATCE/proceedings-abstract/10ATCE/All-10ATCE/SPE-134670-MS/102057" rel="nofollow noreferrer">from here</a>) for a heat transport problem to verify the results calculated by a numerical model:</p>
<p><a href... | <python><scipy> | 2024-08-01 04:39:59 | 1 | 469 | user2256085 |
78,819,087 | 154,911 | How to use mouse left button drag to pan on matplotlib's polar coordinate axis | <p>it looks like the pan feature works badly on the polar axis. It does not pan the plot when I drag the left mouse button. See the image shot below:</p>
<p><a href="https://i.sstatic.net/2foX6HkM.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/2foX6HkM.png" alt="mouse drag to pan" /></a></p>
<p>The pan ... | <python><matplotlib><polar-coordinates> | 2024-08-01 04:00:41 | 2 | 1,220 | ollydbg23 |
78,819,007 | 990,639 | Unable to send a POST form data in python | <p>I am trying to use Python default library http.client to send a form-data. The reason is that I am unable to install other packages like requests on the system and it does not have even the urllib3.</p>
<p>Python code here</p>
<pre><code>import http.client
import uuid
def send_email_http_only(from_email, reply_to, ... | <python><http.client> | 2024-08-01 03:21:33 | 0 | 1,147 | Eugene |
78,818,979 | 4,802,259 | Watchdog: Change Schedule after start | <p>I'm attempting to write a <a href="https://docs.stackstorm.com/sensors.html" rel="nofollow noreferrer">StackStorm Sensor</a> that leverages <a href="https://python-watchdog.readthedocs.io/en/stable/quickstart.html" rel="nofollow noreferrer">Watchdog</a> for its file watching capabilities. There is a builtin sensor, ... | <python><multithreading><python-watchdog><stackstorm> | 2024-08-01 03:04:30 | 0 | 2,864 | David Culbreth |
78,818,917 | 6,541,639 | Sphinx doc toctree click "jumps" to nav anchor instead of top | <p>When I click a toctree (navbar) item, the page "jumps/jolts" to the toc element instead of the top of the new page as if it's aligning with the toctree anchor (instead of the body h1 or just generally to the top page):</p>
<p><a href="https://i.sstatic.net/M6Zm5s8p.png" rel="nofollow noreferrer"><img src="... | <python><python-sphinx><restructuredtext> | 2024-08-01 02:34:56 | 1 | 1,063 | dylanh724 |
78,818,655 | 3,314,925 | How to automate downloading data from webpage? | <p>I am trying to automate the downloading of an Excel files from an open Government website using Python and Selenium. I've tried XPath to select and click on buttons, but the script doesn't select the button correctly. The manual process is select:</p>
<ol>
<li>Ship Movements (top left of page)</li>
<li>Next 7 days (... | <python><selenium-webdriver><automation><download> | 2024-07-31 23:49:37 | 1 | 1,610 | Zeus |
78,818,544 | 11,790,979 | custom python package not importing | <p>I wrote a package to collect data and now im trying to interact with it to store and serve said data, but it's not importing, even though I have installed it on pip. This is the PyPI page: <a href="https://pypi.org/project/smog-usage-stats/" rel="nofollow noreferrer">https://pypi.org/project/smog-usage-stats/</a> an... | <python><packaging><pypi> | 2024-07-31 22:43:39 | 1 | 713 | nos codemos |
78,818,526 | 3,361,462 | Creating a decorator with dynamic parameter | <p>I have some simple decorator that gets an argument:</p>
<pre><code>def deco(name):
def outer(f):
def inner(*args, **kwargs):
print(name)
return f(*args, **kwargs)
return inner
return outer
</code></pre>
<p>and a class:</p>
<pre><code>class A:
def __init__(self, n... | <python><inheritance> | 2024-07-31 22:37:16 | 2 | 7,278 | kosciej16 |
78,818,501 | 21,540,734 | subproces.Popen with an or "|" symbol isn't working | <p>I'm trying to list just the IP Address of my Wi-Fi network adapter to be able to detect if it is connected and has an IP address attached to it.</p>
<p>With this by itself it is working...</p>
<pre class="lang-py prettyprint-override"><code>from subprocess import Popen
Popen([
'netsh',
'interface',
'ip'... | <python><subprocess><popen> | 2024-07-31 22:23:57 | 1 | 425 | phpjunkie |
78,818,387 | 7,211,014 | Elastic python request timeout error: Pool reached maximum size and no more connections are allowed | <p>I am using Elasticsearch python module. I am trying to set up a connection to the sever like this</p>
<pre><code>es = Elasticsearch([config.endpoint],
api_key=config.key,
request_timeout=config.request_timeout )
</code></pre>
<p>The server connects, then I try to execute enric... | <python><http><elasticsearch><timeout> | 2024-07-31 21:24:10 | 0 | 1,338 | Dave |
78,818,365 | 7,698,116 | Java sshtools generated EDDSA signature not matching with Python's pycryptome's generated signature | <p>I have a python library that uses <code>pycryptodome</code> library to sign data using Ed25519 algorithm using an openssh format ED25519 private key. The signature then needs to be verified in a Java application using <code>sshtools</code> library with corresponding public key. However the signature verification is ... | <python><java><cryptography><pycryptodome><eddsa> | 2024-07-31 21:10:33 | 1 | 368 | ATK |
78,818,244 | 850,781 | Get a single row in a tuple-indexed DataFrame | <p>I have a pandas <a href="https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.html" rel="nofollow noreferrer"><code>DataFrame</code></a>:</p>
<pre><code>>>> f = pd.DataFrame.from_dict({"r0":{"c0":1,"c1":2},("r",1):{"c0":3,"c1":4}},orient=&... | <python><pandas><dataframe><indexing> | 2024-07-31 20:26:21 | 2 | 60,468 | sds |
78,818,176 | 3,446,619 | how to read Matlab duration object from Python? | <p>I create a Matlab duration object and save it to a .mat file:</p>
<pre><code>timeend = seconds(123);
save('time.mat', timeend, '-v7.3');
</code></pre>
<p>Then I read it from Python:</p>
<pre><code>with h5py.File('time.mat', 'r') as f:
var = f['timeend'][:]
print(list(var))
</code></pre>
<p>Then <code>var</c... | <python><numpy><matlab><duration> | 2024-07-31 20:04:41 | 1 | 645 | Xin Niu |
78,817,860 | 1,832,942 | Piping python to file gives UnicodeEncodeError: 'charmap' codec can't encode character '...' in position ...: character maps to <undefined> | <p>In the Windows terminal, Python 3.x printing a unicode character works fine; it correctly outputs: ๐:</p>
<pre><code>python -c "print('๐')"
</code></pre>
<p>But piping the same command to a file:</p>
<pre><code>python -c "print('๐')" > log.txt
</code></pre>
<p>causes:</p>
<pre><code>Traceba... | <python><windows><unicode><command-line-interface> | 2024-07-31 18:22:34 | 1 | 14,828 | Michael B. Currie |
78,817,759 | 3,486,684 | Extracting from a column containing a list of structs, using another column containing values a field of the structs much match | <p>Consider the example:</p>
<pre class="lang-py prettyprint-override"><code>import polars as pl
df = pl.DataFrame(
[
pl.Series(
"id",
["alpha", "beta"],
),
pl.Series(
"s",
[
[{"x&qu... | <python><python-polars> | 2024-07-31 17:54:34 | 3 | 4,654 | bzm3r |
78,817,564 | 17,101,330 | Unable to build pySFML - 'Time' is not a type identifier | <p>I'm unsuccessfully trying to build <strong>pySFML</strong> from <a href="https://github.com/intjelic/python-sfml" rel="nofollow noreferrer">https://github.com/intjelic/python-sfml</a> on my <strong>Windows</strong> machine with <strong>Python 3.12</strong> (aswell as 3.11, 3.10, 3.9).</p>
<p>I have downloaded <stron... | <python><cython><sfml> | 2024-07-31 17:00:09 | 1 | 530 | jamesB |
78,817,555 | 534,238 | How to avoid `setattr` (and `getattr`) when using Python? And is it necessary to avoid | <p>If I want to add a value to a field in a protocol buffer that isn't known at compile time, I'm currently doing <code>setattr</code>. I normally don't like using <code>setattr</code> because it seems less secure. But when I know the object is a protobuf, I'm thinking it is fine, because the value I'm setting it to mu... | <python><protocol-buffers><setattr> | 2024-07-31 16:58:39 | 1 | 3,558 | Mike Williamson |
78,817,543 | 8,382,067 | GridDB TQL Invalid Column | <p>I'm currently working with GridDB for a project involving IoT data, and I'm facing an issue with executing SQL-like queries using GridDB's TQL (Time Series SQL-like Query Language).</p>
<p>Here is a brief description of what I am trying to achieve:</p>
<p>I have a container in GridDB which stores IoT sensor data.
I ... | <python><iot><griddb> | 2024-07-31 16:55:07 | 1 | 2,099 | Josh Adams |
78,817,443 | 11,505,680 | EngFormatter for minor ticks on a log scale | <p>I want to change the formatting of tick labels without changing which ones are displayed. This code gets me halfway there:</p>
<pre class="lang-py prettyprint-override"><code>plt.plot(range(5), [5e3, 7e3, 9e3, 11e3, 13e3], marker='o')
plt.yscale('log')
plt.gca().yaxis.set_major_formatter(ticker.EngFormatter())
</cod... | <python><matplotlib> | 2024-07-31 16:26:41 | 1 | 645 | Ilya |
78,817,421 | 1,028,270 | How do I merely hide some properties from a dataclass's constructor but still access them in methods? | <p>I just want to prevent users from being able to set some properties, but all of the options I see don't seem to work.</p>
<p>Using <code>__post_init__</code> and <code>init=False</code> I'm not able to access and update those properties from methods I have attached to the class.</p>
<p>When I define them with <code>... | <python><python-dataclasses> | 2024-07-31 16:21:30 | 1 | 32,280 | red888 |
78,817,346 | 6,166,453 | How to resolve the crewai error: Input should be a valid dictionary or instance of BaseAgent? | <p>I am using crewai to set up 3 agents with one as manager agent and 2 worker agents. This works perfectly fine when I use a sequential process but when I switch to hierarchical processing, I see the following error</p>
<pre><code>manager_agent
Input should be a valid dictionary or instance of BaseAgent [type=model_... | <python><openai-api><crewai> | 2024-07-31 16:03:54 | 2 | 1,073 | Diablo3093 |
78,817,335 | 3,598,205 | ffmpeg python causing deadlock | <p>I am facing issues using ffmpeg python to process camera frames. My first approach with process.communicate() worked well, but has latency issues.</p>
<pre><code>process = (
ffmpeg
.input('pipe:', format='rawvideo', pix_fmt='rgb24', s='{}x{}'.format(width, height))
.filter(<fil... | <python><ffmpeg><subprocess><ffmpeg-python> | 2024-07-31 16:02:02 | 0 | 457 | sa_penguin |
78,817,193 | 12,016,688 | How is "type" not a keyword in Python? | <p>In Python 3.12 we have type aliases like this:</p>
<pre class="lang-py prettyprint-override"><code>Python 3.12.4+ (heads/3.12:99bc8589f0, Jul 27 2024, 11:20:07) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> type S = s... | <python><python-typing><keyword> | 2024-07-31 15:32:08 | 1 | 2,470 | Amir reza Riahi |
78,817,087 | 5,858,995 | Programatically get name of dataclass property | <p>Let's say I have a dataclass like this:</p>
<pre class="lang-py prettyprint-override"><code>@dataclass(init=True)
class TestDataclass:
property1: str
</code></pre>
<p>I want to fetch the name of this property like <code>TestDataclass.property1.__name__</code>, however this throws an <code>AttributeError</code>, ... | <python><python-dataclasses> | 2024-07-31 15:09:10 | 0 | 462 | Dzeri96 |
78,816,744 | 14,190,819 | Failed while converting '.h5' model into '.tflite' using TensorFlow 2.0 | <p>When converting the model from <strong>.h5</strong> to <strong>.tflite</strong>
<br><br>
<strong>Code I'm using:<br></strong></p>
<pre><code>import torch
import torch.nn as nn
import detectron2
from detectron2.modeling import build_model
from detectron2.modeling import build_model
from torch.ao.quantization import (... | <python><tensorflow><keras><pytorch><tflite> | 2024-07-31 13:52:09 | 1 | 1,323 | Muhammad Ammar |
78,816,685 | 13,946,204 | How to set method for instance dynamically in Python? | <p>I need to update method for instance in runtime and my hypothetical code is looking like:</p>
<pre class="lang-py prettyprint-override"><code>def set_method(where_to_set: str):
def the_method(self):
print(where_to_set, '->', self)
return the_method
class A:
one = set_method('as class attr `one`')
tw... | <python> | 2024-07-31 13:38:48 | 0 | 9,834 | rzlvmp |
78,816,652 | 2,287,458 | Multiply polars columns of number type with object type (which supports __mul__) | <p>I have the following code.</p>
<pre class="lang-py prettyprint-override"><code>import polars as pl
class Summary:
def __init__(self, value: float, origin: str):
self.value = value
self.origin = origin
def __repr__(self) -> str:
return f'Summary({self.value},{self.origin})'
... | <python><dataframe><multiplication><python-polars> | 2024-07-31 13:33:07 | 2 | 3,591 | Phil-ZXX |
78,816,599 | 10,003,538 | How do I passa PyDub AudioSegment object into a pyannote.audio Pipeline? | <p>Here is my so far code</p>
<pre><code># SETUP
from pydub import AudioSegment
import torch
pipeline.to(torch.device("cuda"))
from pyannote.audio import Pipeline
pipeline = Pipeline.from_pretrained(
"pyannote/speaker-diarization-3.1",
use_auth_token="hf_#####")
audio = AudioSe... | <python><pytorch><pydub><audiosegment> | 2024-07-31 13:22:15 | 1 | 1,225 | Chau Loi |
78,816,264 | 9,808,792 | How to Optimize Rolling Correlation Calculation Across All Column Pairs in a Large Pandas DataFrame | <p>I want to compute the rolling Pearson correlation between all pairs of columns in a large Pandas DataFrame. Here's the current implementation I am using:</p>
<pre><code>import itertools
import pandas as pd
from tqdm import tqdm
def pairwise_rolling_correlations_naive(df, window_size):
column_pairs = list(iterto... | <python><pandas><dataframe><optimization> | 2024-07-31 12:13:46 | 1 | 3,830 | micycle |
78,816,181 | 13,806,869 | How can I link the records in the training dataset to the corresponding model predictions? | <p>Using scikit-learn, I've set up a regression model to predict customers' maximum spend per transaction. The dataset I'm using looks a bit like this; the target column is maximum spend per transaction during the previous year:</p>
<pre><code>customer_number | metric_1 | metric_2 | target
----------------|----------|-... | <python><pandas><scikit-learn><regression> | 2024-07-31 12:00:01 | 2 | 521 | SRJCoding |
78,815,926 | 2,287,458 | Apply Python dict to Polars column (using replace_strict) | <p>I have a <code>dict</code> and a polars <code>DataFrame</code> and want to map one column to the values of the dict:</p>
<pre class="lang-py prettyprint-override"><code>import polars as pl
df = pl.DataFrame({
'label': ['AA', 'BB', 'AA', 'CC'],
'type': ['CASH', 'ITEM', 'CHECK', 'CHECK'],
})
mapping = {
... | <python><dataframe><dictionary><replace><python-polars> | 2024-07-31 11:02:41 | 1 | 3,591 | Phil-ZXX |
78,815,656 | 22,221,987 | How to add priority task to celery queue without fetching disabling | <p>I have a celery worker, with <strong>concurrency set to 1</strong>, which takes tasks from RabbitMQ. I want to make a system with only one queue in a single concurrency setup, so, all tasks are going to be added in main queue.</p>
<p>About the task - its just a loop where we update state with <code>task.update_state... | <python><python-3.x><rabbitmq><celery><fastapi> | 2024-07-31 09:58:06 | 0 | 309 | Mika |
78,815,544 | 3,378,204 | How to correctly save a fine tuned model using apple MLX framework | <p>We're using <a href="https://github.com/ml-explore/mlx" rel="nofollow noreferrer">MLX</a> to fine tune a model fetched from hugging face.</p>
<pre><code>from transformers import AutoModel
model = AutoModel.from_pretrained('deepseek-ai/deepseek-coder-6.7b-instruct')
</code></pre>
<p>We fine tuned the model with comma... | <python><machine-learning><deep-learning><large-language-model> | 2024-07-31 09:35:34 | 1 | 11,155 | Eugene |
78,815,102 | 270,043 | Unable to filter away dataframes in huge dataset in PySpark | <p>I have a huge PySpark dataframe that contains 1.5B rows, including the column <code>fieldA</code>. I have a list of 8.8M unique <code>fieldA</code> values, that I want to filter out of the 1.5B rows. However, I think due to the large data size, I keep getting errors like <code>StackOverflowError</code> or <code>OutO... | <python><pandas><pyspark><out-of-memory> | 2024-07-31 08:00:20 | 1 | 15,187 | Rayne |
78,815,010 | 2,826,018 | SVM most important coefficient doesn't have dependency on target class | <p>I've trained an SVM classifier with my data, looked at the coefficients and then plotted the most important training feature against my target class. However, I found there to be no dependency ( x axis is the class, y axis is the most important feature ). I trained the SVM on whether the class value is 0 or greater ... | <python><scikit-learn><svm> | 2024-07-31 07:42:10 | 1 | 1,724 | binaryBigInt |
78,814,860 | 1,259,406 | Adding Status text to a (Textual) Footer | <p>I'm trying to create an enditor where the Footer contains the usual bindings on the left and some status information on the right, for example the line number.
The Footer in textual is very simple so I thought to extend it, but I'm unable to see both my label and the binding of the base Footer.
This is my code:</p>
... | <python><textual><python-textual> | 2024-07-31 07:09:38 | 1 | 1,328 | maugch |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.