QuestionId
int64
74.8M
79.8M
UserId
int64
56
29.4M
QuestionTitle
stringlengths
15
150
QuestionBody
stringlengths
40
40.3k
Tags
stringlengths
8
101
CreationDate
stringdate
2022-12-10 09:42:47
2025-11-01 19:08:18
AnswerCount
int64
0
44
UserExpertiseLevel
int64
301
888k
UserDisplayName
stringlengths
3
30
⌀
77,553,399
16,988,223
flet python can't get the value of a dynamic dropdown
<p>I have a list of items for my dropdown created with <a href="https://flet.dev" rel="nofollow noreferrer">flet</a></p> <pre><code>dropdown_options = [&quot;np.int_&quot;, &quot;np.str_&quot;, &quot;np.float_&quot;] </code></pre> <p>This is no the problem, the problem is when I'm trying to get the value. But first let...
<python><flet>
2023-11-26 20:35:13
0
429
FreddicMatters
77,553,300
11,154,841
Anaconda: "ModuleNotFoundError: No module named 'gower'". Module not available in conda, but only in pip. Same error even after installing with pip
<p>Consider:</p> <pre class="lang-none prettyprint-override"><code>pip install gower Defaulting to user installation because normal site-packages is not writeable Looking in links: /usr/share/pip-wheels Collecting gower Using cached gower-0.1.2-py3-none-any.whl (5.2 kB) Requirement already satisfied: scipy in /opt/c...
<python><python-3.x><pip><anaconda>
2023-11-26 20:03:48
1
9,916
questionto42
77,553,299
5,594,008
Wagtail, change allowed extensions for WagtailImageField
<p>I'm trying to add extra extensions <code>wagtail.images.fields.WagtailImageField</code></p> <p>How it can be done? I've tried <a href="https://docs.wagtail.org/en/stable/reference/settings.html#wagtailimages-extensions" rel="nofollow noreferrer">https://docs.wagtail.org/en/stable/reference/settings.html#wagtailim...
<python><django><wagtail>
2023-11-26 20:03:12
0
2,352
Headmaster
77,553,257
1,470,127
Select behavior different between pyspark 2.4.8 and 3.3.2
<p>Recently, one of job failed after we upgraded the cluster from version 2.4.8 to 3.3.2 of Apache Spark.</p> <p>Below is an example to reproduce the issue.</p> <p>Here I am creating two datasets with 3 columns each. Two columns are common between them colA and colB.</p> <pre><code>from pyspark.sql.dataframe import Dat...
<python><apache-spark><pyspark>
2023-11-26 19:53:57
0
4,059
Behroz Sikander
77,553,231
10,082,534
Plotting a cube on top of a plane, given all the vertices of the cube
<p>I am tring to plot a cube on top of a plane using matplotib.</p> <p>I am doing a project on UAV(An unmanned aerial vehicle) Landing and there are these tests i have to visualize. I have a landing plane already plotted as shown below.</p> <pre><code>import numpy as np import matplotlib.pyplot as plt from mpl_toolkits...
<python><numpy><matplotlib><jupyter-notebook><numpy-ndarray>
2023-11-26 19:48:45
2
325
Wanja Wilson
77,552,951
15,494,335
How to call functions (in both directions) across processes in Python using MultiProcessing?
<p>I have two separate python processes, one is not spawned by the other. The server listens on localhost:50000 as such:</p> <pre><code>from multiprocessing.managers import BaseManager def my_func(arg=None): print(arg) class FuncManager(BaseManager): pass FuncManager.register('get_func', callable=lambda:my_func) m =...
<python><multiprocessing><python-multiprocessing><ipc>
2023-11-26 18:28:43
0
707
mo FEAR
77,552,941
10,227,815
cuDF not working on 'apply' function for string return type
<p>I'm getting below error while calling the apply function on cuDF. <em>AttributeError: 'CPUDispatcher' object has no attribute '<strong>closure</strong>'</em></p> <pre><code>File /opt/conda/lib/python3.10/site-packages/cudf/utils/cudautils.py:78, in make_cache_key(udf, sig) 76 names = udf.__code__.co_names ---&g...
<python><pandas><dataframe><dask-dataframe><cudf>
2023-11-26 18:23:48
1
303
SHM
77,552,916
7,422,128
ModuleNotFoundError: No module named pydantic_core._pydantic_core
<p>I am using venv virtual environment in python.The pydantic core module version 2.10.1 is present but stIll I am getting a weird error mentioned below.</p> <pre><code>ModuleNotFoundError: No module named 'pydantic_core._pydantic_core' </code></pre> <p>The strange part is it goes aways when I uninstall the pydantic co...
<python><fastapi><pydantic>
2023-11-26 18:15:42
0
932
user7422128
77,552,883
1,326,330
How to compute truncated backpropagation through time (BPTT) for RNN cell in PyTorch
<p>For simplicity I have a sequence of N input data like words and i have an RNN cell. I want to compute trunkated backpropagation thorugh time (BPTT) over sliding window of K words within the loop:</p> <pre><code>optimizer.zero_grad() h = torch.zeros(hidden_size) for i in range(N): out, h = rnn_cell.forward(data[i...
<python><pytorch><backpropagation><back-propagation-through-time>
2023-11-26 18:06:18
1
991
Ziemo
77,552,861
1,341,773
Multiple large requests using aiohttp
<p>I need to send a large number (approximately 50) of HTTP POST requests, each with a size of around 5 MB. I use the asyncio.gather function to wait for the responses from these requests. However, the <a href="https://github.com/aio-libs/aiohttp/blob/master/aiohttp/client.py#L383" rel="nofollow noreferrer">JSON serial...
<python><asynchronous><async-await><python-asyncio><aiohttp>
2023-11-26 18:00:54
2
1,139
Bala
77,552,436
10,101,636
Replace placeholder in string stored in a variable
<p>I have a variable <code>mystr</code>, that will contain strings like</p> <pre><code>name = 'John' mystr = 'src/edu/{name}/obj.txt' </code></pre> <p>I have to replace <code>{name}</code> in <code>mystr</code> with the actual value which is stored in another variable, i./e. <code>name</code>.</p> <p>However, the catch...
<python>
2023-11-26 16:06:10
3
403
Matthew
77,552,428
14,529,779
Python function to find the highest frequency number
<p>I'm working on a Python function that is supposed to return the number with the highest frequency in an array. In cases where two numbers or more have the same frequency, it should return the larger number.</p> <p>However, I'm facing an issue with my current implementation.</p> <pre class="lang-py prettyprint-overr...
<python><list><dictionary><for-loop>
2023-11-26 16:04:12
8
9,636
TAHER El Mehdi
77,552,393
2,733,436
Using clear() vs copy() in a hashset
<p>I was <a href="https://www.lintcode.com/problem/663/" rel="nofollow noreferrer">solving this problem</a> on lintcode</p> <p>I came up with the following solution first and i failed some test cases</p> <pre><code>from typing import List class Solution: def wallsAndGates(self, rooms: List[List[int]]) -&gt; None: ...
<python><algorithm><data-structures><depth-first-search><hashset>
2023-11-26 15:52:18
1
1,658
user1010101
77,552,328
6,610,407
How to type-hint a variable whose type is any subclass of a generic base class?
<p>I have two abstract base classes that are linked, and should be subclassed together. For the sake of a minimal example, let's say its some class <code>TobeProcessed</code>, and a another class <code>Processor</code> that performs some processing on instances of the <code>TobeProcessed</code> class. I made the <code>...
<python><generics><mypy><python-typing><abstract-base-class>
2023-11-26 15:33:52
1
475
MaartenB
77,552,270
1,492,613
how can I group rows by col1 but sort the the rows by col2?
<p>for example:</p> <pre><code>df = pd.DataFrame({'col1': ['A', 'B', 'A', 'B', 'C'], 'col2': [3, 1, 2, 4, 3], 'col3': [10, 20, 30, 40, 50]}) </code></pre> <p>I want it like follow:</p> <pre><code> col1 col2 col3 1 B 1 20 3 B 4 40 0 A 3 10 2 A 2 30 4 C...
<python><pandas>
2023-11-26 15:20:08
1
8,402
Wang
77,552,198
8,030,746
XPath - how to select div that has a specific class, but only if it has a child div with a specific class inside iframe?
<p>I'm scraping <a href="https://bbrauncareers-bbraun.icims.com/jobs/search?ss=1&amp;searchRelation=keyword_all" rel="nofollow noreferrer">this page</a> with Python and Selenium. Specifically, I'm trying to scrape all the job search results (divs with job information), and as you can see, they're in a div element with ...
<python><selenium-webdriver><xpath>
2023-11-26 14:59:47
1
851
hemoglobin
77,552,178
16,674,436
NLP preprocessing text in Data Frame, what is the correct order?
<p>I’m trying to preprocess a data frame with two columns. Each cell contains a string, called &quot;title&quot; and &quot;body&quot;.</p> <p>Based on this <a href="https://towardsdatascience.com/elegant-text-pre-processing-with-nltk-in-sklearn-pipeline-d6fe18b91eb8?gi=163784b49fe7" rel="nofollow noreferrer">article</a...
<python><pandas><nlp><nltk><data-preprocessing>
2023-11-26 14:53:29
1
341
Louis
77,552,176
217,844
aiohttp: ValueError: Newline or carriage return character detected in HTTP status message or header. This is a potential security issue
<p>I am using <a href="https://pypi.org/project/gql" rel="nofollow noreferrer"><code>gql</code></a> to run a query against a GraphQL API. I get this error:</p> <pre><code> File &quot;&lt;path to poetry venv&gt;/lib/python3.10/site-packages/aiohttp/http_writer.py&quot;, line 129, in write_headers buf = _serialize_h...
<python><graphql><aiohttp>
2023-11-26 14:53:13
1
9,959
ssc
77,551,865
4,557,607
How to extend Keras GPT2 model (MoE example)
<p>I was playing around with <code>Keras GPT2</code> model - in an attempt to make a Mixture of Experts and achieve agi.</p> <p>Link to Keras docs: <a href="https://keras.io/api/keras_nlp/models/gpt2/" rel="nofollow noreferrer">https://keras.io/api/keras_nlp/models/gpt2/</a></p> <p><strong>Final Edit</strong></p> <p>Go...
<python><tensorflow><keras><large-language-model><gpt-2>
2023-11-26 13:24:56
0
1,020
Edv Beq
77,551,852
3,099,733
How to use poetry to exclude some dependencies when install via `mypackage[core]`?
<p>I want to release a python package to pypi, named it <code>mypackage</code> as an example. This package has a lot of dependencies. But for some users that just use parts of the API they can skip some niche and large packages which may take a lot of time to build and install.</p> <p>I learn that there is a feature na...
<python><python-packaging><python-poetry>
2023-11-26 13:21:56
0
1,959
link89
77,551,816
13,118,338
How to properly close gather tasks if some of them take too long
<p>I have code that looks like</p> <pre><code>async def watch_task1(): while not stop: await client.ws.get_data() async def watch_task2(): while not stop: await client.ws.get_news() async def stop_after(): global stop await client.sleep(60) stop = True async def main(): tasks ...
<python><python-asyncio>
2023-11-26 13:13:15
1
481
Nicolas Rey
77,551,788
9,038,562
`torch_geometric.nn.attention` not found in PyTorch Geometric Reference
<p>I was following an tutorial in the PyG repository, <a href="https://github.com/pyg-team/pytorch_geometric/blob/master/examples/graph_gps.py" rel="nofollow noreferrer">GraphGPS</a>.</p> <p>In the example there is a line:</p> <pre><code>from torch_geometric.nn.attention import PerformerAttention </code></pre> <p>Which...
<python><pytorch-geometric>
2023-11-26 13:07:26
1
639
Tianjian Qin
77,551,587
6,357,916
Unable to fetch list from angular website using beautiful soup
<p>I am trying to parse nptel website (<a href="https://nptel.ac.in/courses" rel="nofollow noreferrer">url</a>) to fetch all courses listed on it.</p> <p><a href="https://i.sstatic.net/fHeuq.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/fHeuq.png" alt="enter image description here" /></a> Each course c...
<python><selenium-webdriver><web-scraping><beautifulsoup>
2023-11-26 12:06:31
2
3,029
MsA
77,551,514
462,794
Simple way to create matrix of random numbers of x,y size where the sum of each col and rows is equal to z
<p>hi i would like for the game of quantum werewolf to generate a matrix of x,y size where the sum is equal to Z</p> <p>and x = y</p> <p>Here is what i would like to obtain :</p> <p>example : x=3 , y=3 z=1</p> <pre><code>[0.1,0.2,0.7] = 1 [0.5,0.3,0.2] = 1 [0.4,0.5,0.1] = 1 1 1 1 </code></pre> <p>here is what i t...
<python>
2023-11-26 11:44:31
1
1,244
Bussiere
77,551,174
532,819
ctypes function definition with paramflags and output parameters - how to retrieve the original return value of the function?
<p>The python <a href="https://docs.python.org/3/library/ctypes.html" rel="nofollow noreferrer">documentation</a> for ctypes show an example of using the prototype definition and paramflags with the windows function GetWindowRect.</p> <p>Since GetWindowRect has signature</p> <pre><code>BOOL GetWindowRect( [in] HWND ...
<python><windows><ctypes>
2023-11-26 09:48:56
4
687
pygri
77,551,120
832,490
How to use PublisherServiceAsyncClient
<p>I am trying to use AsyncPublisherClient from pubsublite</p> <pre><code>pip install google-cloud-pubsublite==1.8.3 </code></pre> <pre><code>from google.cloud import pubsublite_v1 pubsub = pubsublite_v1.AsyncPublisherClient() </code></pre> <blockquote> <p>error: Module has no attribute &quot;AsyncPublisherClient&quot...
<python><google-cloud-platform><google-cloud-pubsub>
2023-11-26 09:31:31
0
1,009
Rodrigo
77,550,969
3,861,775
Weighted sum of pytrees in JAX
<p>I have a pytree represented by a list of lists holding parameter tuples. The sub-lists all have the same structure (see example).</p> <p>Now I would like to create a weighted sum so that the resulting pytree has the same structure as one of the sub-lists. The weights for each sub-list are stored in a separate array ...
<python><jax>
2023-11-26 08:30:44
1
3,656
Gilfoyle
77,550,858
12,395,277
Python:interp2d get the same and wrong value
<p>I have a 3*3 table so my expected is to use <code>interp2d</code> interpolating then predict a bigger table maybe 5*5 or 10*10 to get more results then show in <code>plot_surface</code></p> <ol> <li>This is a simple 3*3 table for test and relationship:</li> </ol> <pre><code>x = np.array([1, 2,3]) ...
<python><numpy><matplotlib><scipy><interpolation>
2023-11-26 07:42:48
1
491
M_Sea
77,550,486
7,077,532
Convert Time in hh:mm:ss Format to Total Minutes in pandas
<p>I have the following sample input table below. The <code>Time</code> column is in the format of <code>hh:mm:ss</code> or hours, minutes, and seconds.</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>Name</th> <th>Time</th> </tr> </thead> <tbody> <tr> <td>Jim</td> <td>1:33:04</td> </tr> <...
<python><pandas><time><type-conversion><calculated-columns>
2023-11-26 04:47:57
2
5,244
PineNuts0
77,550,426
9,404,261
What is the fastest way to map numpy array of unsigned integer {0,1} to float {1,-1}
<p>I have a numpy array of <code>np.uint64</code> holding only <code>0</code> or <code>1</code> values, and I have to map <code>0</code> to <code>np.float64(1.0)</code>, and <code>1</code> to <code>np.float64(-1.0)</code>.</p> <p>Since the interpreter doesn't knows that it has only to convert <code>0</code> and <code>1...
<python><numpy><casting>
2023-11-26 04:18:11
1
609
tutizeri
77,550,421
308,827
Use different colors for different parts of a line in seaborn lineplot
<p>Related to the accepted answer of this question: <a href="https://stackoverflow.com/questions/77471818/exclude-subplots-without-any-data-and-left-align-the-rest-in-relplot">Exclude subplots without any data and left-align the rest in relplot</a></p> <p>Is there a way to use the seaborn lineplot such that values in c...
<python><pandas><seaborn>
2023-11-26 04:17:02
1
22,341
user308827
77,550,265
313,768
Redundant prototype parameter specification in ctypes
<p>The <a href="https://docs.python.org/3/library/ctypes.html#ctypes-function-prototypes" rel="nofollow noreferrer">ctypes function <code>prototype</code> specification</a> says</p> <blockquote> <p>The first item is an integer containing a combination of direction flags for the parameter: [...]</p> <p>4: Input paramete...
<python><ctypes>
2023-11-26 02:44:26
1
16,660
Reinderien
77,550,257
5,837,992
Loading File into DuckDB using Python Fails Die to "/N" Values Used to Represent Nulls
<p>I'm trying to load a csv into Python, but the file keeps failing because one of the fields has a '\N' to represent null values in a field that is Integer. I can't figure out how to deal with this - I'd like to convert it on the way in.</p> <p>It would be great if I could ignore error and insert the rest of the reco...
<python><csv><data-transform><duckdb>
2023-11-26 02:37:36
1
1,980
Stumbling Through Data Science
77,550,203
13,148,680
I am getting this error with asdf when running 'python' in my terminal on mac
<p>I go to my terminal on my mac and run the 'python' command but receive the error:</p> <pre><code>/Users/mattlaszcz/.asdf/shims/python: line 3: /opt/homebrew/Cellar/asdf/0.11.0/libexec/bin/asdf: No such file or directory /Users/mattlaszcz/.asdf/shims/python: line 3: exec: /opt/homebrew/Cellar/asdf/0.11.0/libexec/bi...
<python><macos><homebrew><asdf>
2023-11-26 02:06:54
1
419
Matt Laszcz
77,550,161
3,156,300
QGraphicsItem only visible when parent selected
<p>I'm trying to mimick path editing similar to what you would see in photoshop, which interacts this way...</p> <ol> <li>You select the Path and it's Points become visible</li> <li>Users can click and drag any Point item of the Path, to adjust the Path</li> <li>When users click and drag the Path directly it moves the ...
<python><pyside2><qgraphicsitem>
2023-11-26 01:42:48
2
6,178
JokerMartini
77,550,133
7,077,532
Python Dataframe: If Value in Column Equals String AND Value in Second Column is Null, Replace the Null Cell With Another String
<p>I have the following sample python dataframe below:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>Type</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>A</td> <td>sesame</td> </tr> <tr> <td>B</td> <td></td> </tr> <tr> <td>A</td> <td></td> </tr> <tr> <td>C</td> <td>tea</td> </tr> <tr...
<python><filter><replace><conditional-statements><null>
2023-11-26 01:25:51
1
5,244
PineNuts0
77,549,958
12,158,757
How to use a dropdown widget to highlight selected categorical variable in stacked bar chart?
<p>I am learning <code>matplotlib</code> and <code>ipywidgets</code> and attempt to design an interactive bar chart, such that the selected category can be highlighted.</p> <h1>Data Example</h1> <p>Assuming I have a dataframe:</p> <pre><code>import pandas as pd import matplotlib.pyplot as plot data = {&quot;Production...
<python><pandas><matplotlib><ipywidgets><matplotlib-widget>
2023-11-25 23:44:51
1
105,741
ThomasIsCoding
77,549,857
9,148,880
Iterate over a list of lists, assert multiple conditions and render when true in Jinja2
<p>I have the following variables to use in my Jinja template:</p> <pre class="lang-py prettyprint-override"><code>list_python_version = [3, 9] all_python_version = [ [3, 8], [3, 9], [3, 10], [3, 11], [3, 12] ] </code></pre> <p>Is there a way to use a combination of Jinja filters and tests so it iterates over...
<python><jinja2>
2023-11-25 22:57:01
2
647
manoelpqueiroz
77,549,759
6,502,500
ValueError: y contains previously unseen labels when LabelEncoding MultiIndex dataframe
<p>So currently I have an 18 x 80 pandas Dataframe which are grouped under two labels &quot;TEAM ONE&quot; and &quot;TEAM TWO&quot;. All the categorical columns are in an array. Because the data is not numerical (they contain strings), I'd need to encode them using the LabelEncoder.</p> <pre><code>categoricals = ['TRAI...
<python><pandas>
2023-11-25 22:17:04
1
1,902
Mangohero1
77,549,564
4,581,085
from sklearn.metrics can't import PredictionErrorDisplay
<p>I have scikit-learn 1.3.2 installed, and I try to import PredictionErrorDisplay, but get an error that I'm not able to resolve:</p> <pre><code>from sklearn.metrics import PredictionErrorDisplay </code></pre> <pre><code>ImportError: cannot import name 'PredictionErrorDisplay' from 'sklearn.metrics' </code></pre> <p>O...
<python><scikit-learn>
2023-11-25 20:51:44
1
985
Alex F
77,549,521
898,160
Running sphinx-build leads to AttributeError: 'Values' object has no attribute 'link_base'
<p>I have a Django 4.2 project and wish to run Sphinx to generate the docs. When I run</p> <pre><code>sphinx-build -b html docs_source/ docs/ </code></pre> <p>I got the following error:</p> <blockquote> <p>Exception occurred:</p> <p>File &quot;C:\ProgramData\Anaconda3\envs\django_3_8\Lib\site-packages\django\contrib\ad...
<python><django><python-sphinx>
2023-11-25 20:38:01
1
801
pittnerf
77,549,397
9,975,452
"Full rank" error when estimating OLS with statsmodel
<p>I have historical data for crop yield, annual temperature and annual precipitation for a given region. My goal is to estimate the following linear model: <a href="https://i.sstatic.net/L3hbo.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/L3hbo.png" alt="enter image description here" /></a></p> <p>In ...
<python><statistics><regression><linear-regression><modeling>
2023-11-25 19:53:44
1
470
Oalvinegro
77,549,390
1,519,417
pytest does not see the webdriver from the different file
<p>I have a simple code setup_test.py that perfectly works in the common package</p> <pre><code>from selenium import webdriver driver = None def setup_function(): print(&quot;Setup&quot;) global driver options = webdriver.ChromeOptions() options.add_experimental_option('excludeSwitches', ['enable-loggi...
<python><selenium-webdriver><pytest>
2023-11-25 19:52:37
0
668
Vladimir
77,549,259
19,512,611
Cython Error with installation of psychopy package on Mac Silicon
<p>I am attempting to use the <code>psychopy</code> package (version 2023.2.3), and it appears to install some <code>psychtoolbox</code> files alongside itself. On running <code>import psychtoolbox as ptb</code> with Mac Silicon, I get:</p> <pre><code>ImportError Traceback (most recent cal...
<python><pip><cython><apple-silicon><cythonize>
2023-11-25 19:09:18
0
3,007
dcsuka
77,549,170
2,173,773
PyQt: How to position QToolTip over widget?
<p>When I click &quot;Button1&quot; (see screenshot below) the tooltip appears over &quot;Button2&quot; and not over &quot;Button1&quot; as I wanted:</p> <p><a href="https://i.sstatic.net/MwOr1.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/MwOr1.png" alt="enter image description here" /></a></p> <hr />...
<python><pyqt>
2023-11-25 18:43:59
0
40,918
Håkon Hægland
77,549,151
9,315,690
How do I ensure that a dependency only gets installed on Windows with Poetry?
<p>I'm developing a Python application using Poetry as project management tool, and I have a dependency which I only want to install on Windows. <a href="https://peps.python.org/pep-0425/" rel="nofollow noreferrer">PEP 425</a> says the following on the matter:</p> <blockquote> <p>The platform tag is simply distutils.ut...
<python><windows><python-poetry><package-management>
2023-11-25 18:37:12
1
3,887
Newbyte
77,549,111
13,135,901
numpy replace repeating values with 0
<p>I have two arrays that loooks like this:</p> <pre><code>arr1 = [0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 0 0 1 1 1 1 1 1 1 0 1 0 1 0 0 1 1 0 0 0 0 0 1 1 0 1 0 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 1 0 0 0 1 1 1 1 1 0 0 1 1 1 1 0 0 0 1 0 1 1 0 1 1 0 0 0 0 0 1 1 1 1 0 1 0] arr2 = [0 0 0 0 1 1 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 ...
<python><pandas><numpy>
2023-11-25 18:29:16
4
491
Viktor
77,549,014
3,842,845
How to convert Unix (LF format) to Windows (CR-LF) using Python
<p>I am trying to convert bottom text (Unix (LF format)) - let's say &quot;Unix.csv&quot;:</p> <pre><code>Admissions &quot;Not Started: 1&quot;,&quot;Sent: 0&quot;,&quot;Completed: 0&quot; ,,,, Division,Community,&quot;Resident Name&quot;,Date,&quot;Document Status&quot;,&quot;Last Update&quot; ,&quot;Test&quot;,&quot;...
<python><python-3.x>
2023-11-25 18:03:48
1
1,324
Java
77,548,853
5,821,028
FFT for non power-of-2 input length
<p>I am writing a Fast Fourier Transform (FFT) in Python and facing problems with input data lengths that are not powers of 2. I came across recommendations to pad such inputs with zeros to reach the nearest power of 2, but I found the results are much different compared to standard implementations (numpy)</p> <p>Here'...
<python><numpy><fft>
2023-11-25 17:20:48
0
1,125
Jihyun
77,548,778
200,783
How can I efficiently generate all N-bit values with M set bits, and the corresponding bit-reversed values?
<p>I'm using the following Python code to generate all values with <code>popcount</code> set bits among <code>bits</code> total bits:</p> <pre><code>def trailing_zeros(v): return (v &amp; -v).bit_length() - 1 def bit_permutations(popcount, bits): if popcount &lt; 0 or popcount &gt; bits: pass elif ...
<python><algorithm><binary><bit-manipulation>
2023-11-25 17:03:07
3
14,493
user200783
77,548,723
2,636,579
FFmpeg to rotate video if necessary, and overlay png
<p>I am trying to write a script that can accept videos of arbitrary orientation, use FFmpeg to detect the orientation, then overlay a logo in the correct way in the bottom right corner of the screen.</p> <p>This script is working for landscape mode:</p> <pre><code>import subprocess from moviepy.editor import VideoFile...
<python><ffmpeg><moviepy>
2023-11-25 16:47:39
2
1,034
reallymemorable
77,548,718
1,012,010
Passing dictionary permutations to a function as inputs
<p>I have a function like the following:</p> <pre><code>def function_name(a, b, c): # Do some stuff with a, b, and c print(result) </code></pre> <p>I've generated several dictionaries like these:</p> <pre><code>dict1 = {25: 1015, 36: 1089, 41: 1138} dict2 = {12: 2031, 25: 2403, 31: 2802} dict3 = {12: 3492, 28: ...
<python><permutation>
2023-11-25 16:46:26
2
730
Alligator
77,548,545
1,186,417
Adding subttiles to Plotly Dash video player in Python
<p>I am trying to add subtitles to my Plotly Dash video player, i.e. VTT captions overlay, in Python. I cannot find any examples or instruction on this.</p> <pre><code>from dash import Dash, dcc, html, Input, Output, State import dash_player </code></pre> <p>And in a html Div somewhere:</p> <pre><code>dash_player.DashP...
<python><plotly-dash><video-player>
2023-11-25 15:56:00
1
851
Jace999
77,548,448
3,130,747
How to Dynamically Generate (raw) SQL Queries with Multiple Parameters Using Jinja2 and SQLAlchemy in Python
<p>I'm using jinja2 and SQLAlchemy to dynamically generate queries in python, specifically with a postgres db. I'm trying to workout how to render the raw SQL that will be executed by the database.</p> <p>I'd like to be able to do this for jinja templates generally - so using a regex replace on <code>:age</code> or wha...
<python><sqlalchemy><jinja2>
2023-11-25 15:28:37
0
4,944
baxx
77,548,440
703,462
TatSu: square brackets are being ignored in the grammar
<p><a href="https://github.com/neogeny/TatSu" rel="nofollow noreferrer">TatSu</a> tends to ignore the square bracket characters, be it <code>[</code>, <code>]</code>, and the mix of two at times and recognize them at different times for some reason, which I will show in an example below I'm experimenting with in TatSu ...
<python><parsing><tatsu>
2023-11-25 15:25:50
2
446
ISE
77,548,225
3,861,775
Reduce list of lists in JAX
<p>I have a list holding many lists of the same structure (Usually, there are much more than two sub-lists inside the list, the example shows two lists for the sake of simplicity). I would like to create the sum or product over all sub-lists so that the resulting list has the same structure as one of the sub-lists. So ...
<python><jax>
2023-11-25 14:24:36
1
3,656
Gilfoyle
77,548,143
5,082,187
Type annotations in pypy give an error but work in python3
<p>Please compare the following two programs:</p> <pre><code>#!/usr/bin/env pypy i: float = 5.0 </code></pre> <p>and this:</p> <pre><code>#!/usr/bin/env python3 i: float = 5.0 </code></pre> <p>The first one fails:</p> <pre class="lang-none prettyprint-override"><code> File &quot;./pypy_test.py&quot;, line 3 i: f...
<python><ubuntu><python-typing><pypy>
2023-11-25 14:00:22
1
428
TradingDerivatives.eu
77,548,098
22,466,650
How to aggregate unique combinations and reorder them in a specifiy way?
<p>I have this dataframe :</p> <pre><code>df = pd.DataFrame({'CLASS': ['A', 'B', 'A'], 'MEMBERS': ['foo &amp; bar', 'bar &amp; luz', 'baz']}) print(df) # CLASS MEMBERS # 0 A foo &amp; bar # 1 B bar &amp; luz # 2 A baz </code></pre> <p>First, I want to group on the column <code>CLASS</code> a...
<python><pandas><group-by>
2023-11-25 13:47:55
2
1,085
VERBOSE
77,547,941
14,790,056
Complex iterations using multiple conditions (fee ditribution if certain conditions are met)
<p>I have two large dataframes. million x 100K.</p> <p>I have dataframe named <code>test_swaps</code>. This dataframe shows all trades, and fees accrued from each trade within <code>POOL_ADDRESS</code>.</p> <pre><code> BLOCK_TIMESTAMP LIQUIDITY POOL_ADDRESS PRICE_0_1 FEES 0 2021-12-02 03:42:...
<python><pandas><dataframe>
2023-11-25 12:54:05
0
654
Olive
77,547,512
16,220,410
how to use two text display options in a banner using flet in python?
<p>i am trying to create an app that merges one or more pdf files in python using flet, my code below shows an empty banner display text when i run the code, i tested the two if statement inside the merge_pdfs function but it always display an empty <code>status_banner</code></p> <pre><code>status_banner = '' def mai...
<python><flet>
2023-11-25 10:34:24
1
1,277
k1dr0ck
77,547,215
2,101,808
How to get fastapi type conversion str->bool?
<p>I have external service. It call my api with get parameters</p> <pre><code>class Misc(BaseModel): # - whether to pop-up checkbox (&quot;true&quot; or &quot;false&quot;) popup: Optional[str] = None # - whether an advertisement is pending to be displayed (&quot;yes&quot; or &quot;no&quot;) advertPendin...
<python><fastapi><python-typing><pydantic>
2023-11-25 08:53:20
2
3,614
eri
77,547,205
3,834,483
Not able to get precise float values from fragment shader output
<p>I am using OpenGL on desktop (using PyOpenGL) for some image processing operation and doing some floating point operations per pixel in fragment shader.After that when I read the pixels using <code>glReadPixels</code> buffers are not as expected.</p> <p>Pasted below is the portion of the relevant code:</p> <pre><cod...
<python><opengl><floating-point><fragment-shader><pyopengl>
2023-11-25 08:48:18
1
472
bsguru
77,547,154
5,594,439
Python Code to Check Multiple Files on Gitlab repository by group ID
<p>I want to check multiple files in the repository, and whether the files exist or not in the Python script below.</p> <p>The case is, that the file in the repository exists but the results say the file is not found.</p> <pre><code>import requests from urllib.parse import quote_plus import json import os # Set your G...
<python><gitlab><repository>
2023-11-25 08:26:19
1
4,539
Yuday
77,547,060
13,000,229
Fail to start Flask + Connexion + Swagger
<h3>Problem</h3> <p>I initiated a Flask app (+ Connexion and Swagger UI) and tried to open <a href="http://127.0.0.1:5000/api/ui" rel="nofollow noreferrer">http://127.0.0.1:5000/api/ui</a>. The browser showed <code>starlette.exceptions.HTTPException: 404: The requested URL was not found on the server. If you entered th...
<python><flask><swagger><werkzeug><connexion>
2023-11-25 07:51:34
1
1,883
dmjy
77,547,004
10,216,028
How to reduce the space between the x-ticks in matplotlib?
<p>I already checked <a href="https://stackoverflow.com/questions/44863375/how-to-change-spacing-between-ticks">this</a> but the answers did not help.</p> <p>I have the following code that generates 4 plots:</p> <pre><code>import matplotlib.pyplot as plt import numpy as np group_x = [5, 0, 1, 16, 3, 1, 2, 0, 8, 2, 11,...
<python><matplotlib>
2023-11-25 07:29:18
2
455
Coder
77,546,937
8,248,194
Rolling function from pandas to polars
<p>I have this function in pandas:</p> <pre class="lang-py prettyprint-override"><code>def rolling_pd( dataf: pd.DataFrame, groupby_cols: Union[str, list], column: str, function: str = &quot;mean&quot;, rolling_periods: int = 1, shift_periods: int = 1, *args, **kwargs, ) -&gt; pd.Series:...
<python><pandas><python-polars>
2023-11-25 06:59:15
1
2,581
David Masip
77,546,864
13,000,229
(Connexion 3.0.2) ModuleNotFoundError: Please install connexion using the 'flask' extra
<h3>Problem</h3> <p>I use connextion with Flask. Today I upgraded connexion from 2.14.2 to 3.0.2 and see <code>ModuleNotFoundError: Please install connexion using the 'flask' extra</code>.</p> <p><a href="https://connexion.readthedocs.io/en/latest/quickstart.html" rel="noreferrer">https://connexion.readthedocs.io/en/la...
<python><flask><pip><connexion>
2023-11-25 06:23:38
1
1,883
dmjy
77,546,793
1,084,174
ERROR: No matching distribution found for tensorflow==2.5
<p>I am trying to run the tutorial in <a href="https://colab.research.google.com/github/googlecodelabs/odml-pathways/blob/main/audio_classification/colab/model_maker_audio_colab.ipynb#scrollTo=wbMc4vHjaYdQ" rel="nofollow noreferrer">google colab</a></p> <pre><code>!pip install tflite-model-maker tensorflow==2.5 </code>...
<python><tensorflow><google-colaboratory>
2023-11-25 05:49:44
1
40,671
Sazzad Hissain Khan
77,546,592
1,492,613
how can I merge 2 table with outer join but without duplicate the missing row?
<p>Example, I have 2x A=20 in df2, 1x 20 in df1, 2x A=10 in df1, 1x 10 in df2. In the merge result it will duplicate one A=20 row in df1 and one A=10 row in df2. But I just want it to be NaN. I expect a result like following:</p> <pre><code> A B_x C_x B_y C_y 0 10 0 2 4.0 7.0 1 10 4 7 NaN NaN 2 20 ...
<python><pandas><dataframe>
2023-11-25 03:53:30
0
8,402
Wang
77,546,452
22,932,995
Kivy, Python: Layout with nested rules produces no output of child widgets
<p>I have a simple App, that is supposed to use a ScreenManager for different screens. When I create one of my Screens and make it the app.root widget everything works fine. But as soon, as I put my Screen as a child inside the ScreenManager, it produces no output as if the widgets were not there at all.</p> <p>testScr...
<python><kivy><kivy-language>
2023-11-25 02:32:08
1
303
Wamseln
77,546,285
11,672,868
pygame mask overlapping shapes of different color?
<p>how is it possible to create masks of different color shapes on a surface and check for overlap collision?</p> <p>suppose I have a green circle and a red polygon on a surface. I want to know when they end up colliding while moving.</p> <p>I tried something like this:</p> <pre class="lang-py prettyprint-override"><co...
<python><pygame><collision>
2023-11-25 00:52:54
1
308
K-FLOW
77,546,065
1,492,613
how to let logical and operator (&) treat the NaN value depends on the other side's value?
<p>in pandas or numpy's I want something like following: True &amp; NaN == True, False &amp; False == Fase, NaN &amp; NaN == NaN</p> <p>What is the most efficient way to do this? so far I have to do it as:</p> <pre><code>(a.fillna(True) &amp; b.fillna(True)).where(~(a.isna() &amp; b.isna()), None) </code></pre> <p>exam...
<python><pandas><numpy>
2023-11-24 23:24:48
1
8,402
Wang
77,545,935
136,598
GAE: Submit task from one service to be executed by another service
<p>I have a GAE app with a Python3 service (the default) and a NodeJS18 service.</p> <p>I currently submit App Engine tasks (not HTTP target tasks) from the Python3 service and those tasks are executed by that same Python3 service. I have a <code>default</code> task queue where those tasks are submitted.</p> <p>Now, I...
<python><node.js><google-cloud-platform><google-app-engine>
2023-11-24 22:38:09
2
16,643
minou
77,545,900
14,818,993
Hyperlink in colab markdown that opens within colab editor?
<p>There is a file in my Google Drive <code>/content/gdrive/MyDrive/Models.yaml</code>. When I write this file path in markdown in colab cell, it's clickable, and will open the file within the colab editor, and I can make and save changes in real-time. Like this:</p> <p><a href="https://i.sstatic.net/vKLrd.png" rel="no...
<python><markdown><google-colaboratory>
2023-11-24 22:23:57
0
308
Huzaifa Arshad
77,545,826
1,525,423
Cast Array of Bytes to UInt8Array
<p>I have a pyarrow <a href="https://arrow.apache.org/docs/python/generated/pyarrow.BinaryArray.html" rel="nofollow noreferrer">BinaryArray</a> with exactly one byte at each location. These bytes are not UTF8, but &quot;actual&quot; binary data.</p> <p>I'd like to cast this into a <a href="https://arrow.apache.org/docs...
<python><pyarrow>
2023-11-24 22:00:05
1
3,991
Finwood
77,545,743
1,543,042
Python classes in multiple files - do all methods need to be imported into class definition?
<p>I've started splitting a class among into several files/folders and have found that there are functions that are only needed to organize code and would never be called by anything higher-up in the class hierarchy (much less by the user). Is there someway I can import these into just the functions they're needed in r...
<python><class><organization>
2023-11-24 21:31:27
0
3,432
user1543042
77,545,643
4,348,400
Why am I getting duplicate node labels from Ciw?
<p>Here is a working example:</p> <pre class="lang-py prettyprint-override"><code>import ciw import matplotlib.pyplot as plt import pandas as pd max_time = 20 # Routing Matrix R = [[0]*7 for i in range(7)] R[0][1] = 1 R[1][0] = 1/3 R[1][2] = 1/3 R[1][3] = 1/3 R[2][1] = 1 R[3][1] = 1/2 R[3][5] = 1/2 R[5][3] = 1/3 R[5]...
<python><pandas>
2023-11-24 21:01:17
1
1,394
Galen
77,545,524
5,530,152
How to set the file path of a remote jupyter notebook in VSCode?
<p>Is it possible to set the working directory of a <strong>remote</strong> Jupyter <code>.ipynb</code> notebook? This problem is similar to <a href="https://stackoverflow.com/questions/55491046/how-to-set-the-running-file-path-of-jupyter-in-vscode">How to set the running file path of jupyter in VScode?</a>, but the so...
<python><visual-studio-code><jupyter-notebook><jupyter>
2023-11-24 20:26:10
3
933
Aaron Ciuffo
77,545,381
11,611,246
I cannot import a Python package despite it being on the right path
<p>I wrote a Python package and uploaded it to <a href="https://pypi.org/project/graphab4py/" rel="nofollow noreferrer">PyPI</a> (note: I have been working on Python 3.11.3 and set Python &gt;=3.11 as a requirement to make sure the package is compatible).</p> <p>Subsequently, I installed it via <code>pip</code> by exec...
<python><pip><setuptools><python-module><pypi>
2023-11-24 19:48:51
1
1,215
Manuel Popp
77,545,359
9,415,280
Can't train and sim my tensorflow model with original dataset (tf.data.dataset) but it work after I split it!? Same processing on both?
<p>I build a dataset for trainning 2 heads neural network, first with lstm and the second with simple perceptron.</p> <p>My dataset process in 2 ways to get one version split into train and test set and the second version not split to perform train test and simulation of the complete data at the end.</p> <p>here my cod...
<python><tensorflow><tensorflow2.0><tensorflow-datasets><tf.data.dataset>
2023-11-24 19:41:57
1
451
Jonathan Roy
77,545,352
5,924,264
Dividing multiple columns by another columns giving NaN``
<pre><code>In [24]: df = pd.DataFrame({&quot;a&quot;: [1], &quot;b&quot;: [2], &quot;c&quot;: [3]}) In [25]: df[[&quot;b&quot;, &quot;c&quot;]] / df[&quot;a&quot;] ...
<python><pandas><dataframe>
2023-11-24 19:39:46
2
2,502
roulette01
77,545,270
5,924,264
How to divide column in dataframe by values in a dict according to some key?
<p>I have a dataframe <code>df</code> with the columns <code>delta</code> and <code>integer_id</code>. I have a dict <code>d</code> that maps <code>integer_id</code> to some floating point value. I want to divide each row's <code>delta</code> in <code>df</code> by the corresponding value from <code>d</code> for the <co...
<python><pandas><dataframe>
2023-11-24 19:16:38
4
2,502
roulette01
77,545,240
569,313
Sagemaker Studio Notebook - How to access OS Environ
<p>I am trying to set (at the terminal or in the notebook) an environment variable. I am running the following in the terminal or (with %%bash in the cell) notebook cell:</p> <pre><code>echo &quot;export MY_KEY='BLAH-BLAH123'&quot; &gt;&gt; ~/.zshrc source ~/.zshrc </code></pre> <p>or</p> <pre><code>echo &quot;export ...
<python><bash><amazon-sagemaker>
2023-11-24 19:09:29
1
1,832
B_Miner
77,544,933
4,019,495
Pandas, numpy: return multiple columns in `np.select`?
<p>I have the following DataFrame.</p> <pre><code> A B 0 1.0 4 1 2.0 5 2 NaN 6 </code></pre> <p>I want to turn it into the following dataframe.</p> <pre><code> A B val val_source 0 1.0 4 1.0 A 1 2.0 5 2.0 A 2 NaN 6 6.0 B </code></pre> <p>What's the easiest way to do this? I envision an <co...
<python><pandas><numpy>
2023-11-24 18:01:19
2
835
extremeaxe5
77,544,923
3,370,561
Aggregate column with list of string with intersection of the elements with Polars
<p>I'm trying to aggregate some rows in my dataframe with a <code>list[str]</code> column. For each <code>id</code> I need the intersection of all the lists in the group. Not sure if I'm just overthinking it but I can't provide a solution right now. Any help please?</p> <pre class="lang-py prettyprint-override"><code>d...
<python><dataframe><list><aggregation><python-polars>
2023-11-24 17:59:42
3
374
29antonioac
77,544,843
3,290,799
Iterate through rows in data frame with n rows and n columns and count the frequency of combinations 1:n
<p>Iterate through rows in data frame with <code>n</code> rows and 6 columns and count the frequency of combinations <code>1:n</code> within each row.</p> <p>Non working template code:</p> <pre><code>import pandas as pd import itertools from collections import Counter # create sample data df = pd.DataFrame([ [2, 1...
<python><pandas><collections><combinations><python-itertools>
2023-11-24 17:42:33
2
867
RTrain3k
77,544,756
8,930,149
Django with mypy: How to resolve incompatible types error due to redefined field for custom `User` model class that extends "AbstractUser"?
<p>I have an existing Django project which uses a custom <code>User</code> model class that extends <code>AbstractUser</code>. For various important reasons, we need to redefine the <code>email</code> field as follows:</p> <pre class="lang-py prettyprint-override"><code>class User(AbstractUser): ... email = mod...
<python><django><mypy><django-stubs>
2023-11-24 17:21:50
2
643
sunw
77,544,523
8,037,521
pip: install packages from Python subprojects with pyproject.toml
<p>I am trying to find some best practice for the following situation: I have a Python project which has several Python subprojects. Each subproject contain <code>pyproject.toml</code> specifying the dependencies.</p> <p>Is there some way to automatically link the dependencies of these different <code>pyproject.toml</c...
<python><pyproject.toml>
2023-11-24 16:30:37
1
1,277
Valeria
77,544,500
3,729,397
How can I install a package into a nix shell from source for debugging using flakes, equivalent to python setup.py develop
<p>Is there a way to include a package into a nix shell from source, ie the path linking not to a copy of the code in the nix store but to the actual source code, for debugging purposes?</p> <p>I.e. I'm searching for a nix flake equivalent to running</p> <pre><code>python setup.py develop </code></pre> <p>in a conda en...
<python><nix><nixos>
2023-11-24 16:26:36
0
969
Vera
77,544,487
8,340,222
How do I overwrite a BigQuery table (data and schema) from PySpark?
<p>I am trying to write a PySpark <code>DataFrame</code> to a BigQuery table. The schema for this table may change between job executions (columns may be added or omitted). So, I would like to overwrite this table each execution.</p> <p>An example:</p> <pre><code>df = spark.createDataFrame(data=[(1, &quot;A&quot;)],sch...
<python><pyspark><google-bigquery>
2023-11-24 16:24:09
1
415
Paco
77,544,416
3,534,782
Using a keras generator for streaming training data yields a strange tensor size mismatch error -- tensor flow code is too opaque to debug the issue
<p>I am training a neural network in tensor flow, and because I was running out of memory when training to load my whole training set (input images and &quot;ground truth&quot; images), I am trying to stream data using a generator such that only a few images are loaded at a time. My code takes each image and subdivides...
<python><tensorflow><keras><streaming><generator>
2023-11-24 16:08:04
1
419
ekofman
77,544,407
15,341,457
Scrapy response returns an empty array
<p>I'm crawling this <a href="https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=hp" rel="nofollow noreferrer">page</a> with scrapy and I'm trying to extract all the rows of the main table.</p> <p>The following <em>XPath</em> expression should give me the wanted result:</p> <pre><code>//div[@id='TableWithRules']//tbody/t...
<python><shell><web-scraping><xpath><scrapy>
2023-11-24 16:06:36
2
332
Rodolfo
77,544,292
5,995,696
How properly store and load own embeddings in Redis vector db
<p>Here is a simple code to use Redis and embeddings but It's not clear how can I build and load own embeddings and then pull it from Redis and use in search</p> <pre><code>from langchain.embeddings import OpenAIEmbeddings from langchain.vectorstores.redis import Redis embeddings = OpenAIEmbeddings metadata = [ { ...
<python><openai-api><langchain><large-language-model>
2023-11-24 15:44:25
2
1,711
John Glabb
77,544,226
1,221,661
Add multiple rows to MultiIndex DataFrame at once
<p>Imagine that we have an experiment with multiple subjects and multiple trials per subject, and each trial produces an unknown number of &quot;events&quot; for two measurement methods A and B. Now we want to store that in a DataFrame using MultiIndex:</p> <pre class="lang-py prettyprint-override"><code>tuples = [ ...
<python><pandas><dataframe><multi-index>
2023-11-24 15:30:34
1
1,439
Fritz
77,544,207
6,272,006
Repricing Bonds used for Bootstrapping in QuantLib-Python
<p>I have data containing Bond information and I managed to use this information to bootstrap zero curve. To sense check if my zero curve is correct, I would like to reprice the Bonds using the bootstrapped curve (using the zero curve) to get back to the quoted prices of the Bonds. I am getting the following errors on ...
<python><finance><quantitative-finance><quantlib>
2023-11-24 15:26:54
1
303
ccc
77,544,146
18,904,265
Is there a way to get a warning in Powershell if my virtual environment is not activated?
<p>Is there some kind of tool that warns me if I want to use pip when no virtual environment is activated? The only thing installed in my global python is pipx and I want to keep it that way.</p> <p>I am using PowerShell in the Windows Terminal App, so it would need to be compatible with that.</p>
<python><powershell>
2023-11-24 15:17:00
2
465
Jan
77,544,094
1,188,318
fuzzy matching address data
<p>I have the task of matching two lists of names and addresses - represented in two database tables in PostgreSQL.</p> <p>Address data can be strings like <em>Otto-Johannsen-Straße 7</em> or even <em>Otto-Johannsen-Str. 7 Wohnung oben</em> which have to match to <em>Otto-Johannsen-Str. 7</em>. Names can look be thing...
<python><postgresql>
2023-11-24 15:07:32
2
3,749
sers
77,543,506
2,473,382
Pydantic use alias and initial name of a field interchangeably
<p>If I create a Pydantic model with a field having an alias, I would like to be allowed to use the initial name or the alias interchangeably. This is possible when creating an object (thanks to <code>populate_by_name=True</code>), but not when using the object.</p> <pre class="lang-py prettyprint-override"><code>from ...
<python><pydantic><pydantic-v2>
2023-11-24 13:30:40
1
3,081
Guillaume
77,543,426
7,089,108
Model and parameters in symfit package via loop
<p>I would like to add more and more model equation and thus also parameters via a loop. I tried it, but so far it only led to errors.</p> <pre><code>x, y_1, y_2 = variables('x, y_1, y_2') a = Parameter('a', min=0.0) b = Parameter('b') d = Parameter('d') c_1, c_2 = parameters('c_1, c_2') #a, b, c_1, c_2, d = parameter...
<python><curve-fitting><scipy-optimize><model-fitting><symfit>
2023-11-24 13:14:53
1
433
cerv21
77,543,326
7,658,051
Cannot handle properly csv.writer escapechar and quoting parameters
<p>I am developing a python script which, given:</p> <ul> <li>the path of a csv file</li> <li>a list of names of some of the columns of the csv file</li> <li>a string to-be-replaced (A)</li> <li>a string to-replace-with (B)</li> </ul> <p>should:<br> substitute string A with string B in the cells of the indicated column...
<python><csv><quoting><writer><csvwriter>
2023-11-24 12:57:42
1
4,389
Tms91