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,391,156 | 8,373,832 | Custom Labels in Vertex AI Pipeline PipelineJobSchedule | <p>I would like to know the steps involved in adding custom labels to a Vertex AI pipeline’s <code>PipelineJobSchedule</code>. Can anyone please provide me with the necessary guidance as it's not working when I am adding inside the Pipelinejob parameters?</p>
<pre><code># https://cloud.google.com/vertex-ai/docs/pipelin... | <python><google-cloud-platform><google-cloud-vertex-ai><kubeflow-pipelines><vertex-ai-pipeline> | 2023-10-30 18:44:49 | 2 | 356 | Rituraj kumar |
77,391,144 | 489,088 | How to get pandas pct_change to affect rows with a given index value independently from each other? | <p>I have a dataframe like so:</p>
<pre><code>df = pd.DataFrame([
['A', 2],
['B', 4],
['C', 20],
['B', 8],
['C', 2],
['A', 2]],
columns=['Label', 'Val1',])
print(df)
Label Val1
0 A 2
1 B 4
2 C 20
3 B 8
4 C 2
5 A 2
</code></pre>
<p>If I cal... | <python><python-3.x><pandas><dataframe> | 2023-10-30 18:43:20 | 1 | 6,306 | Edy Bourne |
77,391,095 | 10,557,442 | How to Calculate Time Difference from Previous Value Change in PySpark DataFrame | <p>Suppose I have the following dataframe in pyspark:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th><strong>object</strong></th>
<th><strong>time</strong></th>
<th><strong>has_changed</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>A</td>
<td>1</td>
<td>0</td>
</tr>
<tr>
<td>A</td>
<td>2</t... | <python><pyspark><rolling-computation> | 2023-10-30 18:35:48 | 1 | 544 | Dani |
77,390,990 | 10,010,688 | How to extract html text based on the lowest html tag level | <p>Is there a way to extract text with Beautifulsoup that is associated with the most relevant html tag? For example:</p>
<pre><code><div>
I'm a div
<p>I'm a paragraph</p>
</div>
</code></pre>
<p>Is there a way that I end up with</p>
<pre><code>I'm a div
</code></pre>
<p>when getting the tex... | <python><beautifulsoup> | 2023-10-30 18:18:17 | 1 | 3,858 | Mark |
77,390,865 | 12,474,157 | Error Compiling `spacy` Package with Pip and Requirements.txt (Mac M1) | <p>I'm trying to install the <code>spacy</code> package and its dependencies using <code>pip</code> and a <code>requirements.txt</code> file in a Python environment. However, I'm encountering the following error during the installation process:</p>
<h2>requirements.txt</h2>
<pre class="lang-none prettyprint-override"><... | <python><pip><anaconda><conda><pipenv> | 2023-10-30 17:53:53 | 0 | 1,720 | The Dan |
77,390,686 | 1,095,202 | Construct a callable argument in embedded Python with Python C API | <p>I am writing code that starts in Python, then goes to C via <code>ctypes</code> and inside C it uses Python embedding to invoke a Python function, that is, the flow looks like this:</p>
<pre><code>Python user code passes function name -> C mediator library -> Python "backend code"
</code></pre>
<ol>
... | <python><function-pointers><python-c-api> | 2023-10-30 17:23:22 | 0 | 927 | Dmitry Kabanov |
77,390,685 | 10,958,326 | How can I make PyCharm recognize method parameters when extracting a method? | <p>PyCharm has a few refactoring features. One of them is the <code>Extract Method</code> feature. It usually does not work as I would expect. e.g. a minimal example:</p>
<pre><code>a = 2
b = a**2
</code></pre>
<p>after selecting <code>a**2</code> and performing the <code>Extract Method</code> feature I am getting:</... | <python><pycharm> | 2023-10-30 17:23:20 | 0 | 390 | algebruh |
77,390,669 | 8,389,618 | Azure function not able to read the data from CosmosDB using Python | <p>I am trying to deploy the Azure function inside the function app and trying to read the data in the Azure function from CosmosDB.</p>
<p>The code is not able to fetch the data from the CosmosDB in the az-cli deployed function but if the same function I am running locally it is able to fetch the data properly.</p>
<p... | <python><azure><azure-functions><azure-cosmosdb> | 2023-10-30 17:20:28 | 1 | 348 | Ravi kant Gautam |
77,390,647 | 6,458,245 | Alpaca on Google colab: cannot import name 'TypeAliasType' from 'typing_extensions' | <p>I'm trying to use alpaca (the trading platform) on google colab. It works locally on my laptop, but I get the following error:</p>
<pre><code>ImportError Traceback (most recent call last)
<ipython-input-4-791aac88b96e> in <cell line: 16>()
14 # from alpaca.data.historic... | <python><python-3.x><google-colaboratory><type-alias><alpaca> | 2023-10-30 17:16:16 | 1 | 2,356 | JobHunter69 |
77,390,425 | 3,505,206 | Polars merging list of lists into a comma separated string while removing duplicates | <p>Theres a <a href="https://stackoverflow.com/questions/77053181/python-polars-merge-lists-of-lists">similar question</a> already on this, but the answer does not solve the question.</p>
<pre class="lang-py prettyprint-override"><code>df = pl.DataFrame({"id": [1, 2, 1], "name": ['jenobi', 'blah', '... | <python><python-polars> | 2023-10-30 16:38:40 | 1 | 456 | Jenobi |
77,390,328 | 5,560,091 | Pandas Custom Groupby Shift that skips over horizon | <p>I would like a custom groupby shift function that first skips the first n days before fetching lag 1,2,3 and so on. Its important to note that there are missing days, we want skip over the missing days to fetch the lags.</p>
<p>Here is a sample df:</p>
<pre><code>import pandas as pd
import numpy as np
# Sample data... | <python><pandas> | 2023-10-30 16:23:22 | 2 | 1,057 | nrcjea001 |
77,390,236 | 466,339 | Capturing repeated groups from a single Python regex | <p>I need to parse logs that may include one or more "FAULT" reports per line.
Then I need to extract (to simplify) the file name and the fault code for <em>each</em> occurrence.</p>
<p>I am struggling to find an elegant solution to retrieve all fault captures, though.</p>
<pre class="lang-py prettyprint-over... | <python><regex> | 2023-10-30 16:08:15 | 2 | 3,736 | j4x |
77,390,154 | 14,535,309 | Flask-restful: Did not attempt to load JSON data because the request Content-Type was not 'application/json' | <pre><code>Flask==2.3.3
Werkzeug==2.3.7
</code></pre>
<p>I'm trying to get a ms graph subscription going in my app but when I send the subscription request to:</p>
<p><code>https://graph.microsoft.com/v1.0/subscriptions</code></p>
<p>and get the follow-up request from ms grap to my endpoint (ValidateSubscription), flas... | <python><flask><microsoft-graph-api><mime-types><flask-restful> | 2023-10-30 15:55:57 | 1 | 2,202 | SLDem |
77,390,134 | 7,615,872 | Construct Pydantic models from json at Runtime | <p>From Pydantic <a href="https://docs.pydantic.dev/latest/integrations/datamodel_code_generator/" rel="nofollow noreferrer">documentation</a>, it's described how to statically create a Pydantic model from a json description using a code generator called <code>datamodel-code-generator</code>.</p>
<p>My question here, i... | <python><pydantic> | 2023-10-30 15:53:39 | 1 | 1,085 | Mehdi Ben Hamida |
77,390,094 | 22,371,917 | How to use User Profile With SeleniumBase? | <p>Code:</p>
<pre><code>from seleniumbase import Driver
driver = Driver(uc=True)
driver.get("https://example.com")
driver.click("a")
p_text = driver.find_element("p").text
print(p_text)
</code></pre>
<p>this code works fine but i want to add a user profile but when i try</p>
<pre><code>f... | <python><python-3.x><google-chrome><selenium-webdriver><seleniumbase> | 2023-10-30 15:47:58 | 1 | 347 | Caiden |
77,390,045 | 764,285 | How do I make database calls asynchronous inside Telegram bot? | <p>I have a Django app that runs a Telegram chatbot script as a command.</p>
<p>I start the Django app with <code>python manage.py runserver</code>.
I start the telegram client with <code>python manage.py bot</code>.</p>
<p>I want to list the entries from the Animal table within the async method that is called when a u... | <python><django><asynchronous><async-await><python-telegram-bot> | 2023-10-30 15:41:40 | 1 | 5,446 | afaf12 |
77,390,014 | 5,029,101 | ERROR: Could not build wheels for pyminizip, which is required to install pyproject.toml-based projects | <p>I was following the installation process for openimis backend -> openimis-be_py, but when I tried installing <code>pip install -r modules-requirements.txt</code> I get the following errors below. I have already installed microsoft visual c++ build tools 2022.</p>
<pre><code> Building wheel for pyminizip (setup.py... | <python> | 2023-10-30 15:37:13 | 1 | 461 | Benjamin Ikwuagwu |
77,390,003 | 7,119,501 | How to fix data loss in multi threading with API calls and appending data to a Spark Dataframe? | <p>I have an API call: <code><API_URL></code> that will return a payload. Each API call corresponds to 1 record which should be ingested into a table.</p>
<p>There are 200,000 records that I need to ingest in my table, so I ran them in a loop by ingesting one by one and it took almost 5hours. I checked the logs a... | <python><apache-spark><pyspark><python-multiprocessing><python-multithreading> | 2023-10-30 15:36:05 | 2 | 2,153 | Metadata |
77,389,869 | 12,684,429 | Infill datetime index with all dates | <p>I have a dataframe with various dates and that dates equivalent value.</p>
<p>I would like to have, however, a dataframe whereby every day is accounted for and the empty day infills with previous values.</p>
<p>So at present I have</p>
<pre><code> Value
01/01/2013 23
09/01/2013 43
13/01/2013 12
19/01/2... | <python><pandas><date><datetime> | 2023-10-30 15:18:54 | 2 | 443 | spcol |
77,389,825 | 1,191,058 | Serve file from zipfile using FastAPI | <p>I would like to serve a file from a zip file.</p>
<p>Is there some method to server files from a zip file that is nice and supports handling exceptions?</p>
<hr />
<p>Here are my experiments</p>
<p>There is the first naive approach but served files can be arbitrarily large so I don't want to load the whole content i... | <python><zip><fastapi><starlette> | 2023-10-30 15:13:38 | 0 | 3,487 | j123b567 |
77,389,793 | 1,515,891 | How to decode following string (dictionary as a string value to outer dictionary key) in Python as JSON? | <pre><code>t1 =
"""
{"abc": "{\"version\": \"1\"}"}
"""
ans = json.loads(t1)
</code></pre>
<p>Above code results in error as Python doesn't like that I'm providing dictionary as a string value of key "abc".</p>
<p>Assumin... | <python><json> | 2023-10-30 15:09:40 | 1 | 2,324 | spt025 |
77,389,609 | 6,326,148 | Iteratively join tree branches/nodes that have the same leaf values | <p>Let's say I have a dataframe with features <code>x..</code> and outcomes <code>y</code>:</p>
<pre><code>import pandas as pd
def crossing(df1: pd.DataFrame, df2: pd.DataFrame) -> pd.DataFrame:
return pd.merge(df1.assign(key=1), df2.assign(key=1), on='key').drop(columns='key')
def crossing_many(*args):
fr... | <python><tree> | 2023-10-30 14:44:50 | 2 | 1,417 | mihagazvoda |
77,389,583 | 1,100,107 | Cannot create mpf from array | <p>I am not fluent in Python.</p>
<p>I have this code:</p>
<pre class="lang-py prettyprint-override"><code>import numpy as np
import pyvista as pv
from mpmath import hyp2f1, gamma, re, exp
k = 5
n = (k - 1)/k
rho = 1.0/np.sqrt(4**n * gamma((3 - n)/2) * gamma(1 + n/2)/(gamma((3 + n)/2)*gamma(1 - n/2)))
def phi(n, z):
... | <python><numpy><mpmath> | 2023-10-30 14:40:05 | 0 | 85,219 | Stéphane Laurent |
77,389,536 | 1,313,789 | User Mailbox usage report from Google Workspace | <p>I am trying to get a basic email usage report. We need to get user names and the size of their email boxes. The code provided below throws an exception</p>
<blockquote>
<p>"<HttpError 400 when requesting <a href="https://admin.googleapis.com/admin/directory/v1/users?alt=json" rel="nofollow noreferrer">https:... | <python><google-api><google-admin-sdk><google-api-python-client><google-directory-api> | 2023-10-30 14:34:25 | 1 | 2,908 | Yuri |
77,389,396 | 7,347,925 | How to check lon/lat polygon pixels over land or ocean quickly? | <p>I have 2d lon/lat arrays and am trying to check the land type like this:</p>
<pre><code>import numpy as np
from shapely.geometry import Polygon
import cartopy.io.shapereader as shpreader
from shapely.ops import unary_union
lon = np.arange(-180, 181, .1)
lat = np.arange(-90, 91, .1)
lons, lats = np.meshgrid(lon, la... | <python><numpy><shapely><cartopy> | 2023-10-30 14:16:05 | 2 | 1,039 | zxdawn |
77,389,253 | 1,080,189 | Connexion response validation | <p>Using the latest stable version of Connexion (2.14.2) the <a href="https://connexion.readthedocs.io/en/stable/response.html#response-validation" rel="nofollow noreferrer">documentation</a> states that response validation can be used to "validate all the responses using jsonschema and is specially useful during ... | <python><validation><openapi><connexion> | 2023-10-30 13:54:57 | 1 | 1,626 | gratz |
77,389,205 | 1,256,496 | Why is my async Python unit test using mock not catching the assertion? | <p>I have a simple Python script <code>check_all_members.py</code> that calls the Microsoft Graph API to check some Entra ID groups and their members.</p>
<pre class="lang-py prettyprint-override"><code>"""Check if a group contains any external users."""
import asyncio
from msgraph import... | <python><unit-testing><python-asyncio><python-unittest> | 2023-10-30 13:49:51 | 0 | 16,425 | zemirco |
77,389,149 | 5,013,084 | Panel dashboard: links in multipage with loop not correct | <p>I am trying to create a multipage dashboard with <code>panel</code>.</p>
<p>My question is based on this <a href="https://stackoverflow.com/a/76222741/5013084">SO answer</a>:</p>
<pre class="lang-py prettyprint-override"><code>import panel as pn
from panel.template import FastListTemplate
pn.extension()
class Pag... | <python><panel-pyviz> | 2023-10-30 13:42:15 | 1 | 2,402 | Revan |
77,389,092 | 2,991,243 | Retrieve text from an XML-formatted string in Python | <p>I have a list of strings that follow a relatively similar format. Here are two examples:</p>
<pre><code>text_1 = ''<abstract lang="en" source="my_source" format="org"><p id="A-0001" num="none">My text is here </p><img file="Uxx.md" />... | <python><xml><nsregularexpression> | 2023-10-30 13:33:44 | 3 | 3,823 | Eghbal |
77,389,023 | 8,126,390 | VS Code (Windows) workspace with multiple editable python packages | <p>I have a VS Code (1.83.1) workspace with multiple folders each containing a python package.</p>
<pre><code>-Package1
--ClassA
-Package2
--ClassB
</code></pre>
<p>Package1 and Package2 are both packages I'm developing, but Package2 uses the modules in Package1, among other modules. I have installed Package1 in the vi... | <python><visual-studio-code> | 2023-10-30 13:23:23 | 2 | 740 | Brian |
77,388,886 | 616,460 | Trouble porting some GL line strips to core profile | <p>I have to port some legacy OpenGL code to the 3.3+ core profile (which I'm only somewhat familiar with) but there's a specific section I'm having some trouble with because the only way I can think to do involves a pretty inflated amount of code.</p>
<p>Basically, I have this:</p>
<pre class="lang-py prettyprint-ove... | <python><opengl><opengl-3> | 2023-10-30 13:05:19 | 0 | 40,602 | Jason C |
77,388,720 | 10,380,409 | Automation Testing with selenium Click doesn't works on new Safari 17 IOS Sonoma 14.1 | <p>everyone.
I would like to expose my problem.
My tests started to fail on Safari since I did upgrade to Safari 17, IOS Sonoma 14.1.
In particular, is the click event of an element for example.
Element.click() or button.click()</p>
<pre><code> elem = web_driver.find_element(By.XPATH,Mylocator)
self.mouse_o... | <python><selenium-webdriver><safari><automation-testing><macos-sonoma> | 2023-10-30 12:39:25 | 3 | 826 | Angelotti |
77,388,712 | 1,173,629 | Python passing sys.stdout directly and via variable change the printing order | <p>I am trying to capture the <code>print</code> message from a function, so I can use them later. I have already found the following code for it.</p>
<pre><code>import io
import sys
from contextlib import redirect_stdout
f = io.StringIO()
def hello():
print("From function", file=sys.stdout)
with re... | <python> | 2023-10-30 12:38:12 | 1 | 1,767 | Gul |
77,388,298 | 4,435,175 | How to download file from https://docs.google.com/spreadsheets with Google API and authentification / service account? | <p>I want to automatically download a file on a daily basis from a <code>https://docs.google.com/spreadsheets</code> account (service account).</p>
<p>I have a cred.json file with:</p>
<pre><code>{
"type": "service_account",
"project_id": "id_1234",
"private_key_id&quo... | <python><google-api-python-client> | 2023-10-30 11:33:06 | 1 | 2,980 | Vega |
77,388,075 | 15,456,681 | Large performance difference between indexing and reshape in numba | <p>In numba >= 0.57 we can now add axes to arrays by indexing with <code>None</code> whereas previously this would have raised:</p>
<pre><code>TypingError: Failed in nopython mode pipeline (step: nopython frontend)
No implementation of function Function(<built-in function getitem>) found for signature:
>... | <python><numpy><performance><numba> | 2023-10-30 10:58:15 | 0 | 3,592 | Nin17 |
77,388,062 | 3,138,238 | Activate a Chrome Extension with a "Browser Action" in Selenium with python | <p>For test purposes I need to use a Chrome extension inside my Selenium tests.
In the picture you just see the extensions button (the puzzle piece) and under that (clicking) there is the extension I want to activate.<br><br>
<a href="https://i.sstatic.net/EEENo.png" rel="nofollow noreferrer"><img src="https://i.sstati... | <python><selenium-webdriver><testing><automated-tests><keyboard-shortcuts> | 2023-10-30 10:56:27 | 0 | 7,311 | madx |
77,388,002 | 848,746 | huggingface embedding large csv in batches | <p>I have a large csv file (35m rows) in the following format:</p>
<pre><code>id, sentence, description
</code></pre>
<p>Normally in inference mode, Id like to use model like so:</p>
<pre><code>for iter_through_csv:
model = SentenceTransformer('flax-sentence-embeddings/some_model_here', device=gpu_id)
encs = m... | <python><csv><sentence-transformers> | 2023-10-30 10:47:17 | 2 | 5,913 | AJW |
77,387,881 | 6,221,742 | Timeseries with pycaret hangs in compare models | <p>I am trying to make a timeseries forecasting using pycaret autoML package using the data in the following link <a href="https://www.kaggle.com/datasets/koureasstavros/parts-revenue-from-automotive-industry-dealer" rel="nofollow noreferrer">parts_revenue_data</a> in google colab. When I try to compare the models and ... | <python><time-series><google-colaboratory><forecasting><pycaret> | 2023-10-30 10:30:56 | 1 | 339 | AndCh |
77,387,793 | 1,232,660 | Executing python code with '-c' flag triggers bash | <p>I am using Python with the <a href="https://docs.python.org/3/using/cmdline.html#cmdoption-c" rel="nofollow noreferrer">command-line option <code>-c</code></a>. Printing some strings works:</p>
<pre><code>python -c "print('foo')"
foo
</code></pre>
<p>but printing an exclamation mark triggers some bash-rela... | <python><bash> | 2023-10-30 10:17:05 | 0 | 3,558 | Jeyekomon |
77,387,669 | 10,020,441 | How can I concat strings that might be empty? | <p>Currently I am trying to concat three strings in my Ansible playbook. Two of them can be unset (<code>None</code>/<code>null</code>) and I need them to be separated by underscores.</p>
<p>Here is an example: <code>type_mode="A"</code>, <code>level_mode=None</code>, and <code>what_to_run="C"</code... | <python><string><ansible> | 2023-10-30 09:59:07 | 1 | 515 | Someone2 |
77,387,641 | 4,451,521 | Why nan values appear on plotly heatmap? | <p>I have the following script</p>
<pre><code>import plotly.graph_objects as go
X = [0.001872507, 0.001873447, 0.001874379, 0.001875308, 0.001876231, 0.001877156, 0.001878074, 0.001878988, 0.001879891, 0.00188079]
Y = [15.87916667, 15.8375, 15.90277778, 15.92638889, 16.0875, 16.05833333, 16.11527778, 16.04166667, 16.1... | <python><plotly> | 2023-10-30 09:55:19 | 1 | 10,576 | KansaiRobot |
77,387,622 | 4,586,008 | Looking for a way to visualize sequence data in Python | <p>Suppose I have a Pandas dataframe which looks as follow:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>Event Type</th>
<th>Start Time</th>
<th>End Time</th>
</tr>
</thead>
<tbody>
<tr>
<td>A</td>
<td>1</td>
<td>3</td>
</tr>
<tr>
<td>B</td>
<td>2.5</td>
<td>5</td>
</tr>
<tr>
<td>C</td>
... | <python><pandas><visualization> | 2023-10-30 09:52:29 | 1 | 640 | lpounng |
77,387,509 | 839,733 | Dynamic padding with period using f-string | <p>Given a width <code>n</code>, and an index <code>i</code>, how to generate a string of length <code>n</code> with <code>x</code> at index <code>i</code>, and <code>.</code> at the remaining indices?</p>
<p>For example:</p>
<pre><code>Input: n = 4, i = 1
Output: ".x.."
</code></pre>
<p>Currently I'm doing:<... | <python><string><string-formatting><padding><f-string> | 2023-10-30 09:33:33 | 1 | 25,239 | Abhijit Sarkar |
77,387,489 | 1,159,290 | Why can modules be imported again after removing their location from sys.path? | <p>My goal is to import a module from a given path, and let my Python program import other modules with the same module name, but imported from different location later on.</p>
<p>I thought I'd do that by changing the system path, but I am facing an issue when removing things from it: it does not look it is really havi... | <python><import><module><path> | 2023-10-30 09:28:58 | 2 | 1,003 | user1159290 |
77,387,338 | 13,518,907 | RetrievalQAWithSourcesChain - NotImplementedError: Saving not supported for this chain type | <p>I built a RAG pipeline and now want to save the model/pipeline locally. However when I try to save it I get an error message. Here is the code and the error output:</p>
<pre><code>prompt_template = """ You are a chatbot having a conversation with a human. You can only answer in the German language.
Do... | <python><langchain><large-language-model> | 2023-10-30 09:04:48 | 1 | 565 | Maxl Gemeinderat |
77,387,302 | 2,919,052 | Send email with Python in Windows 11 with "Outlook (New)" | <p>I am trying to send an email in a Windows 11 machine, with a Python code that was previously working on a different Windows 10 machine with Outlook installed.</p>
<p>It seems like, for some reason, in Windows 11, the "real" Outlook desktop app is not installed...instead, it installs some sort of (webview m... | <python><email><outlook><win32com><office-automation> | 2023-10-30 08:57:38 | 1 | 5,778 | codeKiller |
77,387,280 | 20,266,647 | Performance issue with low microservice utilization in K8s (impact to development and devops also) | <p>When I designed microservice and made deployment to K8s, I saw that I had problem to get higher utilization for my microservices (max. utilization was only 0.1-0.3 CPU). Do you have best practices, how can we increase microservice CPU utilization?</p>
<p>Let me describe the LAB environment:</p>
<ul>
<li>K8s with 5 ... | <python><performance><microservices><real-time> | 2023-10-30 08:52:41 | 1 | 1,390 | JIST |
77,387,252 | 11,082,866 | Convert a Column to datetime where some values are not dates | <p>I have a dataframe in which there is a column <code>grn_date</code> which consists of some datetime values and some "-" because earlier i filled it up like this:</p>
<pre><code> df['grn_date'].fillna('-', inplace=True)
</code></pre>
<p>Earlier I was doing this for the whole columns:</p>
<pre><code> #... | <python><pandas> | 2023-10-30 08:47:15 | 1 | 2,506 | Rahul Sharma |
77,387,131 | 13,238,846 | Where can i see Python terminal outputs | <p>I have deployed Python web app on azure web app service that prints outputs in to terminal. Where I can see that without attaching a debugger. My app is using this startup command.</p>
<pre><code>python3.10 -m aiohttp.web -H 0.0.0.0 -P 8000 app:init_func
</code></pre>
<p>I just want to see the outputs of that.</p>
| <python><azure><terminal><azure-web-app-service> | 2023-10-30 08:22:44 | 1 | 427 | Axen_Rangs |
77,387,099 | 3,685,918 | How to fill the rightmost column with values in pandas | <p>There is an unknown number of columns, and each row has exactly one value.</p>
<p>However, I cannot tell which column the number is in.</p>
<p>I would like to know how to fill one value from each row into the rightmost column.</p>
<p>The example below consists of three columns, but I don't know how many there actual... | <python><python-3.x><pandas><ffill> | 2023-10-30 08:16:11 | 4 | 427 | user3685918 |
77,387,006 | 19,694,624 | ModuleNotFoundError when importing my own python module | <p>so the problem is that when I try to import something from the module I created, I run into ModuleNotFoundError: No module named '<my_module>'.</p>
<p>My project structure is just like this one:</p>
<pre><code>├── first.py
└── some_dir
├── second.py
└── third.py
</code></pre>
<p>You can replicate the p... | <python><python-3.x><python-import><importerror><python-module> | 2023-10-30 07:55:41 | 1 | 303 | syrok |
77,386,715 | 5,832,540 | Recommended way to approach computed field using I/O operations | <p>I have a deeply nested model which on several levels uses this model for an object stored in an S3 bucket:</p>
<pre class="lang-py prettyprint-override"><code>class S3Object(BaseModel):
bucket: str
key: str
</code></pre>
<p>During serialization I would like to create a <a href="https://docs.aws.amazon.com/Am... | <python><pydantic> | 2023-10-30 07:04:37 | 1 | 10,230 | Tomáš Linhart |
77,386,669 | 4,451,521 | Why my heatmap is plotting nans if I expressly extracted the nans? | <p>I have this piece of code</p>
<pre><code> print(abs(data.left_error))
print(data['left_error'].isna().sum())
# Remove rows with NaN values in the 'left_error' column
left_no_nan = data.dropna(subset=['left_error'])
print(abs(left_no_nan.left_error))
print(left_no_nan['left_error'].isna().sum(... | <python><pandas><heatmap><plotly> | 2023-10-30 06:56:07 | 1 | 10,576 | KansaiRobot |
77,386,631 | 12,519,954 | how to trigger s3 in aws lambda locally | <p>I was testing aws lambda python locally with docker.My purpose is trigger a lambda function when a JSON file is uploading to a s3 bucket. and I want to test it locally and I need the event data.</p>
<p>I have done almost everything with docker and push this docker image to ECR and then deploy to aws lambda.But how c... | <python><amazon-web-services><docker><amazon-s3><aws-lambda> | 2023-10-30 06:48:44 | 1 | 308 | Mahfujul Hasan |
77,386,620 | 2,142,577 | Is it possible to call Pyright from code (as an API)? | <p>It seems that <a href="https://github.com/microsoft/pyright" rel="nofollow noreferrer">Pyright</a> (the Python type checker made by Microsoft) can only be used as a command line tool or from VS Code. But is it possible to call pyright from code (as an API)?</p>
<p>For example, mypy <a href="https://mypy.readthedocs.... | <python><pyright> | 2023-10-30 06:46:06 | 3 | 19,596 | laike9m |
77,386,515 | 880,783 | Can I skip a test (or mark it as inconclusive) in pytest while it is running? | <p>I am aware of <code>pytest</code>'s decorators to mark tests as to be skipped (conditionally). However, all those are evaluated before the test starts.</p>
<p>I have a couple of tests that require a user interaction (those are not run on <a href="https://en.wikipedia.org/wiki/Continuous_integration" rel="nofollow no... | <python><pytest> | 2023-10-30 06:19:23 | 1 | 6,279 | bers |
77,386,480 | 2,998,077 | Python to loop through .py scripts for key-word | <p>A file directory (Windows 10) that used to store many "*.py" scripts.</p>
<p>I want to loop through the .py scripts to find out, which of them contains the specific key-word.</p>
<p>What would be the better way than below, because it often encounters error as:</p>
<blockquote>
<p>UnicodeDecodeError: 'utf-8... | <python> | 2023-10-30 06:08:34 | 2 | 9,496 | Mark K |
77,385,954 | 10,987,285 | python re(regular expression) replace all occurrence of a pattern but exclude a scenario | <p>I have a tricky scenario to use regular expression in Python.</p>
<p>Here is the example--</p>
<p>Input:</p>
<pre><code>text = """4056,"Wholesale, Operations","Performed some ""activities"", at 10 am. ",19/12/2022,,"a,B" """
</code></pre... | <python><regex> | 2023-10-30 02:34:16 | 0 | 1,615 | QPeiran |
77,385,932 | 7,578,494 | numpy conditioning values by the index within a axis | <pre><code>ar = np.arange(2*3*3).reshape(2, 3, 3)
</code></pre>
<p>I want to initialize a boolean numpy array filled with <code>True</code>, but only give <code>False</code> for elements of the second position of the axis 2. The desired array is</p>
<pre><code>array([[[ True, False, True],
[ True, False, True... | <python><numpy> | 2023-10-30 02:22:00 | 1 | 343 | hlee |
77,385,911 | 18,108,767 | How to reshape a xarray Dataset? | <p>I have a <code>xarray.Dataset</code> named <code>seisnc_2d</code> with dimensions <code>'x': 240200, 'y': 2001</code> these are 200 seismic shots, each seismic shot has a dimension <code>(1201,2001)</code>, which means that the <code>n</code> shot will be <code>seisnc_2d.isel(x=slice((n-1)*1201, n*1201))</code>.</p>... | <python><python-xarray> | 2023-10-30 02:10:37 | 1 | 351 | John |
77,385,841 | 7,155,684 | How to limit sklearn GridSearchCV cpu usage? | <p>I use <code>GridSearchCV</code> as follows:</p>
<pre><code>gsearch_lgb = GridSearchCV(
model(**self.model_params),
param_grid=self.model_params,
n_jobs=2,
verbose=99,
scoring=self.cv_scoring,
cv=4,
)
</code></pre>
<p>But joblib still uses my all cores:</p>
<p><a href="https://i.sstatic.net/qR... | <python><scikit-learn><parallel-processing><joblib> | 2023-10-30 01:35:25 | 1 | 3,869 | Jim Chen |
77,385,642 | 1,621,041 | How to sympy.nsolve small values? | <pre class="lang-py prettyprint-override"><code>from sympy import *
x = symbols("x")
y = pi*(7.92e-24*x*(1 - exp(2.47376311844078e-6/x)) + 3.91844077961019e-30*exp(2.47376311844078e-6/x))/(x**7*(1 - exp(2.47376311844078e-6/x))**2)
interval = 0, 1e-6
plot(y, (x, *interval))
</code></pre>
<p><a href="https://i.... | <python><sympy> | 2023-10-30 00:08:23 | 1 | 11,522 | finefoot |
77,385,599 | 1,444,231 | Pyspark aggregation with random number of row selection by using time column and a duration variable | <p>In pyspark, I have a dataframe like the following sample:</p>
<pre><code>id, execution_time, sym, qty
========================================
1, 2023-10-27 15:01:24.2200, aa1, 100
2, 2023-10-27 15:15:21.2200, aa1, 250
3, 2023-10-27 15:27:24.2200, aa2, 350
4, 2023-10-27 15:35:25.2200, aa3, 400
5, 2023-10-27 16:00.25... | <python><pyspark> | 2023-10-29 23:50:57 | 2 | 361 | yogendra |
77,385,587 | 2,299,692 | Persist ParentDocumentRetriever of langchain | <p>I am using ParentDocumentRetriever of langchain.
Using mostly the code from their <a href="https://python.langchain.com/docs/modules/data_connection/retrievers/parent_document_retriever" rel="noreferrer">webpage</a> I managed to create an instance of ParentDocumentRetriever using bge_large embeddings, NLTK text spli... | <python><py-langchain><chromadb><content-based-retrieval> | 2023-10-29 23:47:18 | 2 | 1,938 | David Makovoz |
77,385,467 | 4,281,353 | python - explanation on different timezone string format for the same | <p>Why <code>datetime.datetime</code> created with <code>zoneinfo.ZoneInfo</code> timezone gives different timezone string with its <code>tzinfo</code> attribute?</p>
<p><a href="https://docs.python.org/3/library/zoneinfo.html#using-zoneinfo" rel="nofollow noreferrer">Using ZoneInfo</a> document says:</p>
<blockquote>
... | <python><datetime><timezone> | 2023-10-29 22:53:24 | 1 | 22,964 | mon |
77,385,360 | 2,681,662 | Python unittest mock an attribute | <p>I have a device attached to the PC and I wrote a Python wrapper for its API so I can control it. I wrote <code>unittest</code> for my code.</p>
<p>Some values are obtained from the device itself and it cannot be changed.</p>
<p>For example, to check if the device is connected I have to read it from an attribute and ... | <python><win32com><python-unittest.mock> | 2023-10-29 22:07:10 | 1 | 2,629 | niaei |
77,385,304 | 19,299,757 | How can I set up IAM authentication for my API Gateway using AWS SAM? | <p>I have the below SAM template to create a Lambda function & an API Gateway with <code>AWS_IAM</code> auth (IAM authentication):</p>
<pre class="lang-yaml prettyprint-override"><code>MyDemoLambdaApiFunction:
Type: AWS::Serverless::Function
Properties:
Description: >
Currently does not support S3 ... | <python><amazon-web-services><aws-lambda><aws-api-gateway> | 2023-10-29 21:42:50 | 1 | 433 | Ram |
77,385,180 | 10,934,417 | Expand Pandas DataFrame with numerical values? | <p>I would like to expand my DataFrame and I have checked out a similar <a href="https://stackoverflow.com/questions/68354526/how-to-repeat-expand-pandas-data-frame">example</a> on stackoverflow but without any success. Any idea how to fix it?</p>
<p>This is my toy example</p>
<pre><code>import pandas as pd
import nump... | <python><pandas><numpy> | 2023-10-29 20:58:39 | 1 | 641 | DaCard |
77,385,156 | 1,117,119 | Tracing the references for a specific object in Python (memory leak) | <p>I have a 3rd party library creating huge memory leaks. I've called <code>gc.collect</code>, and have no references to any objects created by this library, but it still leaks.</p>
<p>Using <code>gc.get_objects()</code> I've identified numerous objects which should not be alive, as they are specific to this library.</... | <python><memory-leaks> | 2023-10-29 20:50:11 | 1 | 2,333 | yeerk |
77,385,142 | 3,887,338 | Using a pipe symbol in typing.Literal string | <p>I have a function that accepts certain literals for a specific argument:</p>
<pre><code>from typing import Literal
def fn(x: Literal["foo", "bar", "foo|bar"]) -> None:
reveal_type(x)
</code></pre>
<p>The third contains a pipe symbol (<code>|</code>), <code>"foo|bar"</c... | <python><mypy><python-typing> | 2023-10-29 20:47:45 | 1 | 1,202 | Håkon T. |
77,385,112 | 6,197,439 | Pandas str.replace with regex doubles results? | <p>Let's say I have this pandas Series:</p>
<pre class="lang-none prettyprint-override"><code>$ python3 -c 'import pandas as pd; print(pd.Series(["1","2","3","4"]))'
0 1
1 2
2 3
3 4
dtype: object
</code></pre>
<p>I'd like to "wrap" the strings "1",... | <python><pandas><regex> | 2023-10-29 20:37:40 | 2 | 5,938 | sdbbs |
77,385,005 | 13,184,183 | Is pd.groupby a generator? | <p>What is underneath the following loop?</p>
<pre class="lang-py prettyprint-override"><code>for name, group in df.groupby('some_col'):
pass
</code></pre>
<p>Is it a generator or all groups are computed at once and stored in memory?</p>
| <python><pandas> | 2023-10-29 20:02:45 | 1 | 956 | Nourless |
77,384,995 | 13,184,183 | How to expand group for window function in pyspark? | <p>I have a dataframe with the following columns <code>id</code>, <code>place</code>, <code>date</code>, <code>value</code>. There is also list of dates <code>dates</code>. The dates are the last days of months. Let us say <code>value</code> can take values of <code>core</code> and <code>not core</code>. I want to crea... | <python><pandas><pyspark> | 2023-10-29 19:58:18 | 1 | 956 | Nourless |
77,384,867 | 6,224,975 | Get the health status for a Google Vertex Endpoint | <p>Say I have an endpoint:</p>
<pre class="lang-py prettyprint-override"><code>from google.cloud.aiplatform import Endpoint
endpoint = Endpoint(endpoint_name="some_id",location = "location")
</code></pre>
<p>I can get predictions using <code>endpoint.predict()</code>, but how do I just make a health... | <python><google-cloud-platform><google-cloud-vertex-ai> | 2023-10-29 19:22:31 | 0 | 5,544 | CutePoison |
77,384,427 | 9,494,140 | how to log the user in Directus from a different domain and login form then authenticate him in the Directus admin page | <p>now I have created a <code>Directus</code> application, and am using it as a back-end .. and am letting the user log in from another external domain and form <code>Django</code> app and sending post request to be able to login .. how to stop <code>Derictus</code> from asking him to log in again after i redirect him ... | <python><django><authentication><directus> | 2023-10-29 17:31:11 | 0 | 4,483 | Ahmed Wagdi |
77,384,412 | 14,566,295 | Define the custom function on-the-fly without defining explicitly | <p>I have below code</p>
<pre><code>from joblib import Parallel, delayed
def process(i):
return i * i
results = Parallel(n_jobs=2)(delayed(process)(i) for i in range(10))
</code></pre>
<p>I am wondering if instead of explicitly defining my function process if I can define the function on-the-fly within <code>P... | <python> | 2023-10-29 17:28:06 | 1 | 1,679 | Brian Smith |
77,384,222 | 10,966,677 | Pandas read_html throws ParseError: Document is empty because of emoji | <p>While scraping a web page searching for tables using <code>Pandas.read_html()</code>, I get into this error due to emojis in the html source:</p>
<pre><code>lxml.etree.ParserError: Document is empty
</code></pre>
<p>I have tried both reading directly from the html source (as string) and reading the <code><table&g... | <python><pandas><selenium-webdriver><beautifulsoup> | 2023-10-29 16:34:25 | 1 | 459 | Domenico Spidy Tamburro |
77,384,100 | 20,266,647 | Access key must be provided in Client() arguments or in the V3IO_ACCESS_KEY environment variable | <p>I got the error <code>ValueError: Access key must be provided in Client() arguments or in the V3IO_ACCESS_KEY environment variable</code> during data ingest in MLRun CE (version 1.5.0).</p>
<p>I used this code:</p>
<pre><code>import mlrun
import mlrun.feature_store as fstore
import sys, time, pandas, numpy
def test... | <python><mlops><mlrun><feature-store> | 2023-10-29 16:04:34 | 1 | 1,390 | JIST |
77,383,740 | 13,656,045 | wxPython: Video not showing but I can hear the audiio | <p>I'm trying to make a simple program to keep or remove videos from a folder (and it's subfolder) however while I can hear the video, I can't see it.</p>
<pre><code>import os
import wx
import wx.media
from moviepy.editor import VideoFileClip
class VideoSelector(wx.Frame):
def __init__(self):
wx.Frame.__in... | <python><video><wxpython> | 2023-10-29 14:27:31 | 1 | 2,208 | Sy Ker |
77,383,474 | 7,556,522 | How to label a pl.Series using two pl.DataFrame not joined with null values? | <h1>The problem</h1>
<p>I have pl.DataFrame df_signals</p>
<pre><code>┌──────────────┬──────┬─────────────────────────┬──────────┬──────────┐
│ series_id ┆ step ┆ timestamp ┆ sig1 ┆ sig2 │
│ --- ┆ --- ┆ --- ┆ --- ┆ --- │
│ str ┆ u32 ┆ datetime[μ... | <python><dataframe><datetime><python-polars> | 2023-10-29 13:23:55 | 2 | 968 | Olivier D'Ancona |
77,383,348 | 1,982,032 | How can rewrite the code with pure playwright codes? | <p>I want to get all the <code>a</code> elements <code>href</code> attribute in the webpage <code>https://learningenglish.voanews.com/z/1581</code>:</p>
<pre><code>from lxml import html
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch(channel='chrome',headless... | <python><python-3.x><xpath><playwright-python> | 2023-10-29 12:50:42 | 1 | 355 | showkey |
77,383,220 | 9,962,007 | Get names of all numeric columns in a pandas DataFrame (filter by dtype) | <p>Which <code>pandas</code> methods can be used to get names of the columns of a given <code>DataFrame</code> that have numeric <code>dtypes</code> (of all sizes, such as <code>uint8</code>, and not just 64-bit ones), using a single line of code? Note: in practice there are hundreds of columns, so <code>dtypes</code> ... | <python><pandas><numpy><dtype> | 2023-10-29 12:08:57 | 1 | 7,211 | mirekphd |
77,383,206 | 22,466,650 | How to get the editior elements of regex101? | <p>If we consider this <a href="https://regex101.com/r/t1nqwU/1" rel="nofollow noreferrer">https://regex101.com/r/t1nqwU/1</a>, how can I get this elements :</p>
<ul>
<li>REGULAR EXPRESSION</li>
<li>REGEX OPTIONS</li>
<li>TEST STRING</li>
</ul>
<p>When I inspect the page, I understand that I need to query <code>div cla... | <python><web-scraping><beautifulsoup> | 2023-10-29 12:06:58 | 1 | 1,085 | VERBOSE |
77,383,196 | 4,139,143 | How can I pass a list of numba jitted functions as an argument into another numba jitted function? | <p>This code works fine as expected</p>
<pre><code>import numpy as np
import numba as nb
def f1(x):
return 2 * x
def f2(x):
return x - 4
def f(funcs, x):
out = np.zeros(len(funcs))
for i in range(len(out)):
out[i] = funcs[i](x)
return out
f([f1, f2], 3)
>>> array([ 6., -1.])
</... | <python><numba><jit> | 2023-10-29 12:04:27 | 0 | 7,378 | PyRsquared |
77,383,154 | 595,305 | Clear up PyO3 removed Rust module? | <p>I'm a bit puzzled: I had a PyO3 module which I've now removed completely... the Rust module directory and files have been deleted and there is no reference to them in any Cargo.toml files, or anywhere.</p>
<p>And yet, when I run my Python script it is still able to import the old Rust module, and run the PyO3 functi... | <python><rust><pyo3> | 2023-10-29 11:53:58 | 0 | 16,076 | mike rodent |
77,383,027 | 1,367,688 | Hashing with sha1[:10] or MD5 for caching, is MD5 is better? | <p>I tried to find good hashing function that will be fast and short</p>
<p>There is discussion <a href="https://stackoverflow.com/questions/4567089/hash-function-that-produces-short-hashes">Hash function that produces short hashes?</a></p>
<p>They recommend to use:</p>
<pre class="lang-py prettyprint-override"><code>... | <python><caching><hash><md5><sha1> | 2023-10-29 11:16:17 | 2 | 467 | Yehuda |
77,382,829 | 1,942,868 | Assert when ObjectDoesNotExitst is raise | <p>I have this function which raises the <code>ObjectDoesNotExist</code></p>
<pre><code>def is_user_login(self,id):
try:
u = m.CustomUser.objects.get(id=id)
except ObjectDoesNotExist as e:
raise e
</code></pre>
<p>Now I am writing the test script.</p>
<pre><code> try:
CommonFunc.is_us... | <python><django> | 2023-10-29 10:14:25 | 1 | 12,599 | whitebear |
77,382,814 | 898,042 | sklearn binary classifier for dataset with datetime, categorical values without preprocessing? | <p>I need to predict if signup-driver will actually start driving using some basic classifier.</p>
<pre><code>city_name signup_os signup_channel signup_date bgc_date first_completed_date did_drive
Strark ios web Paid 1/2/16 NaN NaN no
Strark windows ... | <python><scikit-learn><classification> | 2023-10-29 10:09:01 | 1 | 24,573 | ERJAN |
77,382,634 | 7,055,769 | unable to access object's property despite it being present | <p>My serializer:</p>
<pre><code>class TaskSerializer(serializers.ModelSerializer):
class Meta:
model = Task
fields = "__all__"
def create(self, validated_data):
try:
print(validated_data)
print(validated_data.author)
task = Task.objects.cre... | <python><django><django-rest-framework> | 2023-10-29 09:07:36 | 1 | 5,089 | Alex Ironside |
77,382,541 | 8,253,860 | Can I use sentry to track errors originating from a specific package? | <p>I am using sentry to track error and performance of my pypi package. The problem is that a lot of times it captures errors that are not at all related to my package but because my package is imported, those errors are tracked. Sometimes the same type of errors flood the dashboard.
I couldn't find anything related to... | <python><performance><error-handling><sentry> | 2023-10-29 08:33:23 | 0 | 667 | Ayush Chaurasia |
77,382,299 | 6,734,243 | how to accept 2 extention for a file in python? | <p>I'm discovering files from my template directory one of them should be <code>copier.yaml</code>, to do so I'm using the following:</p>
<pre class="lang-py prettyprint-override"><code>copier_yaml = template_dir / "copier.yaml" # a pathlib.Path
params = yaml.safe_load(copier_yaml.read_text())
</code></pre>... | <python> | 2023-10-29 07:07:01 | 1 | 2,670 | Pierrick Rambaud |
77,382,208 | 16,725,431 | Python replace unprintable characters except linebreak | <p>I am trying to write a function that replaces unprintable characters with space, that worked well but it is replacing linebreak <code>\n</code> with space too. I cannot figure out why.</p>
<p>Test code:</p>
<pre><code>import re
def replace_unknown_characters_with_space(input_string):
# Replace non-printable cha... | <python><python-3.x><ascii><python-re><non-printing-characters> | 2023-10-29 06:25:34 | 4 | 444 | Electron X |
77,382,170 | 13,336,872 | Django - Running pip as the 'root' user can result in broken permissions | <p>I'm deploying my Django backend utilizing the AWS app runner service. The contents of my files are as follows.</p>
<p><strong>apprunner.yaml</strong></p>
<pre><code>version: 1.0
runtime: python3
build:
commands:
build:
- pip install -r requirements.txt
run:
runtime-version: 3.8.16
command: sh startu... | <python><django><amazon-web-services><virtualenv><version> | 2023-10-29 06:01:54 | 1 | 832 | Damika |
77,381,900 | 9,900,084 | Write a matplotlib figure to a ReportLab PDF file without saving image to disk | <p>I'm trying to find a way to write a matplotlib figure to a PDF via reportlab (4.0.6 open-source version). According to its <a href="https://docs.reportlab.com/reportlab/userguide/ch2_graphics/#image-methods" rel="nofollow noreferrer">doc</a>, it should accept a PIL Image object, but I tried the following and it retu... | <python><matplotlib><python-imaging-library><reportlab> | 2023-10-29 03:20:54 | 1 | 2,559 | steven |
77,381,869 | 1,173,913 | Convert sklearn random forest model into raw python code | <p>If I have a sklearn random forest model like the one below, how would I convert the tree to raw Python code? I.e. rather than call the predict() function for the classifier, I want the tree in raw code so I can use it in an embedded application. I can generate C++ code like this using MicroMLgen, but I need Python.<... | <python><machine-learning><scikit-learn><random-forest> | 2023-10-29 03:00:05 | 0 | 581 | Graham |
77,381,858 | 3,299,432 | Date data type not preserved in Snowflake to Pandas dataframe | <p>I have a Snowflake table that includes a date field.</p>
<p>When I query Snowflake and load the data into a Pandas dataframe the date is always converted to object data type in the Pandas dataframe.</p>
<p>I've tried lots of options, at the moment I'm using this</p>
<pre><code>snowflake_url = f'snowflake://{sf_user}... | <python><python-3.x><sqlalchemy><snowflake-cloud-data-platform> | 2023-10-29 02:52:37 | 1 | 547 | cmcau |
77,381,775 | 268,581 | Format y-axis as Trillions of U.S. dollars | <p>Here's a Python program which does the following:</p>
<ul>
<li>Makes an API call to treasury.gov to retrieve data</li>
<li>Stores the data in a Pandas dataframe</li>
<li>Plots the data</li>
</ul>
<pre><code>import requests
import pandas as pd
import matplotlib.pyplot as plt
page_size = 10000
url = 'https://api.fis... | <python><pandas><dataframe><matplotlib> | 2023-10-29 01:56:37 | 2 | 9,709 | dharmatech |
77,381,677 | 13,078,279 | Why does plotly.Mesh3d refuse to plot a 3D function? | <p>I am attempting to plot the analytical t=0 solution to the 3D wave equation:</p>
<pre><code>import numpy as np
import plotly.graph_objects as go
f = lambda x, y, z: np.sin(x) * np.sin(y) * np.sin(z)
x = np.linspace(-5, 5)
y = np.linspace(-5, 5)
z = np.linspace(-5, 5)
Z = f(x, y, z)
fig = go.Figure(data=[go.Mesh3d(... | <python><plot><plotly> | 2023-10-29 00:43:13 | 0 | 416 | JS4137 |
77,381,592 | 1,081,297 | Local start and end of day in UTC | <p>I would like to find out what the start and end time of a specific day is expressed in UTC and in Python.</p>
<p>For instance:</p>
<ul>
<li>the current date and time is Sun 29 Oct 2023, 01:33:49 CEST (Central European Summer Time),</li>
<li>the day starts at Sun 29 Oct 2023, 00:00:00 CEST,</li>
<li>the day ends at S... | <python><datetime><timezone><python-datetime><pytz> | 2023-10-28 23:46:55 | 1 | 581 | Dieudonné |
77,381,318 | 6,111,772 | python csv writes too many decimals | <p>A well discussed problem, but could not find a suitable answer.
writing a float list of points (n,3) of 3D vectors to a file using code:</p>
<pre><code>...
with open(filename,"w") as f:
csvw=csv.writer(f,delimiter=";",quotechar='"')
for point in points:
csvw.writerow(point)
<... | <python><csv><digits> | 2023-10-28 21:36:43 | 1 | 441 | peets |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.