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,162,810 | 15,986,016 | Discord Bot Basic Example Fails due to PrivilegedIntentsRequired(exc.shard_id) Error (Python) | <p>I know I'm doing something wrong on my end because I coppied the example code Discord gives us (first code block found on <a href="https://discordpy.readthedocs.io/en/stable/quickstart.html" rel="nofollow noreferrer">discord's quickstart website</a>) But I can't seem to find what's wrong.</p>
<p>The code I'm running... | <python><async-await><discord> | 2024-03-14 18:53:21 | 1 | 438 | Jacob Glik |
78,162,685 | 10,105,454 | Python requests not returning proper data | <p>I am doing a scrapping project and I am having an issue, using python requests I am able to log-in in the website and grab the tokens to be sent afterward, problem comes after. Sending the proper tokens doing a post to gram the info of a table (that should appear with the post), but the post returns not the data but... | <python><python-requests> | 2024-03-14 18:26:18 | 1 | 312 | Flari |
78,162,654 | 14,534,480 | Calculate the influence of various factors on the final change | <p>I have a dataframe with data about price of premises.
Example:</p>
<pre><code>df = pd.DataFrame({'num': [1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7],
'date': ['2024-01-01', '2024-01-01', '2024-01-01', '2024-01-01', '2024-01-01', '2024-01-01', '2024-01-01', '2024-01-02', '2024-01-02', '2024-01-02', ... | <python><pandas><math> | 2024-03-14 18:20:48 | 1 | 377 | Kirill Kondratenko |
78,162,635 | 10,322,652 | Conventional commit type for library version bump | <p>I'm building a library in python and wanted to know which <code>type</code> I should use -following <a href="https://www.conventionalcommits.org/en/v1.0.0/" rel="nofollow noreferrer">Conventional Commits</a> idea- whenever I bump the version of my library in <code>pyproject.toml</code>.</p>
<p>This is the diff summa... | <python><python-poetry><conventional-commits> | 2024-03-14 18:16:38 | 1 | 1,536 | Cheche |
78,162,619 | 2,986,153 | How to prevent html code appearing above pandas tables in quarto gfm reports | <p>When I display a pandas table in a quarto gfm report I see html code above the table when I view the report in github. How can I prevent this?</p>
<p><a href="https://i.sstatic.net/7jFxe.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/7jFxe.png" alt="enter image description here" /></a></p>
<h1>Code f... | <python><pandas><quarto> | 2024-03-14 18:12:39 | 1 | 3,836 | Joe |
78,162,601 | 1,030,287 | matplotlib 3D plot axes aspect ratio | <p>I am plotting some 3D data and the plot always creates a 3D cube. It makes sense but I'd like to extend one axis to be longer (aspect ratio) than the others. This will create a 3D rectangle rather than a 3D cube.</p>
<p>For example, the plot below is fully functional - how can I make the y-axis longer relative to th... | <python><matplotlib> | 2024-03-14 18:09:49 | 1 | 12,343 | s5s |
78,162,484 | 10,710,625 | Merge two data frames based on values of columns | <p>I have these two data frames</p>
<pre><code>data1 = {'ID': [385908, 385909, 757947, 757946],
'A': ['LH', 'LH', 'LH', 'LH'],
'F': [646, 646, 646, 646],
'Orig': ['FRA', 'FRA', 'NQZ', 'NQZ'],
'Dest': ['NQZ', 'NQZ', 'ALA', 'ALA'],
'DayU': [1, 6, 1, 6],
'DepU': [650, ... | <python><pandas><dataframe> | 2024-03-14 17:48:20 | 1 | 739 | the phoenix |
78,162,451 | 13,491,504 | How do you square a Vector in a Python calculation | <p>Lets say you have this code with a Vector and want to square the Vector:</p>
<pre><code>import numpy as np
import sympy as sp
a, b, c, f, g = sp.symbols('a b c f g')
M = np.array([a, b, c])
</code></pre>
<p>Now you have a formula in which you need to square this vector like this:</p>
<pre><code>B = f * M**2 * g
</... | <python><numpy><math><sympy> | 2024-03-14 17:42:46 | 2 | 637 | Mo711 |
78,162,405 | 11,024,270 | How to use Numba CUDA JIT decorator? | <p>I've followed this tutorial to use Numba CUDA JIT decorator: <a href="https://www.youtube.com/watch?v=-lcWV4wkHsk&t=510s" rel="nofollow noreferrer">https://www.youtube.com/watch?v=-lcWV4wkHsk&t=510s</a>.</p>
<p>Here is my Python code:</p>
<pre class="lang-py prettyprint-override"><code>import numpy as np
fro... | <python><gpu><numba> | 2024-03-14 17:33:03 | 1 | 432 | TVG |
78,162,356 | 6,470,174 | How can I apply image registration to images and their annotations with opencv? | <p>I wish to propagate polygon labels from a source image to a target image. The target image is just the source image, but slightly translated. I found <a href="https://www.geeksforgeeks.org/image-registration-using-opencv-python/" rel="nofollow noreferrer">this code snippet</a> that allows me to register a source ima... | <python><opencv><transformation> | 2024-03-14 17:23:53 | 1 | 965 | Gabriele |
78,162,249 | 1,585,017 | Null value set to True, but still it violates not-null constraint | <p>I am trying to set the sidebar_id value as null but I get an IntegrityError error:</p>
<pre><code>IntegrityError at /admin/qa/howquestion/112/change/
null value in column "sidebar_id" violates not-null constraint
DETAIL: Failing row contains (112, <p>prettyprint a JSON file<br></p>, To p... | <python><django><postgresql> | 2024-03-14 17:06:34 | 1 | 8,152 | multigoodverse |
78,162,230 | 11,628,437 | Why do python projects have the following structure? | <p>I am working on creating my own installable python package using <code>setup.py</code>. While going over different repositories, I find the following structure -</p>
<pre class="lang-none prettyprint-override"><code>abc-def
|-abc_def
|-setup.py
</code></pre>
<p>Here, <code>setup.py</code> has the function <code>setu... | <python><python-packaging> | 2024-03-14 17:02:22 | 2 | 1,851 | desert_ranger |
78,162,225 | 3,595,231 | How to extract the html link from a html page in python? | <p>From this python code,</p>
<pre><code>...
resp = logout_session.get(logout_url, headers=headers, verify=False, allow_redirects=False)
soup = BeautifulSoup(resp.content, "html.parser")
print(soup.prettify())
</code></pre>
<p>I was able to make an API call, and the response content is of this:</p>
<pre><code... | <python><beautifulsoup><urlparse> | 2024-03-14 17:01:59 | 2 | 765 | user3595231 |
78,162,180 | 12,040,751 | Generate triangular matrix of cumulative products efficiently | <p>Take a 1D vector, for example <code>[a b c d]</code>.</p>
<p>Then build the following matrix</p>
<pre><code>a 0 0 0
ab b 0 0
abc bc c 0
abcd bcd cd d
</code></pre>
<p>The code I got so far does the job, but it's ugly and has a for loop which should be completely unnecessary.</p>
<pre><code>import numpy... | <python><numpy> | 2024-03-14 16:55:15 | 4 | 1,569 | edd313 |
78,162,074 | 525,865 | iterate over 10 k pages & fetch data, parse: European Volunteering-Services: tiny scraper that collects opportunities from EU-Site | <p>I am looking for a public list of Volunteering - Services in Europe: I don't need full addresses - but the name and the website. I think of data ...
XML, CSV ... with these fields: name, country - and some additional fields would be nice one record per country of presence. <strong>btw:</strong> the european volunte... | <python><pandas><dataframe><web-scraping><beautifulsoup> | 2024-03-14 16:37:12 | 2 | 1,223 | zero |
78,161,984 | 3,623,537 | typing for rare case fallback None value | <p>Trying to avoid typing issues I often run into the same problem.</p>
<p>E.g. I have a function <code>x</code> that very rarily returns value <code>None</code>, all other times it returns <code>int</code>.</p>
<pre class="lang-py prettyprint-override"><code>
def x(i: int) -> Union[int, None]:
if i == 0:
... | <python><python-typing> | 2024-03-14 16:22:12 | 1 | 469 | FamousSnake |
78,161,902 | 1,592,380 | geodataframe is not defined | <p><a href="https://i.sstatic.net/ypPg2.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ypPg2.png" alt="enter image description here" /></a></p>
<p>I'm working with Jupiter and ipywidgets and Ipyleaflet , trying to draw polygons on a map and saving to a geodataframe. I have the following in a notebook ce... | <python><jupyter-notebook><ipywidgets><ipyleaflet> | 2024-03-14 16:09:41 | 2 | 36,885 | user1592380 |
78,161,736 | 9,795,817 | How to update pyspark dataframe inside a Python function | <p>I have a Python function that receives a pyspark dataframe and checks if it has all the columns expected by other functions used in a script. In particular, if the column <code>'weight'</code> is missing, I want to update the dataframe passed by the user by assigning a new column to it.</p>
<p>For example:</p>
<pre ... | <python><apache-spark><pyspark><user-defined-functions> | 2024-03-14 15:45:20 | 1 | 6,421 | Arturo Sbr |
78,161,637 | 867,889 | Is there a way to tell which python thread was the last one making any progress? | <p>Let's say I have a python process that starts 50 threads most of which depend on each other. All of which eventually hang because some leaf thread got blocked. Given these 50 python threads I can examine them with <code>py-spy</code> and see that everything is hanging. Is there a way to tell which thread was the las... | <python><multithreading> | 2024-03-14 15:27:55 | 0 | 10,083 | y.selivonchyk |
78,161,622 | 9,983,652 | Is it possible to use share_xaxis for some specific subplots? | <p>I use make_subplot for 3 rows and 1 columns, the first 2 rows are data plot and the last row is image. Iβs like to use shared_xaxis for the first 2 data plot, how to do it by excluding the last row of image plot? Thanks</p>
<pre><code>fig = make_subplots(rows=3, cols=1,
vertical_spacing=0.05,
... | <python><plotly> | 2024-03-14 15:25:31 | 1 | 4,338 | roudan |
78,161,523 | 16,425,408 | Auto back up using python | <p>I am utilizing the Python code below to take an automated backup of my files.</p>
<pre><code>import shutil
import os
def backup_folder(source_folder, backup_folder):
try:
# Check if the source folder exists
if not os.path.exists(source_folder):
print(f"Error: Source folder '{sour... | <python><automation><scripting><backup> | 2024-03-14 15:09:46 | 0 | 838 | Nani |
78,161,348 | 5,730,859 | Python to mailmerge csv to word in continuous in one document | <p>I want to mailmerge a table in <strong>csv(List.csv) to word(example1.docx) but continuously into multiple pages in one word document</strong>. The function is something like "Next Record" in MS Word. I have a template (Test.docx). I can't find in Python.</p>
<pre><code>from __future__ import print_functio... | <python><mailmerge><docx-mailmerge> | 2024-03-14 14:42:02 | 1 | 934 | bkcollection |
78,161,222 | 7,134,737 | pyspark - What is the difference between these two full outer joins? | <p>Full Example <a href="https://pastebin.com/b79s6gDG" rel="nofollow noreferrer">here</a>.</p>
<p>I am seeing two different outputs with these two ways of doing a full outer join on two dataframes in pyspark:</p>
<pre><code>users1_df. \
join(users2_df, users1_df.email == users2_df.email, 'full_outer'). \
show(... | <python><dataframe><apache-spark><join><pyspark> | 2024-03-14 14:22:32 | 2 | 3,312 | ng.newbie |
78,161,053 | 1,256,925 | Convert entire (Python) file from 2-space indent to 4-space indent | <p>I regularly work with Python files that are provided to me as templates, which use an indentation of 2. However, I personally prefer working with an indentation width of 4, which is what I've set in my <code>.vimrc</code>. However, because of the indentation-sensitivity of Python, the typical <code>gg=G</code> way t... | <python><vim><indentation><auto-indent> | 2024-03-14 13:57:11 | 4 | 19,172 | Joeytje50 |
78,160,942 | 1,311,325 | Polling MySQL database not fetching new results | <p>In reference to the linked so-called duplicate question. That question asks why data is not committed to the database after an INSERT query.<br />
In my case, I am polling the table with a SELECT query. New items are posted by another process (and are actually committed to the database as confirmed using Adminer).... | <python><mysql> | 2024-03-14 13:38:41 | 1 | 6,247 | cstrutton |
78,160,781 | 11,918,314 | Function to filter a dataframe based on multiple conditions with groupby and dropping of duplicates | <p>I have a dataframe and would like to create a function to keep rows or drop duplicates based on certain conditions</p>
<p>original dataframe</p>
<pre><code>year year_month manager_movement email_address
2022 2022_jun transfer_in mary.crowe@abc.com
2022 2022_jun no_change andrew.gupt... | <python><python-3.x><dataframe><function><filtering> | 2024-03-14 13:12:17 | 2 | 445 | wjie08 |
78,160,464 | 5,539,707 | Why 00 is a valid integer in Python? | <p>In the <a href="https://docs.python.org/3/reference/lexical_analysis.html#integer-literals" rel="nofollow noreferrer">Python documentation</a> :</p>
<pre><code>integer ::= decinteger | bininteger | octinteger | hexinteger
decinteger ::= nonzerodigit (["_"] digit)* | "0"+ (["_"]... | <python><integer><pattern-matching> | 2024-03-14 12:21:10 | 1 | 1,593 | david |
78,160,229 | 351,885 | "Unsupported serialized class" when using Pyro5 proxy to get object | <p>I am updating some code to use Pyro5 (from Pyro3) and can't see how to deal with custom objects that are returned from a method accessed via a Pyro proxy. As a demonstration I have created two simple classes in a file <code>classes.py</code>: <code>Container</code> has a method that returns an instance of <code>Item... | <python><serialization><pyro> | 2024-03-14 11:40:27 | 1 | 2,398 | Ben |
78,160,159 | 8,543,025 | Python Hashing of "tupled" numpy Array | <p>I have a class <code>MyClass</code> where each instance stores pixels' x- and y-coordinates, represented as two 1D numpy arrays (of the same length). Two instances are considered equal if their coordinate arrays are identical (including <code>nan</code>).<br />
I tried two methods of hashing: one by casting both arr... | <python><numpy><hash> | 2024-03-14 11:29:26 | 1 | 593 | Jon Nir |
78,160,084 | 5,417,867 | Odoo filter order_line records on sale order form on custom property on product | <p>I have a custom Boolean property on product named 'emptygoods'. Now I'd like to filter the order lines on an sale order form to only show the lines where the emptygoods is set to False for there product. I tried using domain attribute on order_line but without success. It seems nothing inserted in the domain is doin... | <python><filter><odoo> | 2024-03-14 11:18:15 | 0 | 769 | Jesse |
78,159,962 | 2,859,206 | In pandas, how to reliably set the index order of multilevel columns during or after a pivot of two columns plus a value column | <p>After pivoting around two columns with a separate value column, I want a df with multiindex columns in a specific order, like so (please ignore that multi-2 and multi-3 labels are pointless in the simplified example):</p>
<pre><code>multi-1 one two
multi-2 multi-2 multi-2
multi-3 SomeText SomeText
... | <python><pandas><dataframe><multi-index> | 2024-03-14 10:56:14 | 1 | 2,490 | DrWhat |
78,159,960 | 11,659,631 | Power law fit doesn't work in python: it's either way off or returns only the starting parameters | <p>I'm very, very confused. I'm trying to fit a power law to my data. I tried my code to random generated data and it works just fine (see figure) but when I'm trying with my data, it's way off. I try to help curve_fit by giving starting values for the fitting parameters, but in this case, it's only returning the start... | <python><curve-fitting> | 2024-03-14 10:56:04 | 1 | 338 | Apinorr |
78,159,949 | 8,972,038 | How to stack numpy arrays with float values | <p>I have two numpy arrays with float values as below</p>
<pre><code>a = np.array([.6,.5])
b = np.array([.2,.3])
print(np.stack(a,b,dtype=float))
</code></pre>
<p>When I want to stack them, I was expecting a result like</p>
<pre><code>[[.6, .5]
[.2, .3]]
</code></pre>
<p>But I am getting this error <code>TypeError: on... | <python><numpy> | 2024-03-14 10:52:47 | 2 | 418 | Ankush Pandit |
78,159,826 | 9,079,411 | Get PriceBook items details using Pricebook id in nested query | <p>I have an sObject called Edition, it has the related PriceBook id, how to get the items of the PriceBook when querying the Edition details:</p>
<p>What I tried:</p>
<pre class="lang-py prettyprint-override"><code> query = f"""
SELECT
Id,
Name,
... | <python><salesforce><soql><simple-salesforce> | 2024-03-14 10:34:39 | 2 | 2,494 | B. Mohammad |
78,159,761 | 8,458,083 | How can I adjust the Nix Flake configuration for my virtual environment to ensure the successful execution of a Python script reliant on Ollama? | <p>I want to create a virtual environment where I can run this c.py using ollama. (like in this example <a href="https://python.langchain.com/docs/integrations/llms/ollama" rel="nofollow noreferrer">https://python.langchain.com/docs/integrations/llms/ollama</a>)</p>
<p>c.py:</p>
<pre><code>from langchain_community.llms... | <python><nix><ollama><flake> | 2024-03-14 10:25:36 | 1 | 2,017 | Pierre-olivier Gendraud |
78,159,500 | 7,074,969 | Can't load external stylesheet using dash-bootstrap after clearing browser cache | <p>I'm using <code>dash-bootstrap-components</code> and external stylesheets for my navbar. The third line in my code is literally</p>
<pre><code>app = dash.Dash(__name__,use_pages=True,external_stylesheets=[dbc.themes.CERULEAN, dbc.icons.BOOTSTRAP],suppress_callback_exceptions=True)
</code></pre>
<p>This worked fine U... | <python><twitter-bootstrap><plotly-dash> | 2024-03-14 09:46:29 | 1 | 1,013 | anthino12 |
78,159,360 | 4,564,080 | by_alias parameter on model_dump() is being ignored | <p>In the following code, we see that the field <code>id</code> is indeed created with the alias of <code>user_id</code> when we print the <code>model_fields</code>.</p>
<p>However, when I then call <code>model_dump(alias=True)</code>, the returned dict has an <code>id</code> key, but does not have a <code>user_id</cod... | <python><pydantic><sqlmodel> | 2024-03-14 09:25:33 | 2 | 4,635 | KOB |
78,159,066 | 3,390,810 | avoid repetitive occurence of the same exponent in y axis log scale plot | <p>The following code produces the figure</p>
<p><a href="https://i.sstatic.net/Z24ZP.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Z24ZP.png" alt="enter image description here" /></a></p>
<p>Where 10^1 occurs too many times which is not necessary,
How to keep only one occurrence of 10^1 ?</p>
<pre><co... | <python><matplotlib> | 2024-03-14 08:33:28 | 1 | 761 | sunxd |
78,158,958 | 15,913,281 | RuntimeError: Event loop is closed When Resending Message | <p>I am trying to send two messages, spaced a few seconds apart using python-telegram-bot. The first message is sent successfully however I get a "RuntimeError: Event loop is closed When Resending Message" error at the second attempt to send the message. The full traceback is below.</p>
<p>I am using python-t... | <python><python-telegram-bot> | 2024-03-14 08:11:13 | 0 | 471 | Robsmith |
78,158,713 | 4,862,162 | How to host a proper Python Flask server with HTTP, HTTPS and interactive debug shell, all in the same global namespace? | <p>In Python Flask, if you run <code>app.run()</code>, typically you get the following message:</p>
<pre><code>WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
</code></pre>
<p>I know how to properly host a Flask server using WSGI and gunicorn. Howev... | <python><flask><production-environment> | 2024-03-14 07:22:03 | 0 | 1,615 | xuancong84 |
78,158,558 | 4,699,441 | Type hint for pydantic kwargs? | <pre><code>from typing import Any
from datetime import datetime
from pydantic import BaseModel
class Model(BaseModel):
timestamp: datetime
number: int
name: str
def construct(dictionary: Any) -> Model:
return Model(**dictionary)
construct({"timestamp": "2024-03-14T10:00:00Z", "... | <python><pydantic><pydantic-v2> | 2024-03-14 06:43:47 | 1 | 1,078 | user66554 |
78,158,321 | 4,251,338 | Content grep in Python Regex | <p>To fetch the content I have written the code below.</p>
<pre><code>The paragraph continous here....................
................................................
TABLE1..
...........Text continuous...........
......... Text continuous...........
..........Text continuous...........
........Text continuous..... | <python><regex> | 2024-03-14 05:34:07 | 0 | 2,589 | ssr1012 |
78,158,192 | 3,111,290 | Scikit-learn import error during Vercel deployment | <p>I'm deploying a Flask chatbot backend to Vercel. I'm using scikit-learn (sklearn) to train my model, but it's not required during the chatbot's runtime.</p>
<p>During deployment, I encounter the following error:</p>
<pre><code>LAMBDA_WARNING: Unhandled exception. The most likely cause is an issue in the function cod... | <python><aws-lambda><scikit-learn><vercel> | 2024-03-14 04:58:23 | 2 | 643 | ghost21blade |
78,157,864 | 14,364,775 | How to optimize the function which uses looping on lists on pandas dataframe? | <p>I am using a function on a pandas dataframe as :</p>
<pre><code>import spacy
from collections import Counter
# Load English language model
nlp = spacy.load("en_core_web_sm")
# Function to filter out only nouns from a list of words
def filter_nouns(words):
SYMBOLS = '{}()[].,:;+-*/&|<>=~$12... | <python><python-3.x><pandas><list><nlp> | 2024-03-14 02:56:32 | 2 | 1,018 | Rikky Bhai |
78,157,777 | 5,228,070 | How to package and deploy AWS python lambda functions automatically | <p>I have created a AWS python lambda using some modules like <strong>kafka</strong>, <strong>numpy</strong>, <strong>boto3</strong> etc.</p>
<p><strong>Boto3</strong> is already provided by AWS environment. For <strong>Numpy</strong>, I am using AWS predefined layer.</p>
<p>After deploying it as <code>.zip</code> file... | <python><amazon-web-services><git><aws-lambda><deployment> | 2024-03-14 02:25:45 | 2 | 549 | santhosh |
78,157,708 | 117,870 | How to use numpy.argmax to extract values from three-dimensional array | <p>Given a three-dimensional numpy array, the index of the maximum value across the first dimension (axis 0) can be calculated using <code>numpy.argmax</code>.</p>
<p>How do I use the result of <code>argmax</code> to extract the said maximum values from another array with a similar shape?</p>
<p>For example, given the ... | <python><arrays><numpy> | 2024-03-14 02:01:18 | 2 | 12,673 | Alex Essilfie |
78,157,548 | 5,008,610 | Calculate exponential complex sum with fft instead of summation to simulate diffraction? | <h2>Context</h2>
<p>I am trying to understand x-ray diffraction a little better by coding it up in python. For a collection of points with positions R_i, the Debye formula goes</p>
<p><a href="https://i.sstatic.net/HOT7x.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/HOT7x.png" alt="enter image descript... | <python><numpy><fft><physics><discrete> | 2024-03-14 00:48:21 | 1 | 335 | andwerb |
78,157,421 | 900,898 | How to get original raw CSV row from file | <p>For example I have a CSV file like this:</p>
<pre><code>a,b,c
a1,b1,c1
</code></pre>
<p>I want to get parsed data and the original raw CSV line. For example:</p>
<pre><code>import csv
with open('some.csv') as f:
reader = csv.reader(f)
for row in reader:
# getting original raw csv line
print(row)
print(or... | <python><csv> | 2024-03-13 23:56:18 | 2 | 548 | ZigZag |
78,157,381 | 5,594,008 | Wagtail and Elasticsearch , Lookup "icontains"" not recognised | <p>I'm trying to run a search with Wagtail (5.2) and Elastic (7)</p>
<p>When I make a search for Users <code>wagtail_admin/users/?q=ffff</code> I got such error</p>
<pre><code>FilterFieldError
Cannot filter search results with field "email". Please add index.FilterField('email') to User.search_fields
</code><... | <python><django><elasticsearch><wagtail> | 2024-03-13 23:38:21 | 1 | 2,352 | Headmaster |
78,157,376 | 172,277 | Indexing issue when manipulating Series of boolean | <p>I am having what I think it an indexing problem with my DataFrame filtering.</p>
<p>I have a logic where I will apply different masks on a DataFrame and, instead of restricting the DataFrame directly I build my mask according to my custom logic.</p>
<pre class="lang-py prettyprint-override"><code># df as an input (w... | <python><pandas><dataframe> | 2024-03-13 23:37:28 | 1 | 7,591 | AsTeR |
78,157,363 | 2,236,794 | Pydantic is not applying the default value | <p>I have the following schema. If I input (enabled or disabled) in 'location' then this works and validation works fine. If I put a random string it fails (which is the way it should work). The problem is that if 'location' is an empty string. This still fails. I would like for it to set the default value and pass ... | <python><pydantic> | 2024-03-13 23:33:39 | 2 | 561 | user2236794 |
78,157,311 | 57,952 | Bunnet/Beanie odm: replace_one with upsert | <p>What would be the equivalent of <code>.replace_one({"key": key}, doc, upsert=True)</code> in bunnet/beanie odm?</p>
| <python><mongodb><odm><beanie> | 2024-03-13 23:20:40 | 1 | 30,766 | Udi |
78,157,289 | 644,326 | How to augment dataset by adding rows via huggingface datasets? | <p>I have a dataset with 113287 train rows. Each 'caption' field is however an array with multiple strings. I would like to flatmap this array and add new rows.</p>
<p>The documentation for datasets states that the <a href="https://huggingface.co/docs/datasets/about_map_batch#map" rel="nofollow noreferrer">batch mappin... | <python><huggingface-datasets> | 2024-03-13 23:11:14 | 1 | 3,682 | Jotschi |
78,157,232 | 14,250,641 | Efficient DataFrame Grouping for Condensing Rows Based on Multiple Criteria | <p>I'm aiming to group the rows based on the 'Chromosome', 'Start', and 'End' columns and then condense the corresponding 'Start1', 'End1',main_category columns into lists. Then I want to do the same thing but with the Chromosome, Start1, End1 cols. Basically, there should not be duplicates across the 'Chromosome', 'St... | <python><pandas><dataframe><numpy><group-by> | 2024-03-13 22:54:09 | 1 | 514 | youtube |
78,157,178 | 12,705,481 | Is it possible to prevent env variables from ever being printed to stdout in python? | <p>In my python app, secrets like api keys and db passwords are stored in the env vars of the machine running the python app (basically, ECS).</p>
<p>I am looking for a way to ensure that a dev on the team could <em>never</em> see those secrets. However, currently a simple <code>password = os.environ.get("db_passw... | <python><security> | 2024-03-13 22:38:43 | 0 | 2,628 | Alan |
78,157,143 | 547,231 | How do I cast a raw pointer to a pytorch tensor of a specific shape? | <p>I get a raw pointer from a C++ library which I would like to interpret (in a "<code>reinterpret_cast</code>-like fashion) as a pytorch tensor of a specific shape. Since the code is executed in a performance critical section, I really want to make sure that no heap allocations and/or copy operations are performe... | <python><pytorch> | 2024-03-13 22:26:00 | 1 | 18,343 | 0xbadf00d |
78,157,029 | 24,108 | Pandas: Rolling sum of a counter that resets | <p>When collecting network traffic stats from a server it comes in as an increasing counter that resets at a certain point. Lets say the data points for a certain time range look like</p>
<pre><code>7
15
22
29 <--- reset happens next
2
5
7
20
25 <--- reset happens again
3
7
</code></pre>
<p>The total sho... | <python><pandas> | 2024-03-13 21:57:37 | 1 | 15,040 | John Oxley |
78,156,967 | 9,290,374 | Python: google.api_core.exceptions.Forbidden: 403 Access Denied: BigQuery BigQuery: Permission denied while getting Drive credentials | <p>Using a service account & it's generated json key file, I'm trying to query a BigQuery table that is connected to an external Google Sheet. The service account has editor/viewer access and I've tried to enable the scope for Drive APIs as I've seen in other questions related to this one. The Google Drive API is a... | <python><google-bigquery> | 2024-03-13 21:43:06 | 1 | 490 | hSin |
78,156,921 | 18,814,386 | Comparing two data frames with condition and removing all that not qualified | <p>I have two data frames. I have tried to generate a short data to explain what I am looking for, any suggestion or help is appreciated.</p>
<p><code>df = pd.DataFrame({'policy number':[11,22,33,44,55,66,77,88,99], ' policy status':['good', 'good', 'good', 'good', 'good','good', 'good', 'good', 'good']})</code></p>
<p... | <python><pandas><dataframe><function><compare> | 2024-03-13 21:31:39 | 1 | 394 | Ranger |
78,156,891 | 1,608,327 | What is messing with the logging in AsyncWebsocketConsumer? | <p>I have a Django project that's using Channels for websocket communication and I've stumbled upon what I think might be a bug, but I'm not certain so I'm hoping someone that understands this better than I do can help explain what's happening here:</p>
<p>Test error message:</p>
<pre><code>AssertionError: "INFO:w... | <python><django><django-channels> | 2024-03-13 21:23:53 | 1 | 816 | Kenny Loveall |
78,156,811 | 459,745 | How do I isort using ruff? | <p>I often work in very small projects which do not have config file. How do I use <code>ruff</code> in place of <code>isort</code> to sort the imports? I know that the following command is roughly equivalent to <code>black</code>:</p>
<pre class="lang-bash prettyprint-override"><code>ruff format .
</code></pre>
<p>The... | <python><isort><ruff> | 2024-03-13 21:05:50 | 1 | 41,381 | Hai Vu |
78,156,805 | 10,237,558 | Returning data from a UDF to Snowflake in a Snowflake Native App | <p>I have a python udf that performs a http request and stores the output in a list and returns this output to snowflake. The http request returns a name for every value sent by it. Here is the code snippet of this function <code>test</code>:</p>
<pre><code># val = '["abc","etc", "dif", &q... | <python><python-3.x><snowflake-cloud-data-platform><user-defined-functions> | 2024-03-13 21:03:36 | 0 | 632 | Navidk |
78,156,752 | 610,569 | How to fine-tune a Mistral-7B model for machine translation? | <p>There's a lot of tutorials online that uses raw text affix with arcane syntax to indicate document boundary and accessed through Huggingface <code>datasets.Dataset</code> object through the <code>text</code> key. E.g.</p>
<pre><code>from datasets import load_dataset
dataset_name = "mlabonne/guanaco-llama2-1k&q... | <python><huggingface-transformers><large-language-model><machine-translation><mistral-7b> | 2024-03-13 20:51:08 | 1 | 123,325 | alvas |
78,156,741 | 16,281,150 | Django language switcher is not persistent | <p>Hello I'm struggling with my language switcher.</p>
<p>settings.py:</p>
<pre><code>LANGUAGE_CODE = 'en'
LANGUAGES = [
('de','Deutsch'),
('en','English')
]
</code></pre>
<p>urls.py:</p>
<pre><code>path('setlang', views.setlang, name='setlang'),
</code></pre>
<p>index.html:</p>
<pre><code><a href="{% u... | <python><django><localization><internationalization> | 2024-03-13 20:48:38 | 1 | 386 | rivercity |
78,156,692 | 4,009,645 | Pandas: move values from one column to an appropriate column | <p>My google-fu is failing me. I have a simple dataframe that looks like this:</p>
<div class="s-table-container"><table class="s-table">
<thead>
<tr>
<th>Sample</th>
<th>Subject</th>
<th>Person</th>
<th>Place</th>
<th>Thing</th>
</tr>
</thead>
<tbody>
<tr>
<td>1-1</td>
<td>Janet</td>
<td></td>
<td></td>
<td></td>
</tr... | <python><pandas> | 2024-03-13 20:38:02 | 2 | 1,009 | Heather |
78,156,640 | 23,315,914 | Why is Visual Studio Code saying my code in unreachable after using the Pandas concat function? | <p><img src="https://i.sstatic.net/4hMVK.png" alt="Koda UlaΕΔ±lamΔ±yor -> Code is unreachable" /></p>
<blockquote>
<p>Koda UlaΕΔ±lamΔ±yor -> Code is unreachable</p>
</blockquote>
<p>Visual Studio code is graying out my code and saying it is unreachable after I used <code>pd.concat()</code>. The IDE seems to run smoo... | <python><pandas><visual-studio-code> | 2024-03-13 20:25:52 | 4 | 305 | wwyyaa |
78,156,515 | 217,844 | pydantic: how to model AWS services and their resources? | <p>I would like to create a <a href="https://pydantic.dev/" rel="nofollow noreferrer">pydantic</a> model for a small subset of AWS services and their resources, so I can (among many other things) validate data loaded from configuration files, e.g.</p>
<pre class="lang-py prettyprint-override"><code>from yaml import saf... | <python><amazon-web-services><enums><pydantic> | 2024-03-13 19:53:47 | 0 | 9,959 | ssc |
78,156,444 | 4,987,648 | python/sage: how to get the last expression? | <p>If I do in Jupiter (in both python and sage) something like:</p>
<pre><code>a = 42
b = 43
a + b
</code></pre>
<p>it will, somehow, manage to understand that this process returns the value <code>a + b</code>, i.e. 85 here:</p>
<p><a href="https://i.sstatic.net/urZG5.png" rel="nofollow noreferrer"><img src="https://i.... | <python><jupyter><sage> | 2024-03-13 19:40:14 | 2 | 2,584 | tobiasBora |
78,156,436 | 11,402,025 | Locust : Not able to use the config value from env file | <p>I am trying to run a locust test but I am not able to use the .env file values</p>
<p>.env file contains
"Value": diuqriqjqj</p>
<p>In the locust.py I have added</p>
<pre><code>apiKey = os.environ.get("VALUE", "")
class Api(HttpUser):
wait_time = between(1, 5)
@task
def tes... | <python><environment-variables><api-key> | 2024-03-13 19:38:36 | 1 | 1,712 | Tanu |
78,156,167 | 13,949,933 | Unable to load a Django model from a separate directory in a database script | <p>I am having difficulty writing a python script that takes a directory of .txt files and loads them into my database that is utilized in a Django project. Based on requirements the python script needs to be located in a separate directory than the api (my django directory).</p>
<p>Here is my project structure curren... | <python><django><django-rest-framework> | 2024-03-13 18:45:39 | 2 | 812 | Jake Mulhern |
78,156,081 | 7,760,910 | Restrict dags in MWAA instance in consumer account via assume role | <p>I have dags under the below locations in the <code>primary root account</code>:</p>
<pre><code>s3://input-read/dags/domainA/*.py
s3://input-read/dags/domainB/*.py
</code></pre>
<p>And dags location passed in the MWAA instance is <code>s3://input-read/dags</code></p>
<p>When I open the Airflow UI from the Primar... | <python><amazon-web-services><airflow><mwaa> | 2024-03-13 18:31:01 | 1 | 2,177 | whatsinthename |
78,155,856 | 1,214,800 | Handling backreferences in re.sub when replacement includes numbers | <p>Take the following simple regex replacement:</p>
<pre class="lang-py prettyprint-override"><code>import re
s = "Python version is: 3.10"
pat = r'(is:.*)\d+\.\d+$'
version = "3.12"
result = re.sub(pat, rf'\1{version}', s)
print(result)
</code></pre>
<p>This fails with:</p>
<pre class="lang-bash pr... | <python><python-3.x><regex> | 2024-03-13 17:46:33 | 1 | 73,674 | brandonscript |
78,155,767 | 12,367,751 | Error training transformer with QLoRA and Peft | <p>So I am trying to finetuning google Gemma model using Peft and QLoRA. Yesterday I successfully fine-tuned it for 1 epoch just as a test. However, when I opened the notebook today and ran the cell that loads the model I get a huge error:</p>
<p>The code:</p>
<pre><code>model_id = "google/gemma-7b"
bnb_conf... | <python><deep-learning><nlp><huggingface-transformers> | 2024-03-13 17:29:55 | 1 | 459 | eneko valero |
78,155,420 | 14,104,321 | Can scipy.integrate.solve_ivp reject a step to avoid evaluating the RHS with an invalid state? | <p>My code is much more complex, but I can reproduce the issue with the following example:</p>
<pre><code>import numpy as np
from scipy.integrate import solve_ivp
def funct(t, y):
return -np.sqrt(y)
def event(t, y):
return y[0]-0.1
if __name__ == '__main__':
event.terminal = True
sol = solve_ivp(f... | <python><scipy><ode> | 2024-03-13 16:34:10 | 2 | 582 | mauro |
78,155,239 | 4,918,159 | access return values of function when too many values to unpack happens | <p>Occasionally, I made coding mistakes when function values list does not match. e.g.,</p>
<pre><code>def f():
return a1, a2, a3
a1, a2 = f()
</code></pre>
<p>f() can takes a long time to run, when it finishes, 'too many values to unpack' will be thrown. I have to fix the code and rerun for a very long time.</p>
... | <python> | 2024-03-13 16:05:10 | 1 | 416 | user4918159 |
78,154,960 | 1,361,752 | How to provide alternative urls for dependencies in pyproject.toml | <p>Can you list multiple urls for pip to try to find a package at in <code>pyproject.toml</code> (or "legacy" configuration files like <code>setup.py</code>)?</p>
<p>I'm thinking something like:</p>
<pre class="lang-ini prettyprint-override"><code>[project]
name='my_project'
dependencies = [
'library_packa... | <python><pip><dependencies><pyproject.toml> | 2024-03-13 15:24:43 | 0 | 4,167 | Caleb |
78,154,925 | 525,865 | BeatuifulSoup iterate over 10 k pages & fetch data, parse: European Volunteering-Services: a tiny scraper that collects opportunities from EU-Site | <p>I am looking for a public list of Volunteering - Services in Europe: I don't need full addresses - but the name and the website. I think of data ... XML, CSV ... with these fields: name, country - and some additional fields would be nice one record per country of presence. <strong>btw:</strong> the european voluntee... | <python><pandas><dataframe><web-scraping><beautifulsoup> | 2024-03-13 15:19:09 | 1 | 1,223 | zero |
78,154,889 | 1,514,114 | Interactive Docker exec with docker-py | <p>I'm trying to implement something equivalent to:</p>
<pre class="lang-bash prettyprint-override"><code>docker exec -it <some_container> /bin/bash
</code></pre>
<p>Ie. run a command in a container and connect <code>stdin</code> and <code>stdout</code> of my program to <code>stdin</code> and <code>stdout</code> ... | <python><docker><interactive><dockerpy> | 2024-03-13 15:13:02 | 1 | 548 | Johannes Bauer |
78,154,875 | 832,490 | Unable to mock get_redis function with pytest | <p>I am using fakeredis and pytest on an application</p>
<p>My get_redis function on file <code>app/helpers/providers.py</code>:</p>
<pre><code>from redis import ConnectionPool, Redis
redis_pool = None
def get_redis() -> Redis:
global redis_pool
if redis_pool is None:
redis_pool = ConnectionPool()... | <python><pytest><fastapi> | 2024-03-13 15:10:49 | 1 | 1,009 | Rodrigo |
78,154,864 | 112,976 | How to get all pending tasks of an event loop in Python/FastAPI? | <p>I am trying to understand potential slowdown in my FastAPI application.</p>
<p>My understanding is that each time I call <code>await</code>, a task is scheduled for later, creating a backlog of task to be executed. If the process is slow for some reason, the number of pending tasks should be increased.</p>
<p>How ca... | <python><python-asyncio><fastapi><event-loop><starlette> | 2024-03-13 15:09:49 | 1 | 22,768 | poiuytrez |
78,154,849 | 4,140,027 | Different embedding checksums after encoding with SentenceTransformers? | <p>I am calculating some embeddings with SentenceTransformers Library. However, I get different results when encoding the sentences and calculating their embeddings when checking the sum of their values. For instance:</p>
<p>In:</p>
<pre><code>
RANDOM_SEED = 42
np.random.seed(RANDOM_SEED)
random.seed(RANDOM_SEED)
tf.ra... | <python><jupyter-notebook><nlp><sentence-transformers> | 2024-03-13 15:07:56 | 1 | 4,670 | tumbleweed |
78,154,839 | 11,103,705 | Django upgrade to 4.2 admin static files issue | <p>I am currently using django 3.2 and would like to upgrade to 4.2 soon. Doing so on a local environment and using <code>python manage.py collectstatic</code> works. However the problem comes when I try to deploy this to a development environment.</p>
<p>The new admin static files are not loading which causes the djan... | <python><django><docker><nginx> | 2024-03-13 15:05:24 | 1 | 809 | Sorin Burghiu |
78,154,500 | 673,600 | Stats Model Power Calculation | <p>The documentation is not very clear about the method for computing the number of samples estimated for a significant result, precisely the number of N. For example, does this N relate to one distribution? So, is the output the total number of observations (across both distributions in an A/B test), or is it just one... | <python><statistics><statsmodels> | 2024-03-13 14:20:47 | 0 | 6,026 | disruptive |
78,154,426 | 4,537,160 | Python, OpenCV - drawContours of overlapping regions, some pixels are excluded? | <p>I am experimenting with cv2.drawContours. I tried this:</p>
<pre><code>import cv2
import numpy as np
def fix_format(cts):
return [np.asarray(np.round(ct), np.int32)[:, :, np.newaxis] for ct in cts]
#Β these are 2 overlapping rectangular regions
cts1 = [
[[1, 1], [6, 1], [6, 4], [1,4]],
[[3, 2], [7, 2]... | <python><opencv><image-processing><image-editing> | 2024-03-13 14:08:19 | 1 | 1,630 | Carlo |
78,154,382 | 12,297,666 | Rounding really small/near zero complex values in Python | <p>Consider the following sequence/signal:</p>
<pre><code>import numpy as np
from scipy.fft import fft
# %% Discrete data
x = np.array([0.7966875, 0.7966875, 0.7966875, 0.7966875, 0.7966875, 0.7966875,
0.7966875, 0.7966875, 0.7966875, 0.7966875, 0.7966875, 0.7966875,
0.7966875, 0.7966875, 0.7966875, 0.7... | <python><fft> | 2024-03-13 14:01:31 | 1 | 679 | Murilo |
78,153,943 | 1,397,946 | Data persistence in a multi-page Dash app | <p>I have a Dash app where user in one page, <code>data.py</code>, adds some data, and later selected rows can be viewed and removed on another page, <code>grid.py</code>. The user should be able to later get back to <code>data.py</code> and add some more data.</p>
<p>The problem: data is not persisted between the vis... | <python><plotly><plotly-dash> | 2024-03-13 12:53:36 | 1 | 11,517 | Lukasz Tracewski |
78,153,853 | 6,786,996 | Python great expectation conditional logic with pyspark | <p>I am trying to test a few data validation rules for my spark DF(running great expectation 0.18.9). I want to add a conditional logic such as verify <strong>colA is NULL when colB is also NULL</strong> . I am referring to the syntax here [https://docs.greatexpectations.io/docs/reference/learn/expectations/conditional... | <python><python-3.x><great-expectations> | 2024-03-13 12:38:59 | 0 | 315 | Nidutt |
78,153,685 | 15,913,281 | Callback Function when Requesting Market Data using ib_insync and Interactive Brokers | <p>I am trying to get market data for multiple stocks using ib_insync and Interactive Brokers. To do this I am using the <a href="https://ib-insync.readthedocs.io/api.html#ib_insync.ib.IB.events" rel="nofollow noreferrer">pendingTickersEvent</a> callback to wait for the data to arrive. However all that happens is that ... | <python><interactive-brokers><ib-insync> | 2024-03-13 12:12:03 | 1 | 471 | Robsmith |
78,153,381 | 50,065 | Using uv to install packages in the bitnami/deepspeed:0.14.0 Docker image fails with 'uv: command not found' | <p>If I use the following <code>Dockerfile</code>:</p>
<pre><code>FROM python:3.11-bullseye
ENV APP_HOME /app
WORKDIR $APP_HOME
COPY requirements.txt /app
RUN pip install uv && uv pip install --system --no-cache -r requirements.txt
</code></pre>
<p>Then the packages in <code>requirements.txt</code> install j... | <python><docker><bitnami><deepspeed><uv> | 2024-03-13 11:25:22 | 3 | 23,037 | BioGeek |
78,153,258 | 6,694,814 | Python folium problem with removing NAN from the popup | <p>I have the excel list with some blanks columns. I would like to remove NAN, but I don't know how.</p>
<p>I used the <code>dropna()</code> function, but didn't work in my case.</p>
<pre><code> df = pd.read_csv("work2.csv")
for i,row in df.iterrows():
lat = df.at[i, 'lat']
lng = df.at[i, 'lng']
sp = df.at[... | <python><pandas><folium> | 2024-03-13 11:06:05 | 1 | 1,556 | Geographos |
78,153,123 | 3,676,262 | Django-q2 schedule task hook on class function | <p>I have an object as such :</p>
<pre><code>class TestApp(models.Model):
cron = models.CharField(max_length=200)
args = models.CharField(max_length=200)
test_function = models.ForeignKey(TestFunction, on_delete=models.CASCADE)
scheduled_task = models.ForeignKey(Schedule, blank=True, null=True, on_delet... | <python><asynchronous><scheduled-tasks><django-q> | 2024-03-13 10:46:48 | 1 | 378 | BleuBizarre |
78,153,078 | 3,433,875 | Overlap polar plots to create a radial tornado chart in matplotlib | <p>I am trying to recreate this:
<a href="https://i.sstatic.net/wtvpl.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/wtvpl.png" alt="enter image description here" /></a></p>
<p>And I have most of it:</p>
<pre><code>import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
color_dict = {&... | <python><matplotlib> | 2024-03-13 10:37:33 | 1 | 363 | ruthpozuelo |
78,152,798 | 6,293,886 | Override Hydra config with experiment config- extra folder hierarchy | <p>I'm working through this <a href="https://hydra.cc/docs/patterns/configuring_experiments/" rel="nofollow noreferrer">Hydra doc example</a> to override the main config with an experiment config. Differing from the Hydra example I have another level of folder hierarchy to gather all associated configs into a single su... | <python><configuration><fb-hydra> | 2024-03-13 09:58:20 | 2 | 1,386 | itamar kanter |
78,152,796 | 2,794,152 | How to use python imshow, for example, with the irregular data points? | <p>Suppose I have a list of data points of the form <code>(xi, yi, zi)</code> and I want to plot a 2D density plot with it. In mathematica, you just call the function <code>ListDensityPlot</code> function. In python, it seems density plot is achieved by using <code>imshow</code>. However, it seems the required data sho... | <python><matplotlib><plot><wolfram-mathematica><density-plot> | 2024-03-13 09:58:12 | 1 | 4,904 | an offer can't refuse |
78,152,486 | 1,231,714 | Render the inside of a 3D model with a different color (not watertight) | <p>I am trying to render a 3D file and take a screenshot and it works OK. My file is not a water tight model.</p>
<ol>
<li>When there is no texture (either .STL or .OBJ) and I orient (rotate) the view to look underneath, it looks black. Is there a way to assign the "inside" portion of the scan a specific colo... | <python><3d><open3d> | 2024-03-13 09:11:39 | 0 | 1,390 | SEU |
78,152,455 | 23,051,231 | Unable to convert tiff PIL image to byte array | <p>I have a .tiff image loaded into a PIL Image and I'm trying to obtain its byte array.</p>
<p>This is what I'm doing:</p>
<pre><code>from PIL import Image
import io
def image_to_byte_array(image: Image) -> bytes:
imgByteArr = io.BytesIO()
image.save(imgByteArr, format=image.format)
imgByteArr = imgByt... | <python><python-3.x><python-imaging-library><tiff> | 2024-03-13 09:06:47 | 1 | 403 | galex |
78,152,055 | 102,960 | stderr doesn't get captured when stdout=sys.stdout | <p>I'm trying to run through <code>subprocess.run()</code> a command that will request user input via <code>stdout</code>, and in case the result is a failure, say why via <code>stderr</code>.</p>
<p>I want to capture <code>stderr</code> to show a friendlier error, but let <code>stdout</code> pass-through to the user's... | <python><python-3.x><python-3.8> | 2024-03-13 07:55:23 | 0 | 4,722 | igorsantos07 |
78,151,955 | 9,394,465 | delimiter within column data to be ignored in pandas | <p>I have a input csv file which shouldn't get modified automatically by pandas to any extent except the fields we modify with dataframe object. say, we use comma (,) as a separator. Now, it may contain:</p>
<ul>
<li>data without quotes:
<ul>
<li>plah</li>
<li>blah</li>
</ul>
</li>
<li>quotes in any order and in any nu... | <python><pandas> | 2024-03-13 07:36:58 | 1 | 513 | SpaceyBot |
78,151,890 | 6,803,114 | Streamlit nested button not displaying the result on clicking | <p>I have a small code which accepts .txt files and process it and returns statement saying that process completed</p>
<p>Also, another button which on click should show the output folder path.
Strangely this is not working. Here is my code.</p>
<pre><code>import streamlit as st
def main():
st.title(":blue[Ke... | <python><python-3.x><streamlit> | 2024-03-13 07:22:44 | 0 | 7,676 | Shubham R |
78,151,830 | 4,045,434 | Handling multiple formats: Convert to datetime (MM:DD:YYYY) | <p>I'm trying to convert a column having values like May 24, 1960, Mar. 1, 1990, Aug. 22, 1981 and May 1, 1953 into Date (MM:DD:YYYY).</p>
<p>Notice some have '.' between month and date and some don't.</p>
<pre><code>df['Customer DOB'] = pd.to_datetime(df['Customer DOB'], format='%b.%d,%Y').dt.strftime('%m:%d:%Y')
</co... | <python><pandas><date><datetime> | 2024-03-13 07:12:31 | 0 | 305 | AdR |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.