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,419,357 | 13,709,317 | Why wont the `grpc` package install on my system? | <p>Hi I'm trying to install the <code>grpc</code> python package via pip. It is actually intended to be installed by a build script for another setup that I am doing but the script kept on failing so I decided to do it myself.</p>
<p>Here is what I get:</p>
<pre><code>❯ pip3 install grpc
Defaulting to user installation... | <python><grpc> | 2024-05-02 13:04:31 | 1 | 801 | First User |
78,418,960 | 3,024,945 | How do I know if flag was passed by the user or has default value? | <p>Sample code:</p>
<pre><code>import click
@click.command
@click.option('-f/-F', 'var', default=True)
def main(var):
click.echo(var)
main()
</code></pre>
<p>Inside <code>main()</code> function, how can I check if <code>var</code> parameter got <code>True</code> value by default, or it was passed by the user?</p... | <python><python-click> | 2024-05-02 11:52:24 | 1 | 1,458 | Kossak |
78,418,933 | 13,202,601 | Single operator floor division | <p>What programming languages other than Python has the floor division as a single operator from the programmers' point of view?
Why does it even exist? Please don't give me the answer of because it can!</p>
<p>I did google for it first but most results are just about accomplishing the same thing with combination of an... | <python><programming-languages> | 2024-05-02 11:46:18 | 1 | 802 | stackoverblown |
78,418,808 | 5,378,816 | How to write a test if the argument defines a type | <p>This is not a <code>pydantic</code> question, but to explain why am I asking: <code>pydantic.TypeAdapter()</code> accepts (among many others) all the following type definitions as its argument and can create a working validator for them:</p>
<pre><code>int
int|str
list
list[str|int]
typing.Union[int,str]
typing.Lite... | <python> | 2024-05-02 11:22:31 | 1 | 17,998 | VPfB |
78,418,183 | 15,290,244 | How to create fulltext index without specifying node label in Cypher | <p>I tried to create a fulltext index for all nodes based on <a href="https://neo4j.com/docs/cypher-manual/current/indexes/semantic-indexes/full-text-indexes/#create-full-text-indexes" rel="nofollow noreferrer">this documentation</a></p>
<p>This is the query I came up with:</p>
<pre><code>CREATE FULLTEXT INDEX full_tex... | <python><neo4j><cypher> | 2024-05-02 09:34:08 | 2 | 743 | Simao Gomes Viana |
78,418,010 | 22,466,650 | How to switch between parent classes during child instantiation? | <p>I'm trying to make a custom class <code>CsvFrame</code> that is a dataframe made either with pandas or polars.</p>
<p>For that I made the code below:</p>
<pre><code>class CsvFrame:
def __init__(self, engine, *args, **kwargs):
if engine == 'polars':
import polars as pl
pl.DataFrame... | <python><class> | 2024-05-02 09:04:42 | 1 | 1,085 | VERBOSE |
78,417,713 | 2,186,848 | How do I write tests for my django-extensions cron job? | <p>I have a cron job in my Django app that's defined as a <code>MinutelyJob</code> (from <code>django-extensions</code>).</p>
<p>How do I write tests for the job? <a href="https://django-extensions.readthedocs.io/en/latest/jobs_scheduling.html" rel="nofollow noreferrer">The module documentation</a> is quite sparse, an... | <python><django><cron><django-extensions> | 2024-05-02 08:04:50 | 0 | 624 | Flup |
78,417,678 | 12,556,481 | Downloading is not working using the Python requests library | <p>I'm trying to download a PDF using the following URL, but I can't see any content. When I try different URLs, it works fine. Can someone explain what the issue might be? Does it have something to do with this website?
This is the code:</p>
<pre><code>import requests
pdf_url="https://www.npci.org.in/PDF/nach/ci... | <python><python-requests><request> | 2024-05-02 07:59:06 | 2 | 309 | dfcsdf |
78,417,407 | 9,827,719 | Docker file with Ubuntu, Python and Weasyprint - Problem with venv | <p>I am trying to get a docker image with Ubuntu, Python and Weasyprint to work.
I think the error for me is that <code>requirements.txt</code> is installed in a Python venv. When I try to run main.py it gives me a error <code>ModuleNotFoundError: No module named 'sqlalchemy'</code>, so it did install requirements.txt,... | <python><docker><weasyprint> | 2024-05-02 07:01:12 | 1 | 1,400 | Europa |
78,417,363 | 1,328,979 | Validate a recursive data structure (e.g. tree) using Python Cerberus (v1.3.5) | <p>What is the right way to model a recursive data structure's schema in Cerberus?</p>
<h3>Attempt #1:</h3>
<pre class="lang-py prettyprint-override"><code>from cerberus import Validator, schema_registry
schema_registry.add("leaf", {"value": {"type": "integer", "required&quo... | <python><recursion><tree><cerberus> | 2024-05-02 06:52:29 | 1 | 1,464 | Marc Carré |
78,417,261 | 2,772,127 | pyenv is killed during module installation? | <p>I installed pyenv (on Debian 12) as I need to run a program that uses python 10.<br />
Now I also need a module called local-attention.
So I tried to install it with <code>pip</code>:</p>
<pre><code>pip install --user local-attention
Collecting local-attention
Using cached local_attention-1.9.1-py3-none-any.whl (8... | <python><pyenv> | 2024-05-02 06:31:30 | 0 | 1,066 | Duddy67 |
78,417,252 | 9,951,273 | Overload function with SupportsInt and not SupportsInt? | <p>I want to overload the function below so if passed a value that supports <code>int()</code> Python type hints <code>int</code> otherwise Python type hints the value passed.</p>
<p>Python <code>typing</code> module provides a <code>SupportsInt</code> type we can use to check if our value supports int.</p>
<pre><code>... | <python><python-typing> | 2024-05-02 06:28:27 | 3 | 1,777 | Matt |
78,417,251 | 4,488,349 | How exactly does tensorflow perform mini-batch gradient descent? | <p>I am unable to achieve good results unless I choose a batch size of 1. By good, I mean error decreases significantly through the epochs. When I do a full batch of 30 the results are poor, error behaves erratically decreasing only slightly and then learning nothing, or increasing. However, tensorflow gets good resul... | <python><tensorflow><gradient-descent><mini-batch><stochastic-gradient> | 2024-05-02 06:28:22 | 1 | 380 | debo |
78,417,247 | 4,286,568 | How to reverse a NumPy array using stride_tricks.as_strided | <p>Is it possible to reverse an array using <code>as_strided</code> in NumPy? I tried the following and got garbage results</p>
<p>Note : I am aware of indexing tricks like ::-1, but what to know if this can be achieved thru ax_strided.</p>
<pre class="lang-py prettyprint-override"><code>import numpy as np
from numpy.l... | <python><arrays><numpy> | 2024-05-02 06:27:15 | 1 | 1,125 | balu |
78,417,241 | 16,390,058 | Controlling raspberry pi bluetooth with a python script | <p>I have a Raspberry Pi 4 Model B running Raspberry Pi OS Lite 64-bit with</p>
<p>Operating System: Debian GNU/Linux 12 (Bookworm)<br />
Kernel: Linux 6.6.20+rpt-rpi-v8.</p>
<p>I have to control the Bluetooth of the Raspberry with a Python script.
The script has to be able to enable/disable Bluetooth and rename the Ra... | <python><raspberry-pi><bluetooth><raspberry-pi4> | 2024-05-02 06:25:30 | 1 | 317 | Plat00n |
78,417,221 | 16,869,946 | Implementing n-player Elo rating in pandas dataframe | <p>Sorry if this is a rather complicated question.
I have a pandas dataframe that records the result of races between different players:</p>
<p><code>Race_ID</code> records different races</p>
<p><code>Racer_ID</code> records different players</p>
<p><code>N</code> denotes the number of players in that game</p>
<p><cod... | <python><python-3.x><pandas><dataframe><group-by> | 2024-05-02 06:21:33 | 2 | 592 | Ishigami |
78,417,215 | 7,640,923 | Extracting specific patterns of substrings from a material description column | <p>I have a column named MAT_DESC in a table that contains material descriptions in a free-text format. Here are some sample values from the MAT_DESC column:</p>
<pre><code>
QWERTYUI PN-DR, Coarse, TR, 1-1/2 in, 50/Carton, 200 ea/Case, Dispenser Pack
2841 PC GREY AS/AF (20/CASE)
CI-1A, up to 35 kV, Compact/Solid, Stran... | <python><sql><sql-server> | 2024-05-02 06:20:35 | 1 | 315 | rohi |
78,417,187 | 3,114,229 | vscode pydevd warning: Computing repr of ... was slow | <p>I'm using VSCode for Python and I'm experiencing following warning which I'm unable to suppress:</p>
<pre><code>pydevd warning: Computing repr of slow_repr_instance (SlowRepr) was slow (took 2.00s)
Customize report timeout by setting the `PYDEVD_WARN_SLOW_RESOLVE_TIMEOUT` environment variable to a higher timeout (de... | <python><json><visual-studio-code><warnings><pydev> | 2024-05-02 06:10:35 | 0 | 419 | Martin |
78,416,773 | 1,613,983 | How do I use python logging with uvicorn/FastAPI? | <p>Here is a small application that reproduces my problem:</p>
<pre><code>import fastapi
import logging
import loguru
instance = fastapi.FastAPI()
@instance.on_event("startup")
async def startup_event():
logger = logging.getLogger("mylogger")
logger.info("I expect this to log")
... | <python><logging><fastapi><uvicorn> | 2024-05-02 03:16:10 | 2 | 23,470 | quant |
78,416,745 | 10,935,201 | How to properly setup tensorflow with GPU acceleration on NixOS | <p>In advance, I have just started using NixOS, so please forgive me if I make seemingly basic mistakes.</p>
<p>I have looked up what feels like the entirety of the Internet in the search of the solution to my problem.</p>
<p>Here is my shell.nix so far:</p>
<pre><code>with import <nixos> {};
mkShell {
name = &... | <python><tensorflow><nixos> | 2024-05-02 03:02:54 | 1 | 389 | The Developer |
78,416,469 | 353,407 | How to fix "Toppra failed to find the maximum path acceleration" | <p>I'm using Drake's <a href="https://drake.mit.edu/doxygen_cxx/classdrake_1_1multibody_1_1_toppra.html" rel="nofollow noreferrer">Toppra</a> implementation to post-process a path produced by <a href="https://drake.mit.edu/doxygen_cxx/classdrake_1_1planning_1_1trajectory__optimization_1_1_gcs_trajectory_optimization.ht... | <python><drake> | 2024-05-02 00:23:19 | 1 | 5,543 | Mark |
78,416,456 | 283,735 | Multiple distributions from single Python repository | <p>I'm looking for a way to create multiple distribution package configurations from a single repository. For example, given my source layout:</p>
<pre><code>project/
|__src/
| |__a/
| | |__a.py
| | b/
| | |__b.py
| | c/
| | |__c.py
|__pyproject.toml
</code></pre>
<p>I want two create two different flavors o... | <python><setuptools><monorepo><pyproject.toml> | 2024-05-02 00:15:52 | 0 | 31,287 | jjkparker |
78,416,331 | 1,172,685 | Why are python timezone.utc and ZoneInfo("UTC") not equivalent tzinfo objects? How to check they are the same TZ? | <p>Why are these not equal?</p>
<pre class="lang-py prettyprint-override"><code>>>> from datetime import datetime
>>> from datetime import timedelta
>>> from datetime import timezone
>>> from zoneinfo import ZoneInfo
>>> from zoneinfo import ZoneInfoNotFoundError
>>&g... | <python><timezone><zoneinfo> | 2024-05-01 23:11:38 | 1 | 1,714 | Darren Weber |
78,416,282 | 3,476,463 | AIC function for lightgbm, xgboost and randomforest regression | <p>I'm trying to evaluate regression models created using <code>LightGBM</code>, <code>XGBoost</code>, and randomforest, with aic. My approach is to order features in terms of feature importance, fit, predict, and calculate aic, then drop the least important feature, and repeat. The goal is to find the least number of... | <python><regression><random-forest><xgboost><lightgbm> | 2024-05-01 22:51:44 | 0 | 4,615 | user3476463 |
78,416,262 | 15,229,911 | SQLite database locking even with threading.Lock | <p>I use sqlite3 database on my flask website, and on each database access I use a threading.Lock in order to avoid memory races:</p>
<pre class="lang-py prettyprint-override"><code># one sync, one connection, one cursor for the entirety of the website
sync = threading.Lock()
connection = sqlite3.connect('db', check_sa... | <python><sqlite><flask><passenger> | 2024-05-01 22:42:07 | 1 | 324 | postcoital-solitaire |
78,416,214 | 2,475,195 | How many trees do I actually have in my LightGBM model? | <p>I have code that looks like this</p>
<pre><code>clf = lgb.LGBMClassifier(max_depth=3, verbosity=-1, n_estimators=3)
clf.fit(train_data[features], train_data['y'], sample_weight=train_data['weight'])
print (f"I have {clf.n_estimators_} estimators")
fig, ax = plt.subplots(nrows=4, figsize=(50,36), sharex=Tru... | <python><machine-learning><lightgbm><boosting> | 2024-05-01 22:24:21 | 1 | 4,355 | Baron Yugovich |
78,416,197 | 4,133,464 | How to send data between Docker containers on the same network | <p>I have two docker containers on the same network. I want to send some data with POST and GET methods over HTTP. I am doing:</p>
<pre><code>app = Flask(__name__)
is_processing = False # Flag to indicate whether processing is ongoing
receiver_url = "http://172.18.0.2:8889/receive_data" # Define the receive... | <python><docker><docker-network> | 2024-05-01 22:20:04 | 0 | 819 | deadpixels |
78,416,147 | 251,589 | Changing the exception type in a context manager | <p>I currently have code that looks like this scattered throughout my codebase:</p>
<pre class="lang-py prettyprint-override"><code>try:
something()
except Exception as exc:
raise SomethingError from exc
</code></pre>
<p>I would like to write a context manager that would remove some of this boiler-plate:</p>
<... | <python><exception><contextmanager> | 2024-05-01 22:00:32 | 1 | 27,385 | sixtyfootersdude |
78,416,001 | 2,267,058 | How to configure openapi-generator-cli to include None values for nullable fields in Pydantic models | <p>I'm using openapi-generator-cli to generate Python clients, and it's working great except for a specific scenario. I need to send requests to an external service where all nullable fields must be included even if their values are None. When I generate the client with openapi-generator-cli, it creates models with a t... | <python><swagger><pydantic><openapi-generator><openapi-generator-cli> | 2024-05-01 21:14:56 | 1 | 323 | Chubutin |
78,415,959 | 2,986,147 | appropriate way to create group_rand_coef_data in GPBoost's GPModel | <p>Below is the code I copied from the GPBoost site. <a href="https://github.com/fabsig/GPBoost/blob/master/examples/python-guide/generalized_linear_Gaussian_process_mixed_effects_models.py" rel="nofollow noreferrer">https://github.com/fabsig/GPBoost/blob/master/examples/python-guide/generalized_linear_Gaussian_process... | <python><mixed-models> | 2024-05-01 21:00:40 | 1 | 375 | stok |
78,415,935 | 1,738,879 | How to remove parent keys from a nested dictionary if child keys are empty without modifying the original dictionary? | <p>I have a nested dictionary for which I need to remove parent keys if some predefined child keys are empty. For example, consider the following dictionary d:</p>
<pre><code>d = {
'outer_key_1': {
'class': 'a_class',
'items': {
'A': { # <- this key should be removed
... | <python><python-3.x> | 2024-05-01 20:55:36 | 0 | 1,925 | PedroA |
78,415,870 | 23,260,297 | powershell script missing argument in parameter list | <p>I am trying to run a powershell script that executes a python exe file which takes a json file as an argument.</p>
<p>I checked my json file, and the contents are valid.</p>
<p>My powershell script looks like so:</p>
<pre><code>& "C:\RPA\0001-DHR\DHR_ConsolidateMarks\DHR_ConsolidateMarks.exe" test.json... | <python><powershell><pyinstaller> | 2024-05-01 20:38:15 | 0 | 2,185 | iBeMeltin |
78,415,860 | 1,564,070 | Visio VBA set dynamic connector to straight connector style | <p>I'm using Python to control Visio via win32com.Client on a Windows 10 Platform. I've had a lot of success with this project but am stuck trying to find an answer. I've been scouring the Microsoft docs (for VBA of course) but cannot find an answer.</p>
<p>I'm adding connections points to shapes and connecting them ... | <python><vba><visio> | 2024-05-01 20:34:57 | 1 | 401 | WV_Mapper |
78,415,856 | 5,728,013 | Detecting GPU availability in llama-cpp-python | <h3>Question</h3>
<p>How can I programmatically check if <code>llama-cpp-python</code> is installed with support for a CUDA-capable GPU?</p>
<h3>Context</h3>
<p>In my program, I am trying to warn the developers when they fail to configure their system in a way that allows the <code>llama-cpp-python</code> LLMs to lever... | <python><gpu><llama-cpp-python><llamacpp> | 2024-05-01 20:33:56 | 2 | 810 | Programmer.zip |
78,415,800 | 6,722,582 | Run a specific set of pytest tests in a specific sequence only by specifying test names | <p>To reproduce a pytest failure, I would like to run one or more tests in a specific sequence via <code>pytest</code> without modifying the original source files (adding markers would not be allowed). The tests are scattered across multiple source files and I do not want to execute the other tests in those files.</p>
... | <python><pytest> | 2024-05-01 20:19:44 | 1 | 348 | Brandon Tweed |
78,415,718 | 513,393 | In Azure Functions in Python. Setting SessionID when publishing message to Azure Service Bus | <p>I drafted an Azure Function in Python, model V2.</p>
<p>I have successfully published a message into a topic.</p>
<p>Now I would like to <strong>set a SessionID for a published message</strong>, but can not figure out how. How do I publish a <strong>message with a SessionId</strong>?</p>
<p>My attempt with JSON in &... | <python><azure><azure-functions><azureservicebus><azure-servicebus-topics> | 2024-05-01 19:58:58 | 2 | 6,591 | Skip |
78,415,679 | 12,339,047 | When is wheel required alongside setuptools? | <p>In <a href="https://peps.python.org/pep-0518/#build-system-table" rel="nofollow noreferrer"><em>PEP 518 – Specifying Minimum Build System Requirements for Python Projects</em></a> it says:</p>
<blockquote>
<p>For the vast majority of Python projects that rely upon setuptools, the <code>pyproject.toml</code> file wil... | <python><python-packaging><python-wheel><pyproject.toml><pep517> | 2024-05-01 19:49:49 | 0 | 1,428 | platypus |
78,415,638 | 825,227 | Cleaner way to parse a PDF in Python | <p>Looking to parse PDFs to glean relevant info.</p>
<p>Using <code>pypdf</code> and am able to extract text, but it's a bit of a slog formatting into something usable because it appears the PDFs are formatted and not straight text.</p>
<p>For instance, looking to extract 'Asset', 'Transaction Type' and 'Amount', from ... | <python><parsing><pdf><pypdf> | 2024-05-01 19:39:41 | 1 | 1,702 | Chris |
78,415,453 | 825,227 | Is there a way to retrieve search results from a public domain in Python | <p>Looking at something like this:</p>
<p><a href="https://disclosures-clerk.house.gov/FinancialDisclosure" rel="nofollow noreferrer">https://disclosures-clerk.house.gov/FinancialDisclosure</a></p>
<p>Using the 'Search' function in the box on the left, I'd like to select a year in the 'Filing Year' dropdown and retriev... | <python><html><python-requests> | 2024-05-01 18:53:11 | 1 | 1,702 | Chris |
78,415,332 | 4,276,951 | How do I fix this error: in PyCharm: The application was unable to start correctly (0xc0000005) | <p>After doing a fresh install of PyCharm 2019.2.5 with Windows 10, I get this message</p>
<p><a href="https://i.sstatic.net/glJRjIzc.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/glJRjIzc.png" alt="The application was unable to start correctly (0xc0000005)" /></a></p>
<p>I tried to install it for a co... | <python><pycharm><jetbrains-ide><aslr> | 2024-05-01 18:21:49 | 1 | 2,657 | Avi Parshan |
78,415,299 | 344,286 | Is there any built-in way in Flask/Jinja to create a link with the URL? | <p>An example, in CommonMark, if I type:</p>
<pre><code>http://example.com
</code></pre>
<p>Then this will get converted to:</p>
<pre class="lang-html prettyprint-override"><code><a href="http://example.com">http://example.com</a>
</code></pre>
<p>This tag has 2x the <code>http://example.com</code... | <python><flask><jinja2> | 2024-05-01 18:12:55 | 1 | 52,263 | Wayne Werner |
78,415,089 | 472,673 | Creating HDF5 virtual dataset for dynamic data using h5py | <p>I have a HDF5 file which contains three 1D arrays in different datasets. This file is created using h5py in Python and the 1D arrays are continually being appended to (ie growing). For simplicity, let’s call these 1D arrays as “A”, “B” and “C” and let’s say each array initially contains 100 values, but every second ... | <python><hdf5><h5py> | 2024-05-01 17:19:41 | 1 | 1,349 | Mark |
78,414,996 | 3,415,543 | wxPython Slider incorrectly displays with sized panels | <p>Creating a slider in a wxPython sized panel incorrectly displays the labels as shown here:</p>
<p><a href="https://i.sstatic.net/ED9FxOfZ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ED9FxOfZ.png" alt="enter image description here" /></a></p>
<p>The following is the smallest program I could write t... | <python><wxpython> | 2024-05-01 17:01:07 | 1 | 555 | Sequestered1776Vexer |
78,414,992 | 6,703,592 | dataframe tuple name column set a value | <pre><code>import pandas as pd
df = pd.DataFrame([[0,0], [0,0]], index=['a', 'b'])
df.columns = [(1,2), (3,4)]
df.at['a', (1,2)] = 100
print(df)
</code></pre>
<p>My column name is a tuple and I want to set value 100 to one of rhe cell. The expected result is</p>
<pre><code> (1, 2) (3, 4)
a 100 0
b 0 ... | <python><pandas><dataframe> | 2024-05-01 17:00:37 | 1 | 1,136 | user6703592 |
78,414,881 | 16,759,116 | Equivalent of a() < b() < c() without chaining? | <p>(Inspired by a <a href="https://langdev.stackexchange.com/q/3755/5199">question</a> about an AEC to WebAssembly compiler and its answers, where I can imagine this might matter.)</p>
<p>The simple <code>a() < b() and b() < c()</code> isn't equivalent because <code>b()</code> might get called twice.</p>
<p>Using... | <python> | 2024-05-01 16:33:56 | 4 | 10,901 | no comment |
78,414,849 | 3,155,240 | How to tick "choose paper source by pdf page size" in adobe acrobat reader | <p>I have a pdf. I'd like to be able to set the "Choose paper source by PDF page size" checkbox in adobe acrobat reader. I could've sworn some time ago, I'd found a way to set it to be on all the time by setting an option in the viewer preferences, but after scouring through the preferences and internet, I ha... | <python><python-3.x><pdf><adobe><acrobat> | 2024-05-01 16:27:27 | 1 | 2,371 | Shmack |
78,414,724 | 2,796,170 | SQLAlchemy Event Listeners - Best Way to get update values while using do_orm_execute | <p>When using <code>sqlalchemy</code> event listeners, I'm wondering the recommended/best way to get the actual updated values while using the <code>do_orm_execute</code> session event.</p>
<p>For example, when detecting ORM events using something like <code>before_flush</code> I can do something like:</p>
<pre class="... | <python><sqlalchemy> | 2024-05-01 15:57:37 | 0 | 557 | codeAndStuff |
78,414,645 | 2,040,705 | Unable to Display Images in Google Colab | <p>This google colab cell doesn't show any image, how to fix it?</p>
<p>First I connect to google drive and set working directory.</p>
<pre><code>from google.colab import drive
drive.mount('/content/drive/')
import os
os.chdir("/content/drive/My Drive/Colab Notebooks")
</code></pre>
<p>Then in Markdown cell I... | <python><jupyter-notebook><markdown><google-colaboratory> | 2024-05-01 15:44:27 | 0 | 1,396 | user40 |
78,414,585 | 673,600 | Using FAISS in Databricks | <p>Despite installing the correct package I cannot make the following code work to add an index to a Dataset.</p>
<p>Failing to work at the following line:</p>
<pre><code>embeddings_dataset.add_faiss_index(column="embeddings")
</code></pre>
<p>gives the following error message</p>
<pre><code>ImportError: You ... | <python><databricks><faiss> | 2024-05-01 15:31:55 | 0 | 6,026 | disruptive |
78,414,334 | 7,091,922 | How to access environmental variables when executing a python-behave test? | <p>I am trying to set up a <code>behave</code> test for my app and I need to access many different environmental variables during the execution.</p>
<p>For example, I have code that checks if the ENVIRONMENT is local, dev or prod.</p>
<p>I saw that in the <code>environment.py</code> file I can access parameters passed ... | <python><environment-variables><python-behave> | 2024-05-01 14:42:37 | 1 | 823 | A Campos |
78,414,110 | 8,271,180 | Python assign inherited class | <p>I have a class <code>A</code> that has many attributes, lets call them a,b,c,...,z</p>
<p>Then I have a class B that inherites from A. Inside a function in B I want to set all the self attributes of A to another instance of A.</p>
<pre><code>class B(A):
def set_A(obj:A):
self.a = obj.a
self.b = o... | <python><class><inheritance><syntax> | 2024-05-01 14:00:28 | 0 | 1,356 | Tomer Wolberg |
78,414,094 | 3,010,486 | Draw a outline mask based on image shape - Using Canny edge - updated | <p>I would like to <strong>draw an outline mask (shape) based on the image shape</strong>.
I am using <strong>opencv-python version 4.9.0.80</strong>.</p>
<p>So when we have an <strong>images like these</strong>.</p>
<p><a href="https://i.sstatic.net/Z4O6Qzbmm.png" rel="nofollow noreferrer"><img src="https://i.sstatic.... | <python><numpy><opencv><image-processing> | 2024-05-01 13:56:43 | 3 | 3,246 | NiRmaL |
78,413,936 | 7,334,203 | Python requests put to update image always give a 400. Im following the documentation | <p>im having this issue:
My code is this</p>
<pre><code>import requests
import json
import re
# Define your Shopify store's API key and password
API_KEY = 'xxxxxxxxxxxxxxxxxx'
PASSWORD = 'xxxxxxxxxxxxxx'
API_TOKEN = 'xxxx_xxxxxxxxxcd7'
SHOPIFY_DOMAIN = 'https://www.xxxx.xxx/'
headers = {
'X-Shopify-Access-Token'... | <python><python-requests><shopify-app> | 2024-05-01 13:19:24 | 0 | 7,486 | RamAlx |
78,413,842 | 6,714,667 | How can i remove only single lines between text to chunk it up? | <p>I have a text file:</p>
<pre><code>title
header
topic one two three
hello harry
</code></pre>
<p>i want to remove only single lines between text to get:</p>
<pre><code>title
header
topic one two three
hello harry
</code></pre>
<p>how i can do this using python?</p>
<pre><code>data = open('data.txt').read().repl... | <python><text><strip> | 2024-05-01 12:58:38 | 2 | 999 | Maths12 |
78,413,787 | 4,915,288 | ValueError: No chrome executable found on PATH, chromedriver_autoinstaller.install | <p>Trying to use chromedriver_autoinstaller.install() but getting the ValueError: No chrome executable found on PATH</p>
<pre><code>chromedriver_autoinstaller.install()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/e/reports_automation/venv/lib/python3... | <python><python-3.x><google-chrome><selenium-webdriver><selenium-chromedriver> | 2024-05-01 12:45:37 | 2 | 954 | Lohith |
78,413,784 | 18,139,225 | How to make the unit show up at the result after square root calculation using handcalcs and forallpeople Python libraries? | <p>I am using forallpeople Python library within handcalcs Python library. After performing square root calculation, the unit is not showing up at the calculation result:</p>
<pre><code>import handcalcs.render
from math import sqrt, pi
import forallpeople as si
si.environment('structural', top_level=True)
</code></pre>... | <python><jupyter-lab> | 2024-05-01 12:45:11 | 2 | 441 | ezyman |
78,413,739 | 10,035,190 | make authenticated and login work for multiple table other then auth User table django? | <p>I have created hostTable model in hostlogin app and I want to use this table for login purpose for that i have created custom authenticate function because default authenticate() was working for auth user table only. Also login() is not attaching current session to the users from hostTable. Although it working fine ... | <python><django><authentication><django-models><django-rest-framework> | 2024-05-01 12:35:19 | 1 | 930 | zircon |
78,413,655 | 1,020,139 | Pydantic ConfigDict(use_enum_values=True) has no effect when providing default value. How can I provide default values? | <p>The following is a simplified example.</p>
<p>I need to configure <code>ConfigDict(use_enum_values=True)</code> as the code performs <code>model_dump()</code>, and I want to get rid of raw enum values for the purpose of later serialization.</p>
<p>How can <code>A</code> provide a default value for <code>A.x</code>, ... | <python><pydantic> | 2024-05-01 12:09:33 | 1 | 14,560 | Shuzheng |
78,413,287 | 13,561,669 | Unable to interact with google maps with selenium to get route details | <p>I am trying to interact with google maps to get route related data. Here is what I have written so far.</p>
<pre><code>from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWai... | <python><google-maps><selenium-webdriver><automation> | 2024-05-01 10:43:48 | 1 | 307 | Satya Pamidi |
78,412,978 | 659,389 | Mypy + FlaskSQLAlchemy + model multiple inheritance => has no attribute | <p>It seems that <code>mypy</code> is having problems taking into account all the superclasses and reports missing attributes. Here is a simple example:</p>
<pre><code>import uuid
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import String
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.orm i... | <python><sqlalchemy><flask-sqlalchemy><mypy><python-typing> | 2024-05-01 09:25:48 | 1 | 1,333 | koleS |
78,412,917 | 7,334,203 | GraphQL mutation for updating products is not working | <p>im trying to implement a python script that will update every product's alt text image to a specific text.
My code initially is this:
import requests
import json
import re</p>
<pre><code># Define your Shopify store's API key and password
API_KEY = '88xxxxxxxxxxxxxxxxxxxxxxxxxxxxf'
PASSWORD = '0xxxxxxxxxxxxxxxxxxxxxx... | <python><graphql><shopify> | 2024-05-01 09:08:18 | 0 | 7,486 | RamAlx |
78,412,846 | 5,747,326 | Issues processing XML files using Saxonica(saxonche) with Python | <p>I'm using <code>saxonche</code> python library for XPath3.1 ops in python. I have created a FastAPI that just accepts the XML filename, opens it, processes and returns the response.
It worked fine during development on an Intel MacBook, but in production on an Amazon m7g.2xlarge instance (Debian 12 ARM64), it fails ... | <python><saxon><saxon-c> | 2024-05-01 08:52:15 | 1 | 746 | N Raghu |
78,412,680 | 10,136,501 | Error while initializing SparkSession in Windows | <p>I'm getting the below error message while initialing the SparkSession in my Windows system.
I have followed the below steps and added the respective path as Env Varaiable:</p>
<ol>
<li>Install Java 11 and set JAVA_HOME as env variable</li>
<li>Create a venv and Install Python 3.10 using Anaconda</li>
<li>Download Sp... | <python><apache-spark><pyspark> | 2024-05-01 08:05:52 | 1 | 369 | RevolverRakk |
78,412,549 | 14,471,688 | How to perform matthews_corrcoef in sklearn simultaneously between every column using a matrix X and and output y? | <p>I want to calculate the Matthews correlation coefficient (MCC) in sklearn between every column of a matrix X with an output y. Here is my code:</p>
<pre><code>from sklearn.metrics import matthews_corrcoef
import numpy as np
X = np.array([[1, 0, 0, 0, 0],
[1, 0, 0, 1, 0],
[1, 0, 0, 0, 1],... | <python><numpy><scikit-learn> | 2024-05-01 07:32:08 | 1 | 381 | Erwin |
78,412,322 | 4,391,249 | How to make a Protocol that inherits methods and attributes from a concrete class | <h2>Scenario</h2>
<p>I have a <code>Foo</code> protocol:</p>
<pre class="lang-py prettyprint-override"><code>class Foo(Protocol):
fooname: str
def do_fooey_things(self):
pass
</code></pre>
<p>and a bunch of different types of concrete Foos:</p>
<pre class="lang-py prettyprint-override"><code>class Purp... | <python><mypy><python-typing><pyright> | 2024-05-01 06:29:56 | 0 | 3,347 | Alexander Soare |
78,412,286 | 10,964,685 | dmc card responsivity - plotly dash | <p>I've got multiple <code>dmc.card</code> items within a dash app layout. I've got them set to a specific height and width. I've also instilled <code>base, sm, md, lg</code> values to account for a responsive change in screen settings.</p>
<p>I'm trying to achieve the same response that the traditional <code>dbc.Card<... | <python><css><plotly-dash> | 2024-05-01 06:18:10 | 1 | 392 | jonboy |
78,412,205 | 4,112,504 | How to realize tsaregular function of Matlab in python? | <p>I know the <code>tsa</code> function and can make a similar function in Python.</p>
<p>But I'm having trouble understanding <code>tsaregular</code><a href="https://ww2.mathworks.cn/help/predmaint/ref/tsaregular.html" rel="nofollow noreferrer">1</a> :Regular signal of a time-synchronous averaged signal.</p>
<p>I want... | <python><matlab><signal-processing> | 2024-05-01 05:53:24 | 1 | 340 | Jilong Yin |
78,412,032 | 20,088,885 | UncaughtPromiseError > TypeError Uncaught Promise > Failed to fetch Odoo | <p>I'm having a little bit of trouble after installing odoo17 successfully, when I create a new page in my website I get this error</p>
<pre><code>TypeError: Failed to fetch
at Object.get (https://website.com/web/assets/6db5172/web.assets_web.min.js:2861:92)
at https://website.com/web/assets/6db5172/web.assets_... | <python><odoo> | 2024-05-01 04:35:22 | 1 | 785 | Stykgwar |
78,412,008 | 8,844,500 | Python multiprocessing apply_async with callback does not update the dictionary data structure | <p>I'm trying to count all the tokens in a catalog. Due to the large amount of document, I'd like to do this counting using multiprocessing (or any other parallel calculation tool that you're free to mention). My problem is that naive construction does not work.</p>
<p>Here the minimal example I constructed</p>
<pre cl... | <python><python-multiprocessing> | 2024-05-01 04:23:24 | 2 | 329 | FraSchelle |
78,411,879 | 342,553 | Why mock.patch works on attribute of object that is already imported | <p>I am aware of the importance of path to mock as illustrated <a href="https://stackoverflow.com/questions/20242862/why-python-mock-patch-doesnt-work">here</a>, but consider this Django scenario</p>
<p>models.py</p>
<pre class="lang-py prettyprint-override"><code>class Proxmox(Model):
@property
def api(self, .... | <python><python-mock> | 2024-05-01 03:22:36 | 1 | 26,828 | James Lin |
78,411,847 | 4,490,974 | Python not buffering audio correctly | <p>I have a python script that fetches audio file from GCS and is meant to buffer only a max of 10 seconds of audio each time per chunk.</p>
<p>However it is not working, it starts off good but when a long file say 2 hours long, it ends up being out by a lot. Say the current play head is 4min it has buffered 5min total... | <python><python-3.x> | 2024-05-01 03:03:42 | 0 | 895 | Russell Harrower |
78,411,784 | 46,503 | SQLAlchemy: Confused with many-to-many relationship for the same table and additional data | <p>I want a user to be referral and referee, and store some additional data. Here is my code:</p>
<pre><code>class User(UserMixin, db.Model):
__tablename__ = 'user'
referees = db.relationship('RefData', back_populates='referral', lazy='dynamic')
referrals = db.relationship('RefData', back_populates='referee... | <python><sqlalchemy> | 2024-05-01 02:37:25 | 2 | 5,287 | mimic |
78,411,725 | 2,813,606 | How to parse nested dictionaries into Pandas DataFrame | <p>I have a pretty crazy dictionary that I'm trying to parse out into a pandas dataframe. Here is a smaller version of what the dictionary looks like:</p>
<pre><code>import datetime
from decimal import *
test_dict = [{'record_id': '43bbdfbf',
'date': datetime.date(2023, 3, 25),
'person': {
'id': '123abc',
... | <python><json><pandas><dictionary><datetime> | 2024-05-01 02:06:28 | 1 | 921 | user2813606 |
78,411,570 | 13,860,156 | Implementing custom lasso regression with fixed features in sklearn pipeline for variable selection | <p>There are two posts related to this topic in R language <a href="https://stats.stackexchange.com/questions/519878/including-fixed-effects-in-a-lasso-elastic-net-regression-model-in-r">including fixed regressor in a Lasso regression model</a> and <a href="https://stackoverflow.com/questions/55971712/fixed-effects-log... | <python><scikit-learn><feature-selection><lasso-regression> | 2024-05-01 00:43:33 | 1 | 399 | ORSpecialist |
78,411,491 | 5,450,919 | Oracle SQL Cloud programmatically using Python 3.12 | <p>I'm experiencing difficulty connecting to Oracle SQL Cloud programmatically using Python 3.12. I'm running an M2 MacBook Pro within a virtualenv, and I've successfully installed the 'cx_Oracle' library. Despite trying various approaches, I haven't been able to resolve the issue. Has anyone encountered this problem a... | <python><oracle-database><cx-oracle> | 2024-04-30 23:59:19 | 0 | 629 | b8con |
78,411,428 | 2,850,815 | VSCode python debugger always activates base env on top of selected interpreter with anaconda | <p>After setting up Anaconda and VSCode on my new Mac and selecting my desired python interpreter (in this case called <code>lotteryfl</code>), it seems that a new terminal always starts with a base env activated on top of <code>lotteryfl</code>. This also applies when I try to start the debugger, so that my installed ... | <python><visual-studio-code><anaconda><vscode-debugger> | 2024-04-30 23:27:19 | 3 | 873 | Hang Chen |
78,411,404 | 6,606,057 | Aggregate Dataframe by Set Number of Rows | <p>I have a dataframe that I would like to resample by averaging based on the number of rows.</p>
<p>For example i'd like to aggregate by every three rows:</p>
<pre><code> A B C
0 3 4 5
1 5 1 4
2 4 3 5
3 1 5 5
4 3 4 5
5 5 5 5
6 5 0 2
7 4 0 2
8 3 2 2
</code></pre>
<p>With the outcome bein... | <python><resample> | 2024-04-30 23:18:44 | 3 | 485 | Englishman Bob |
78,411,233 | 412,137 | Transitioning from setuptools to Poetry: Issues with Scripts and Package Data | <p>I'm migrating a Python project from setuptools to Poetry and encountering issues with my scripts not being recognized and including non-code files. Below is how I previously configured my project using setuptools in setup.py:</p>
<pre><code>from setuptools import setup, find_packages
version = "1.0.0"
se... | <python><setuptools><python-poetry> | 2024-04-30 22:12:31 | 1 | 2,767 | Nadav |
78,411,076 | 793,190 | Batch file that starts conda and opens Jupyter Notebook won't close on "exit" line | <p>I created a <code>.bat</code> file that starts conda in my <code>base</code> environment, then opens Jupyter Notebook. Here's the code:</p>
<pre><code>@echo off
call conda activate base
cd C:\Users\{myUserName}\OneDrive\Documents\Udemy Python Course\My Lesson Scripts
jupyter lab
</code></pre>
<p>That all works great... | <python><batch-file><jupyter-notebook><conda> | 2024-04-30 21:19:57 | 1 | 5,088 | marky |
78,411,055 | 993,812 | Find elements in xml file with lxml find() method | <p>I have xml files that are 1 million+ lines long. I'm able to parse them without issue with <code>BeautifulSoup</code>, but it can take a minute or more to do the parsing with <code>bs4</code>. I'm trying to use lxml to do the parsing to hopefully speed things up dramatically, but I can't get the <code>find()</code> ... | <python><lxml> | 2024-04-30 21:14:49 | 1 | 555 | John |
78,410,960 | 480,118 | psycopg3 mogrify: AttributeError: 'Connection' object has no attribute 'mogrify' | <p>Im using psycopg3 and would like to see what the actual sql with the parameters is so i can execute it using dbweaver...</p>
<pre><code> with psycopg.connect(self.connect_str, autocommit=True) as conn:
if self.log.level == logging.DEBUG:
cur = conn.cursor()
sql... | <python><postgresql><psycopg2><psycopg3> | 2024-04-30 20:50:24 | 1 | 6,184 | mike01010 |
78,410,848 | 7,211,014 | How do I add a public PGP key from a internal apt mirror inside python3.10-slim image? | <p>I need to set up <code>apt</code> inside of our container images to use our internal apt mirror.
This will require changing the apt sources, copying over the public key, adjusting apt to use a proxy, and then running <code>apt update</code></p>
<p>I have read many solutions line. Problem is, all of them either have ... | <python><docker><containers><apt><pgp> | 2024-04-30 20:18:44 | 1 | 1,338 | Dave |
78,410,672 | 9,191,338 | How to get detailed documentation on the setup and cleanup procedure of CPython interpreter? | <p>I'm running a multiprocessing application with Python, and have a hard time cleaning up the resource after the program finishes. My program has many interaction with C library, and I need to make sure resources in the C library are released properly.</p>
<p>Therefore, I would like to know the setup and cleanup proce... | <python> | 2024-04-30 19:24:12 | 0 | 2,492 | youkaichao |
78,410,548 | 6,213,343 | Polars: Use column values to reference other column in when / then expression | <p>I have a Polars dataframe where I'd like to derive a new column using a when/then expression. The values of the new column should be taken from a different column in the same dataframe. However, the column from which to take the values differs from row to row.</p>
<p>Here's a simple example:</p>
<pre class="lang-py ... | <python><dataframe><python-polars> | 2024-04-30 18:54:40 | 3 | 626 | Christoph Pahmeyer |
78,410,497 | 5,335,180 | A UTF-8 text file is failing to import via pandas with a UTF-8 encoding error | <p>I've got a text file exported from SQL as UTF-8 with about 5.5 million rows. I'm trying to then read this file with Pandas/Python, but getting</p>
<pre><code>UnicodeDecodeError: 'utf-8' codec can't decode byte 0xed in position 135596: invalid continuation byte
</code></pre>
<p>How can I troubleshoot this? I loaded t... | <python><pandas><utf-8> | 2024-04-30 18:42:22 | 3 | 489 | reas0n |
78,410,488 | 11,064,604 | DataFrame Creation from DataFrame.apply | <p>I have a function that returns a <code>pd.DataFrame</code> given a row of another dataframe:</p>
<pre><code>def func(row):
if row['col1']== 1:
return pd.DataFrame({'a':[1], 'b':[11]})
else:
return pd.DataFrame({'a':[-1, -2], 'b':[-11,-22]})
</code></pre>
<p>I want to use apply <code>func</cod... | <python><python-3.x><pandas><pandas-apply> | 2024-04-30 18:40:09 | 2 | 353 | Ottpocket |
78,410,441 | 2,079,306 | Python List to string manipulation. Print each command line argv "--option argument1 argument2" on their own separate lines | <p>I have a working solution, it's just so gross. I often write stuff like this and then just look at it disgusted, but this one is far to gross to leave as is... especially as it's just list to string manipulation. I'm embarrassed. I'm interested in more succinct solutions. Anyone have a cleaner way to put each option... | <python><printing><parameters><argv> | 2024-04-30 18:23:40 | 2 | 1,123 | john stamos |
78,410,407 | 18,139,225 | Is this a bug in forallpeople library or am I doing the arithmetic in a wrong way when using handcalcs library? | <p>I am performing hand calculations using <code>handcalcs</code> python library. I have just done the following test calculation using unit-aware calculation with the help of the <code>forallpeople</code> python library:</p>
<pre><code>import handcalcs.render
import forallpeople as si
si.environment('structural', top_... | <python><jupyter-lab> | 2024-04-30 18:14:38 | 1 | 441 | ezyman |
78,410,264 | 1,711,271 | Most efficient way to keep track of the samples I already selected from an array | <p>I have a moderately large <code>np</code> array (which could however get larger in the future):</p>
<pre class="lang-py prettyprint-override"><code>import numpy as np
x = np.arange(100_000).reshape((10_000,10))
</code></pre>
<p>I need to iteratively choose a random sample (row), making sure that I never choose the s... | <python><list><numpy> | 2024-04-30 17:40:20 | 3 | 5,726 | DeltaIV |
78,410,040 | 179,014 | Why is pandas rounding different from python rounding? | <p>It stumbled upon a case where Pandas and Python behave differently when rounding.</p>
<pre><code>>>> import pandas as pd
>>> numbers = [0.495,1.495,2.495,3.495,4.495,5.495,6.495, 7.495,8.495, 9.495, 10.495]
>>> [round(float(x),2 ) for x in numbers]
[0.49, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5,... | <python><pandas><rounding> | 2024-04-30 16:58:00 | 1 | 11,858 | asmaier |
78,410,011 | 6,899,925 | How to filter a queryset by a many2many field | <p>I have a Notification model which has a field called <code>seen_users</code> like so:</p>
<pre class="lang-py prettyprint-override"><code>from django.contrib.auth import get_user_model
User = get_user_model()
class Notification(models.Model):
title = models.CharField(max_length=255)
seen_users = models.Man... | <python><django><django-rest-framework><django-queryset> | 2024-04-30 16:51:05 | 1 | 703 | AbbasEbadian |
78,409,475 | 1,802,826 | Why does a command in my Bash-script return 0 even when it fails? Python, Whisper, ffmpeg | <p>I have a <code>bash</code> script that executes <code>whisper</code> on all sound files in a directory. Whisper uses <code>ffmpeg</code> to decode sound files to a format it can handle. One of the files in the directory was corrupt and caused ffmpeg to fail. The first time I executed my script it returned <code>1</c... | <python><bash><ffmpeg> | 2024-04-30 15:06:27 | 1 | 983 | d-b |
78,409,220 | 3,007,075 | code as notebook, how to reload custom module? | <p>See the example below:</p>
<pre><code>#%% cell 1
import my_custom_module
#%% cell2:
data = load_data_that_takes_a_long_time_to_load()
#%% cell 3:
result = my_custom_module.function_that_changes(data)
</code></pre>
<p>How can I write a python script that has those cell separations so it can run programmatically as... | <python> | 2024-04-30 14:27:50 | 0 | 1,166 | Mefitico |
78,409,218 | 520,556 | Handling a large matrix with numpy efficiently | <p>I am trying to run some simple calculations on a quite large matrix; roughly, 200Kx200K or real numbers. I need to obtain l1-norm, i.e., the sum of absolute values. <a href="https://stackoverflow.com/questions/48451167/numpy-set-absolute-value-in-place">Here is a similar question with addresses the question of absol... | <python><numpy> | 2024-04-30 14:27:30 | 1 | 1,598 | striatum |
78,409,120 | 2,301,970 | Wrong dependency installed with pip | <p>I wonder if anyone could please help me with this issue:</p>
<p>I have two python libraries <a href="https://github.com/Vital-Fernandez/lime" rel="nofollow noreferrer">lime</a> and <a href="https://github.com/Vital-Fernandez/specsy" rel="nofollow noreferrer">specsy</a>, where the first library is a dependency of th... | <python><pip><python-packaging><requirements.txt> | 2024-04-30 14:12:09 | 1 | 693 | Delosari |
78,409,103 | 1,741,868 | "No function matches the given name and argument types." when trying to insert a `DateTimeTzRange` with Sqlalchemy ORM | <p>I've got a database table in a Postgres 15 database, it's got two columns (amongst others), one is of type <code>daterange</code>, the other is <code>tstzrange</code>.</p>
<p>We've got some code that inserts to this table with raw SQL (via sqlalchemy core) by converting the <code>sqlalchemy.dialects.postgresql.Range... | <python><python-3.x><postgresql><sqlalchemy><psycopg2> | 2024-04-30 14:09:42 | 2 | 14,935 | Greg B |
78,408,949 | 3,238,957 | dynamic number of fields in executemany call | <p>I have a little python app that reads a large amount of data, and then attempts to insert it into a table.
To avoid having it all in memory, I utilize the executemany method, using a generator.</p>
<p>This program is very generic, and as such I do not know the number of fields in the table that I'm inserting into. H... | <python><mysql><sqlalchemy><executemany> | 2024-04-30 13:45:59 | 0 | 566 | da Bich |
78,408,880 | 14,471,688 | How to perform matthews_corrcoef in sklearn simultaneously for every column using a matrix? | <p>I want to perform Matthews correlation coefficient (MCC) in sklearn to find the correlation between different features (boolean vectors) in a 2D numpyarray. What I have done so far is to loop through each column and find correlation value between features one by one.</p>
<p>Here is my code:</p>
<pre><code>from sklea... | <python><numpy><scikit-learn> | 2024-04-30 13:33:51 | 2 | 381 | Erwin |
78,408,806 | 1,232,660 | Remove all nested XML tags | <p>I am trying to remove all "nested tags of same type". For every XML element, if you find another subelement in its subtree that has same name, remove its tag (keep its contents). In another words, transform <code><a>...<a>...</a>...</a></code> into <code><a>.........</a>... | <python><xml><lxml> | 2024-04-30 13:20:23 | 2 | 3,558 | Jeyekomon |
78,408,713 | 10,601,287 | How to set proxies with Selenium options when connecting to command-line generated google-chrome | <p>I am successfully running the chrome browser from the terminal with the following command:</p>
<blockquote>
<p>google-chrome --remote-debugging-port=9222 --user-data-dir="C:\selenum\ChromeProfile"</p>
</blockquote>
<p>I am then able to connect to this browser instance with the following line of code when i... | <python><selenium-webdriver><http-proxy><google-chrome-headless> | 2024-04-30 13:03:29 | 1 | 319 | Nancy Collins |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.