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 ⌀ |
|---|---|---|---|---|---|---|---|---|
75,530,801 | 1,580,469 | Efficient calculation of all one polynomial modulus | <p>The all one polynomial modulus is</p>
<p><code>sum(x**i for i in range(n)) % m</code></p>
<p>In my case <code>1 < x < m</code>, <code>0 < n < m</code> and <em>all</em> are integer. The sum can be simplified to <code>(x**n - 1) / (x - 1)</code>. Due to numerical issues integer division needs to be used fo... | <python><modulo> | 2023-02-22 09:41:53 | 0 | 396 | Christian |
75,530,640 | 10,829,044 | Pandas - split one row value and merge with multiple rows | <p>I have two dataframes like as below</p>
<pre><code>proj_df = pd.DataFrame({'reg_id':[1,2,3,4,5,6,7],
'partner': ['ABC_123','ABC_123','ABC_123','ABC_123','ABC_123','ABC_123','ABC_123'],
'part_no':['P123','P123','P123','P123','P123','P123','P123'],
... | <python><pandas><list><dataframe><group-by> | 2023-02-22 09:30:01 | 1 | 7,793 | The Great |
75,530,586 | 598,599 | Can environment markers be used for determining the Databricks Runtime | <p>We are creating a generic library in Python used by different (LTS) <a href="https://docs.databricks.com/release-notes/runtime/releases.html" rel="nofollow noreferrer">runtimes on Databricks</a> that is used in highly automated release pipelines. So we have not exact control over the libraries and dependencies that ... | <python><databricks> | 2023-02-22 09:25:53 | 1 | 7,490 | AutomatedChaos |
75,530,375 | 6,212,718 | Polars vs. Pandas: size and speed difference | <p>I have a <code>parquet</code> file (~1.5 GB) which I want to process with <code>polars</code>. The resulting dataframe has 250k rows and 10 columns. One column has large chunks of texts in it.</p>
<p>I have just started using polars, because I heard many good things about it. One of which is that it is significantly... | <python><pandas><dataframe><python-polars> | 2023-02-22 09:08:26 | 2 | 1,489 | FredMaster |
75,530,186 | 8,680,909 | Dataframe groupby condition with used column in groupby | <p>I want to use "group by" by two columns A, B. A column is categorical variable and B column's type is 'datetime64[ns]'. Value column C is float type.
I want to get a result of summarized value C but only Cs that groupbefore the date of column B.</p>
<p>Is there any ways to solve this problem with using agg... | <python><dataframe><group-by> | 2023-02-22 08:51:33 | 1 | 461 | johanna |
75,530,056 | 4,377,095 | in Pandas, append a new column of a row each time it has a duplicate ID | <p>assuming we have this table</p>
<pre><code>df = pd.DataFrame({'ID': [1, 2, 1, 4, 2, 6, 1], 'Name': ['led', 'peter', 'james', 'ellie', 'make', 'levi', 'kent'],
'food': ['apples', 'oranges', 'banana', 'carrots', 'carrots', 'mango', 'banana'],
'color': ['red', 'blue', 'pink', 'red... | <python><pandas> | 2023-02-22 08:39:51 | 1 | 537 | Led |
75,529,967 | 9,426,931 | Getting future contracts market cap data using python | <p>Im trying to calculate my portofolio's risk and i need to calculate the market cap. it seems yahoo finance info attribute no longer provides market cap. what should I do?</p>
| <python><yfinance><pandas-datareader> | 2023-02-22 08:30:03 | 1 | 564 | Ali Sadeghi Aghili |
75,529,760 | 7,583,699 | How to merge sub-matrices of high-dimensional matrices under the condition of ensuring the relative position of sub-matrices? | <p>If I have a tensort x with shape [z, d, d], which indicates a series image frames just like video data. Let pz=z**0.5 and let x = x.view(pz, pz, d, d]. Then we can get a grid of images with grid size of pz*pz, and each image has a shape of [d, d]. Now, I want get a matrix or tensor with shape of [1, 1, p*d, p*d], an... | <python><machine-learning><matrix><deep-learning><pytorch> | 2023-02-22 08:05:48 | 2 | 303 | Skipper |
75,529,554 | 1,581,090 | How to properly define a windows foldername to be used with python? | <p>I have the following small code snippet in python 3.10 on windows 10 powershell</p>
<pre><code>win_folder = b"C:\Program Files (x86)\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin"
os.chdir(win_folder)
</code></pre>
<p>but when running this code I always get an error</p>
<pre><code>FileNotFoundError:... | <python><windows><encoding> | 2023-02-22 07:45:06 | 2 | 45,023 | Alex |
75,529,522 | 20,770,190 | Why I cannot use flask.request.headers as a hinting types? | <p>I'm going to use <code>flask.request.headers</code> as a hinting types in input parameter of a method, but the following error is raised:</p>
<pre><code>...
raise RuntimeError(unbound_message) from None
RuntimeError: Working outside of request context.
This typically means that you attempted to use functionality th... | <python><flask> | 2023-02-22 07:41:30 | 1 | 301 | Benjamin Geoffrey |
75,529,345 | 2,170,269 | Is pyright incorrectly generalising types? | <p>I'm playing with some code that statically checks dimensions on linear algebra. I have managed to encode dimensions in a way that <code>mypy</code> is happy to check, but <code>pyright</code> isn't quite as happy about it.</p>
<p>A simplified version looks like this:</p>
<pre class="lang-py prettyprint-override"><co... | <python><python-typing><mypy><pyright> | 2023-02-22 07:21:20 | 0 | 1,844 | Thomas Mailund |
75,529,195 | 12,242,085 | How to remove all special characters in column names by regex but stay ":" in re in Pandas Python? | <p>I have Pandas DataFrame in Python like below:</p>
<pre><code>COL1 | XX:\x84Â\x82Ă\x82Â\ | \x84Â\x82Ă\PPx82Â\
-------|----------------------|--------------------
111 | ABC | X
222 | CCC | Y
333 | DDD | XX
My code and current output:
</code></pre>
<p>By u... | <python><pandas><regex><dataframe> | 2023-02-22 06:58:26 | 1 | 2,350 | dingaro |
75,529,181 | 18,756,733 | Plotly subplot titles not showing correctly | <p>I created Plotly subplots figure using for loop. Here is the code and link to the HTML file(download to view the file):</p>
<pre><code>fig=make_subplots(rows=6,cols=2,subplot_titles=sorted(df['Region'].unique()))
for i,region in enumerate(sorted(df['Region'].unique()),start=1):
data=df.query('Region==@region').s... | <python><plotly><subplot> | 2023-02-22 06:56:33 | 1 | 426 | beridzeg45 |
75,529,064 | 8,229,534 | How to load multiple partition parquet files from GCS into pandas dataframe? | <p>I am trying to read multiple parquet files stored as partitions from google cloud storage and read them as 1 single pandas data frame. As an example, here is the folder structure at <code>gs://path/to/storage/folder/</code></p>
<p><a href="https://i.sstatic.net/OGeU3.png" rel="nofollow noreferrer"><img src="https://... | <python><pandas><google-cloud-storage> | 2023-02-22 06:41:15 | 1 | 1,973 | Regressor |
75,528,849 | 5,924,264 | ImportError: cannot import name when using Jenkins CI but can't reproduce locally | <pre><code>ImportError: cannot import name CustomUtils
</code></pre>
<p>The import line is:</p>
<pre><code>from root.src.custom import Customutils
</code></pre>
<p>This is the error I get at my work's codebase for a pull request that I submitted. However, this error seems to only show up when using our unit test suite ... | <python><unit-testing><jenkins><continuous-integration><bazel> | 2023-02-22 06:10:57 | 0 | 2,502 | roulette01 |
75,528,839 | 12,492,675 | How to fetch and filter data retrieved from Yahooquery? | <p>I am trying to retrieve the quarterly earnings of some companies using YahooQuery and I've been able to fetch the data for the whole year but I want to filter this data to show only the specific quarter's results. Furthermore I want to export this data to an Excel sheet and save it there for all the companies.</p>
<... | <python><stock><yahoo-finance> | 2023-02-22 06:09:35 | 1 | 1,326 | Simran Aswani |
75,528,741 | 4,616,611 | Create new label column based on dictionary key value mapping in a DataFrame | <p>Given a dictionary <code>d={1: [0.01, 0.02], 2:[1, 2], 3:[10, 20]}</code> and column in a data frame that contains all values in <code>d</code> e.g., <code>df['x'] = [0.01, 0.02, 1, 2, 10, 20]</code>, I'm looking to create a new column in my data frame that maps each value in col <code>x</code> to it's corresponding... | <python><pandas><dataframe><numpy> | 2023-02-22 05:53:04 | 2 | 1,669 | Teodorico Levoff |
75,528,577 | 5,928,682 | Multiline string substitution in Python | <p>I am trying this out:</p>
<pre><code>account = "11111111111"
tenant_name= "Demo"
project_name= "demo"
sns_access_policy = """{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "0",
"Effect": ... | <python> | 2023-02-22 05:24:56 | 1 | 677 | Sumanth Shetty |
75,528,573 | 14,012,607 | Time complexity of a combination function | <p>I have this function that creates pairs from a list of numbers. We know that there will be a total of n choose 2 iterations every time. So does that make the time complexity O(nC2)?
or is it O(n^2)?</p>
<p>If it is O(n^2) why is it O(n^2)? The function does not iterate that many times and it never will.</p>
<pre>... | <python><python-3.x><big-o><combinations> | 2023-02-22 05:24:18 | 2 | 318 | Salty Sodiums |
75,528,465 | 14,808,637 | How to Print os.environ["CUDA_VISIBLE_DEVICES"] = "1" | <p>My machine has three GPUs with indexes <code>0, 1, and 2.</code> To assign my program to a specific GPU, I used the lines below:</p>
<pre><code>import os
os.environ["CUDA_VISIBLE_DEVICES"] = "1"
</code></pre>
<p>How can I print the GPU index on which my program is executing?</p>
| <python><python-3.x><pytorch> | 2023-02-22 05:04:56 | 0 | 774 | Ahmad |
75,528,463 | 10,339,757 | Apply expanding window on subsections of dataframe | <p>I have a dataframe like this</p>
<pre><code> key1 day feat
0 a 1 None
1 a 2 A
2 a 3 None
3 a 4 A
4 b 1 A
5 b 2 None
6 b 3 None
7 b 4 A
</code></pre>
<p>I would like the apply an expanding window with the count function over the feat column but ap... | <python><python-3.x><pandas><windowing> | 2023-02-22 05:04:04 | 1 | 371 | thefrollickingnerd |
75,528,445 | 2,369,000 | Idiomatic way to get array of column values in a pandas dataframe | <p>I have a dataframe where I want to get a single array of all of the values in the 'a' column, which is part of a multi-index dataframe. The code below works, but it is hard to read, write, and think about. Is there a more idiomatic way to express the same idea?</p>
<pre><code>import numpy as np
import pandas as pd
... | <python><pandas><multi-index> | 2023-02-22 05:02:20 | 2 | 461 | HAL |
75,528,441 | 1,870,832 | Trouble parsing interview transcript (Q&As) where questioner name is sometimes redacted | <p>I have the following python script I wrote as a reproducible example of my current pdf-parsing hangup. It:</p>
<ul>
<li>downloads a pdf transcript from the web (Cassidy Hutchinson's 9/14/2022 interview transcript with the J6C)</li>
<li>reads/OCRs that pdf to text</li>
<li>attempts to split that text into the series ... | <python><regex><pdf><nlp><pdfplumber> | 2023-02-22 05:01:08 | 1 | 9,136 | Max Power |
75,528,386 | 13,874,745 | How can I make the output of annotate() the same as print() in matplotlib? | <p>I found that when the <strong>text contains a lot of spaces</strong>, the output of <code>print()</code> will be different from the output of <code>plt.annotate()</code></p>
<p>My question is : <strong>How can I make the output of annotate() the same as print() in matplotlib?</strong></p>
<p>I use the following code... | <python><matplotlib> | 2023-02-22 04:49:22 | 1 | 451 | theabc50111 |
75,528,349 | 5,976,033 | How to connect an Azure Function in tenant1 with an Azure SQL database in tenant2? | <p>In <code>tenant1</code> Azure Function, there is a Python function to connect to an Azure SQL database:</p>
<pre><code>import aioodbc
import logging
async def create_db_connection(SERVER_NAME: str, DATABASE_NAME: str, USERNAME: str, PASSWORD: str) -> aioodbc.Connection:
CONNECTION_STRING = (
'Drive... | <python><azure-functions><azure-sql-database> | 2023-02-22 04:41:55 | 1 | 4,456 | SeaDude |
75,528,344 | 1,532,974 | How to mount a custom adapter by domain (wildcarding subdomains) with python requests? | <p>This is a <a href="https://stackoverflow.com/questions/74991540/python-requests-set-proxy-only-for-specific-domain">similar question</a> but not quite the same.</p>
<p>There are some situations in which I need to supply default values for certain arguments like <code>verify</code> (e.g. a custom CA/SSL chain) for sp... | <python><python-requests> | 2023-02-22 04:41:23 | 1 | 621 | kratsg |
75,528,184 | 13,142,245 | How to use class methods in Multiprocessing Pool in Python? | <p>I present a simplistic toy problem but the underlying problem is how to use class methods in multiprocessing Pool in Python?</p>
<pre class="lang-py prettyprint-override"><code>class Var:
def __init__(self,val):
self.val = val
def increment(self):
self.val +=1
arr = [V... | <python><oop><multiprocessing> | 2023-02-22 04:07:39 | 1 | 1,238 | jbuddy_13 |
75,528,043 | 3,713,236 | Reordering categorical variables using a specified ordering? | <p>I have a <code>X_train</code> dataframe. One of the columns <code>locale</code> has the unique values: <code>['Regional', 'Local', 'National'].</code></p>
<p>I am trying to make this column into an Ordered Categorical variable, with the correct order being from smallest to largest: <code>['Local', 'Regional', 'Natio... | <python><pandas><dataframe><categorical-data><label-encoding> | 2023-02-22 03:43:24 | 1 | 9,075 | Katsu |
75,528,024 | 1,658,617 | How do I compile a Python zipapp as optimized? | <p>Assume the following code under <code>src/app.py</code>:</p>
<pre><code>def main():
assert False
if __name__ == "__main__":
main()
</code></pre>
<p>Running this using <code>python -o src/app.py</code> will work fine as the assertions are disabled.</p>
<p>How can I package a <a href="https://docs.p... | <python><zipapp> | 2023-02-22 03:38:37 | 1 | 27,490 | Bharel |
75,527,966 | 1,171,550 | ruamel.yaml loses anchor and skips aliases after the first alias on the same level when dumping | <p>Given this YAML:</p>
<pre class="lang-yaml prettyprint-override"><code>---
sp-database: &sp-database
DATABASE_NAME: blah
DATABASE_PORT: 5432
DATABASE_SCHEMA: public
DATABASE_USERNAME: foo
DATABASE_DRIVER: bar
DATABASE_TYPE: pg
rabbit: &rabbit
RABBIT_PORT: 5672
RABBIT_USERNAME: foo
sp-env: &... | <python><python-3.x><yaml><ruamel.yaml> | 2023-02-22 03:23:27 | 1 | 1,428 | Recur |
75,527,955 | 2,998,077 | GroupBy to count number of overlap substrings in rows | <p>Dataframe below that I want to compare the sub-strings in rows under GroupBy.</p>
<p>For example, in Project_A, it's to compare Project_A's first row ['William', 'Oliver', 'Elijah', 'Liam'] with Project_A's second row [ 'James', 'Mason', 'Elijah', 'Oliver']</p>
<p>Ideal result as:</p>
<p><a href="https://i.sstatic... | <python><pandas><dataframe> | 2023-02-22 03:20:00 | 2 | 9,496 | Mark K |
75,527,938 | 7,984,318 | matplotlib in vs studio code can't update plot | <p>I'm using matplotlib in vs studio code:</p>
<pre><code>from matplotlib import pyplot as plt
for i in [1,2,3]:
plt.figure(figsize=(15, 6))
plt.cla()
env.render_all()
plt.show()
time.sleep(5)
</code></pre>
<p>It will pop out an individual window besides the vs studio code window ,and only... | <python><matplotlib><visual-studio-code><plot> | 2023-02-22 03:16:24 | 1 | 4,094 | William |
75,527,887 | 13,142,245 | How to use Multiprocessing Pool on a dictionary input in Python? | <p>My goal is to to use map reduce aka Multiprocessing pool on a python dictionary. I would like it to map key,value pairs to different cores then aggregate result as a dictionary.</p>
<pre class="lang-py prettyprint-override"><code>from multiprocessing.pool import Pool
elems = {i:i for i in range(1_000_000)}
def func... | <python><dictionary><multiprocessing> | 2023-02-22 03:05:33 | 1 | 1,238 | jbuddy_13 |
75,527,883 | 2,882,380 | How to add " and " around a number | <p>I use Python to create a text file, which is fed into a calculation APP. Due to the setting up of the calculation APP (which I cannot change), it persists that a number must be wrapped by double quote.</p>
<p>For example, when I open an existing text file used in the calculation APP from Notepad, I can see <code>&qu... | <python><pandas><csv><double-quotes> | 2023-02-22 03:04:49 | 1 | 1,231 | LaTeXFan |
75,527,813 | 14,311,637 | Difficulty in installing rasterio | <p>I need to clip a raster file using a shape file. I know the code of doing that using rasterio. But I cannot install rasterio.</p>
<p>I tried:</p>
<pre><code>conda install rasterio gdal=2 -y
</code></pre>
<p>but it shows installing since 3 hours.</p>
<p>is there any other package that can be used for the same purpose... | <python><windows> | 2023-02-22 02:50:41 | 0 | 377 | Jui Sen |
75,527,763 | 12,319,746 | Deploying python script in Azure | <p>I have a python script which is making around 10,000 API calls, and sending the data from these calls to an SQL DB. It also needs to read/write from 2 text files and this programme needs to run continiously, forever. Is there a way to deploy this in Azure in anything else than a Virtual Machine without causing a sig... | <python><azure> | 2023-02-22 02:39:33 | 1 | 2,247 | Abhishek Rai |
75,527,619 | 1,187,968 | Python/Experta Rule engine not running as expect | <p>I have the following code, and the Experta engine gives unexpected output: <code>None</code>. Is the <code>P</code> predicate function applied correctly?</p>
<pre><code>from experta import Fact, KnowledgeEngine, L, AS, Rule, P, AND
class QuoteFact(Fact):
"""Info about the traffic light."&q... | <python><rule-engine><experta> | 2023-02-22 02:00:50 | 1 | 8,146 | user1187968 |
75,527,554 | 1,293,778 | Error adding item to Azure Storage Queue from Python | <p>Have a (so far) very simple Azure Function in Python. Trying to use Azure Queues for the first time. Modeling off of <a href="https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-storage-queue-output?tabs=in-process%2Cextensionv5&pivots=programming-language-python" rel="nofollow noreferrer"... | <python><azure><azure-storage-queues> | 2023-02-22 01:46:46 | 1 | 361 | Roger Asbury |
75,527,408 | 411,094 | Call Github Actions in CookieCutter template | <p>I am building a template repo that uses <a href="https://github.com/cookiecutter/cookiecutter" rel="nofollow noreferrer">CookieCutter</a>. The template itself will contain github action files that execute the tests in the template.</p>
<p>When I make changes to the template itself, in the PR, I want to instantiate t... | <python><github><github-actions><cookiecutter> | 2023-02-22 01:13:00 | 0 | 1,271 | josh |
75,527,284 | 5,526,682 | pandas filter rows based on row 1 column B equals row 2 column A and so forth | <p>I have a problem that I'm trying to figure out how to accomplish.
I have a dataframe with multiple columns containing names and hrs.</p>
<pre><code>d = {'ID': [1, 2,3,4,5,6], 'uName': ['Mark', 'Joe', 'Patty', 'Mary', 'Ted', 'Sam'], 'sName': ['Patty','Mary', 'Sam','Sally','Tony','Bob'], 'hrs': [20, 16,35,18,15,21], '... | <python><pandas><networkx> | 2023-02-22 00:46:24 | 2 | 463 | Messak |
75,527,221 | 13,178,155 | How to pass a variable through Javascript to PyQt5 Python script? | <p>I'm currently building a little GUI using PyQt5 and some html/js scripts that have already been built by someone else for a previous project, and wondering if anyone might be able to help me.</p>
<p>I'm comfortable working in python, but my limited knowledge of html, js and jquery are really making this confusing.</... | <javascript><python><html><jquery><pyqt5> | 2023-02-22 00:33:12 | 0 | 417 | Jaimee-lee Lincoln |
75,527,195 | 2,334,092 | Pandas : Cannot subtract dataframes | <p>I have 2 simple data frames</p>
<p>df1</p>
<pre><code> colA colB
0 e5b1b9fc-ade9-4501-a66b-ef2ecd57483e.d9967f258... 2ZWR52QYZ86H
1 8d127d82-cfa4-421f-9081-cf35132b8248.f0865b3b9... 61RPLMR5BFFT
2 005c8e84-98b4-402d-a24e-6a63edad0598.16b6f0f9f... 7L256IQTB1M1
3... | <python><pandas><dataframe><subtraction> | 2023-02-22 00:27:32 | 1 | 8,038 | AbtPst |
75,527,171 | 962,891 | How to route I/O to console AND logfile using clipspy | <p>I am using <a href="https://clipspy.readthedocs.io/en/latest/" rel="nofollow noreferrer">clipspy v1.0.0</a> and Python 3.10 on Ubuntu 22.0.4 LTS.</p>
<p>I am trying to get commands from CLIPS rules (e.g. <code>print t 'WARN: Listen up, maggots...'</code>) to print to the console by calling my registered function, wh... | <python><clips><clipspy> | 2023-02-22 00:23:13 | 1 | 68,926 | Homunculus Reticulli |
75,527,129 | 16,462,878 | Substitute (scalar) multiples of a sub-expression | <p>I need to identify and replace <strong>multiple</strong> of a sub-expression from an expression:</p>
<p>eliminate <em>1<em>x - 3</em>exp(x)</em> from <em>x**2 - 3<em>x + 6</em>exp(x)</em> to give either <em>x**2 - x</em> or <em>x**2 - 3exp(x)</em>.</p>
<p>I haven't found yet an elegant and correct way to face the pr... | <python><sympy><substitution> | 2023-02-22 00:14:19 | 0 | 5,264 | cards |
75,527,103 | 20,898,396 | Calling functions on arrays moved to GPU with Numba | <p>I didn't think we could print anything from the GPU since calling <code>print</code> inside a <code>@cuda.jit</code> function doesn't work, but then I tried calling <code>A.shape</code> to see what would happen.</p>
<pre><code>import numpy as np
from numba import cuda
A = np.random.randn(1000, 1000)
A_gpu = cuda.t... | <python><numpy><cuda><numba> | 2023-02-22 00:08:16 | 1 | 927 | BPDev |
75,527,087 | 9,105,621 | group plotly y-axis labels, but keep individual data lines | <p>I have a flask function that creates a timeline chart. I want to group the y-axis labels, but keep the individual data lines. How can I achieve this?</p>
<p>Here is my function:</p>
<pre><code>def drawpipelinechart(ta='All'):
table = pipeline_table().pipe(calc_fpfv_countdown)
cols = [
'ID',
'... | <python><flask><plotly> | 2023-02-22 00:04:44 | 1 | 556 | Mike Mann |
75,527,077 | 5,651,575 | How to filter Pandas dataframe based on grouped multiple column conditions? | <p>Given the following dataframe:</p>
<pre><code>currency index product price
AUD A STOCK $10.00
AUD A BOND $10.00
AUD B OPTION $11.00
AUD B STOCK $12.00
USD A STOCK $14.00
USD A BOND $11.00
USD A OPTION $19.00
USD B BOND $12.00
</... | <python><pandas><dataframe> | 2023-02-22 00:02:53 | 1 | 617 | youngdev |
75,527,054 | 2,334,092 | Python3 : How to spawn jobs in parallel | <p>I am pretty new to multithreading and would like to explore. I have a json file, that provides some config. Based on this, i need to kick off some processing. Here is the config</p>
<pre><code>{
"job1":{
"param1":"val1",
"param2":"val2"
},
... | <python><python-3.x><multithreading><python-multithreading> | 2023-02-21 23:58:43 | 2 | 8,038 | AbtPst |
75,527,045 | 3,406,100 | Issues connecting to GEE from R and connecting to Chrome using RSelenium | <p>I recently tried configuring my R environment to connect to GEE directly from my desktop. I have certain consistent issues and don't know why. I could connect to a website through Rselenium before I started tampering with stuff to get rgee to connect. What could be wrong and how do I fix it? Even when I set the corr... | <python><r><python-3.x><rselenium><rgee> | 2023-02-21 23:56:57 | 0 | 619 | Joke O. |
75,526,957 | 12,461,032 | Seaborn boxplot legend ignoring colors | <p>I have a boxplot in Seaborn/Matplotlib for multiple categorical data:</p>
<p><a href="https://i.sstatic.net/frqIY.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/frqIY.png" alt="plot" /></a></p>
<p>The problem is the legend part does not match with the plot color.</p>
<pre><code>data = pd.DataFrame.fr... | <python><matplotlib><seaborn><legend><boxplot> | 2023-02-21 23:42:02 | 0 | 472 | m0ss |
75,526,939 | 13,142,245 | How to pass an object in Python with the self keyword? | <p>Is it possible to pass an object in Python such that the only reference to the object is the self keyword?</p>
<pre class="lang-py prettyprint-override"><code>class A:
def __init__(self):
self.val = 'A'
def wave(self,friend):
friend.make_friend(self)
class B:
... | <python> | 2023-02-21 23:37:04 | 4 | 1,238 | jbuddy_13 |
75,526,917 | 687,739 | Traversing a directory with Python's glob | <p>I need to match all <code>*.csv.gz</code> files in a bunch of directories using <code>glob</code>.</p>
<p>My directory structure looks like this:</p>
<pre><code>data
/nasdaq100
/2015
/20150102
/A.csv.gz
...
/Z.csv.gz
...
/20161201
...
/2016
...
acquisit... | <python><glob> | 2023-02-21 23:31:59 | 0 | 15,646 | Jason Strimpel |
75,526,789 | 12,369,606 | Pathlib: change end of file name | <p>I am trying to iterate through a directory, do something to each of the files and then save a new file with a different name similar to the question <a href="https://stackoverflow.com/questions/68972637/using-pathlib-instead-of-os-for-identifying-file-and-changing">here</a>, but I am looking for a solution using pat... | <python><pathlib> | 2023-02-21 23:09:50 | 2 | 504 | keenan |
75,526,750 | 2,474,876 | nlp translation preserving emojis | <p>Is there a way to prevent NLP translations from dropping emojis (or specific out of vocabulary tokens for that matter) when using the <a href="https://huggingface.co/Helsinki-NLP/opus-mt-ROMANCE-en" rel="nofollow noreferrer">huggingface--Helsinki-NLP--opus-mt-ROMANCE-en</a> models? Desired behavior:</p>
<p>"<co... | <python><translation><emoji><huggingface> | 2023-02-21 23:03:52 | 0 | 417 | eliangius |
75,526,647 | 10,500,424 | Plotly Cytoscape: remove edge functionality to increase callback performance | <p>I have a performance issue with Plotly Cytoscape. I understand that nodes and edges can be bound to callbacks to provide functionality (such as changing color, displaying labels, etc.).</p>
<p>Lag in callback performance in the documentation's <a href="https://dash.plotly.com/cytoscape/events" rel="nofollow noreferr... | <javascript><python><graph><plotly><cytoscape> | 2023-02-21 22:48:24 | 0 | 1,856 | irahorecka |
75,526,623 | 312,089 | Django - How to filter a Many-to-Many-to-Many relantionship | <p>I have 3 models (<code>User</code> is Django's built in user-model):</p>
<pre><code>class User(AbstractUser):
pass
class Listing(models.Model):
name = models.CharField('Listing Name', max_length=64)
description = models.TextField()
owner = models.ForeignKey(User, related_name="listings", o... | <python><django><django-models><many-to-many> | 2023-02-21 22:45:04 | 0 | 677 | Wavesailor |
75,526,595 | 10,743,830 | apply a function on a dataframe in a rolling fashion using values from two columns and previous rows | <p>Let's say I have the following dataframe (which in reality is much bigger hence the method should be fast):</p>
<pre><code>df = pd.DataFrame({"distance1": [101, 102, 103], "distance2":[12, 33, 44]})
distance1 distance2
0 12 101
1 33 102
2 44 103
</code></... | <python><pandas><numpy><apply> | 2023-02-21 22:41:46 | 2 | 352 | Noah Weber |
75,526,285 | 743,188 | python ABC: forbid extra methods on derived classes? | <p>Is there a way to prohibit derived classes from abc.ABC from adding methods if they implement an ABC?</p>
<p>Like so:</p>
<pre><code>from abc import ABC, abstractmethod
class Foo(ABC):
"""base class for all Foos"""
def __init__(self, sec_type: str, metric: str) -> None:
... | <python><abstract-class> | 2023-02-21 21:57:37 | 0 | 13,802 | Tommy |
75,526,276 | 11,036,109 | Pandas Dataframe: Get and Edit all values in a column containing substring | <p>Lets say I have a dataframe, called stores, like this one:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>country</th>
<th>store_name</th>
</tr>
</thead>
<tbody>
<tr>
<td>FR</td>
<td>my new tmp</td>
</tr>
<tr>
<td>ES</td>
<td>this Tmp is new</td>
</tr>
<tr>
<td>FR</td>
<td>walmart</td>
... | <python><pandas><dataframe> | 2023-02-21 21:56:10 | 2 | 411 | Alain |
75,526,264 | 1,977,508 | Using drag and drop files or file picker with CustomTkinter | <p>I have recently decided to start learning Python and while doing several small projects as a hands-on approach, i discovered the <code>customtkinter</code> library (<a href="https://github.com/TomSchimansky/CustomTkinter" rel="nofollow noreferrer">https://github.com/TomSchimansky/CustomTkinter</a>) for more modern l... | <python><tkinter><drag-and-drop><customtkinter> | 2023-02-21 21:54:35 | 2 | 539 | Furious Gamer |
75,526,261 | 3,798,713 | How to download files from GCS cloud bucket which has special characters in their file names using python client api? | <p>I am using Windows and I am able to download GCS files which don't have special characters.
I used the following <a href="https://stackoverflow.com/questions/51203883/download-multiple-file-from-google-cloud-storage-using-python">link</a> to download the files.
However, I am unable to download files which have speci... | <python><google-cloud-platform><google-cloud-storage><google-api-python-client> | 2023-02-21 21:54:05 | 1 | 446 | Suj |
75,526,218 | 1,857,373 | X not have valid feature names, reshape warning, X is 2D, Ya is 1D | <p><strong>PROBLEM</strong>
Issue is not valid names in X features: "UserWarning: X does not have valid feature names, but LinearRegression was fitted with feature names"</p>
<p>X is 2D, Ya is 1D response variable.</p>
<p>And ValueError on</p>
<pre><code>ValueError Traceback (mo... | <python><arrays><linear-regression> | 2023-02-21 21:47:16 | 0 | 449 | Data Science Analytics Manager |
75,526,202 | 4,629,916 | Can I use python Template to recursively use a dictionary as its own template to replace values in the source dictionary | <p>I would like to use a dictionary as its own template.</p>
<p>My attempt is below. Actual I used AI to get that function but AI was unable to
generalize.</p>
<pre><code>def recursive_template(d, **kwargs):
d.update(kwargs)
for k, v in d.items():
if isinstance(v, str):
try:
... | <python><templates> | 2023-02-21 21:43:37 | 1 | 1,522 | Harlan Nelson |
75,526,165 | 2,167,717 | How can I calculate session IDs from event data, assigning a new ID every time there was no event for 15 minutes? | <p>I have a huge file with events tracked a website. The data contains, among others, the <code>user_id</code> and the <code>time_stamp</code> of events (clicked on a link, viewed an image, etc.). Here is a simplified example:</p>
<pre><code>#%%
import pandas as pd
# make a dataframe
df = pd.DataFrame([['123', 1],
... | <python><pandas><dataframe><group-by> | 2023-02-21 21:39:43 | 1 | 365 | Maxim Moloshenko |
75,526,099 | 1,398,841 | How to make a Django UniqueConstraint that checks fields in a position-independant way? | <p>I have a Django <code>Model</code> where I'd like to ensure that no duplicate <code>Edge</code> exists where the same pair of <code>Node</code>s appear as <code>node_a</code> or <code>node_b</code>, in either order.</p>
<pre class="lang-py prettyprint-override"><code>class Edge(models.Model):
project = models.Fo... | <python><django><django-models><django-validation><django-constraints> | 2023-02-21 21:31:29 | 0 | 9,369 | johnthagen |
75,526,087 | 11,039,117 | pybind11 cannot import templates | <p>I tried to use templates in pybind11 <a href="https://github.com/bast/pybind11-demo" rel="nofollow noreferrer">based on this demo</a>. Error</p>
<pre><code>>>> from example import add
>>> add(2,3)
5L
>>> from example import myadd
Traceback (most recent call last):
File "<stdin>... | <python><c++><pybind11> | 2023-02-21 21:29:39 | 1 | 758 | Vladislav Kogan |
75,525,825 | 1,232,087 | pyspark - select() function ignoring if statement | <p>Thanks to user @DerekO, <a href="https://stackoverflow.com/a/75487254/1232087">his</a> following example is correctly getting max lengths of only <code>varchar</code> columns. But when I use the same example with <code>df</code> loaded with a <code>csv</code> file it ignores the <code>if</code> statement and calcula... | <python><azure><pyspark><azure-databricks><azure-storage-account> | 2023-02-21 20:56:17 | 1 | 24,239 | nam |
75,525,731 | 4,070,660 | Fix JSON with unescaped double quotes in Python | <p>Imagine these samples:</p>
<pre><code>["And he said "Hello world" and went away"]
</code></pre>
<p>Or:</p>
<pre><code>{"key": "value " with quote in the middle"}
</code></pre>
<p>Or</p>
<pre><code>["invalid " string", "valid string"]
</code></pre>... | <python><json><parsing><jsonparser> | 2023-02-21 20:45:25 | 2 | 1,512 | K.H. |
75,525,721 | 4,181,335 | Determine Planet Conjunction Times per Year using Skyfield & Scipy | <p>Expanding on the solution provided here:
<a href="https://stackoverflow.com/questions/43024371/determine-coordinates-at-conjunction-times/48256511#48256511">Determine coordinates at conjunction times</a>
... I coded the following to give me all the conjunctions of 5 planets (and the sun) for any given year (within t... | <python><scipy-optimize><skyfield> | 2023-02-21 20:44:04 | 1 | 343 | Aendie |
75,525,564 | 9,544,417 | Attaching debugger to nemo python | <p>Under Linux Mint 21, I am trying to debug python script embedded in <code>nemo</code> (for example, like the <code>nemo-terminal</code> package which is written in Python). I followed instruction from <a href="https://github.com/microsoft/debugpy" rel="nofollow noreferrer">debugpy doc</a> and other SO answers <a hre... | <python><debugging><vscode-debugger><linux-mint> | 2023-02-21 20:23:59 | 1 | 448 | sayanel |
75,525,375 | 10,007,302 | Openpyxl causing Excel to repair and remove datavalidation when I try and add DV values to a cell using string formatting, but not if I specify values | <p>I have a dataframe in pandas that looks like the below with 3 columns. Possible Matches will have one name if the Match Score is 100 and multiple names if it's not. I'm trying to output this file to excel using openpyxl.</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>Index</th>
<th>Trac... | <python><excel><pandas><openpyxl> | 2023-02-21 20:03:20 | 1 | 1,281 | novawaly |
75,525,363 | 12,131,472 | parse a quite nested Json file with Pandas/Python, the json thing is now in one column of a dataframe | <p>I have retrieved data I need in one dataframe, one of the column has this list of dict</p>
<pre><code>[{'date': '2023-02-03T00:00:00', 'groups': [{'periodType': 'm',
'projections': [{'identifier': 'TD3BALMO', 'period': 'Feb 23', 'value': 54.621, 'validFrom': '2023-02-01... | <python><json><pandas><json-normalize> | 2023-02-21 20:02:12 | 1 | 447 | neutralname |
75,525,305 | 5,924,264 | AttributeError: 'module' object has no attribute while using absolute imports | <pre><code>
[2023-02-21T18:51:30.894Z] _ ERROR collecting path/to/file/tests/test.py _
[2023-02-21T18:51:30.894Z] path/to/file/tests/test.py:12: in <module>
[2023-02-21T18:51:30.894Z] import path.to.file.tests.utils as utils
[2023-02-21T18:51:30.894Z] path/to/file/tests/utils.py:9: in <module>
[2023... | <python><circular-dependency> | 2023-02-21 19:56:54 | 0 | 2,502 | roulette01 |
75,525,293 | 8,406,122 | Seeing the progress of my code in real time in jupyter | <p>I have this code which I am running on jupyter notebook</p>
<pre><code>with open('tracker.txt', 'w+') as p:
for i in range(1,100000000):
p.write("\nValue is: "+str(i) )
</code></pre>
<p>while running this code when I am opening the <code>tracker.txt</code> file it is showing my blank, and only ... | <python><jupyter> | 2023-02-21 19:55:45 | 1 | 377 | Turing101 |
75,525,269 | 1,136,015 | When kafka consumer connected to a broker by domain name, if the ip changed after broker crash, will the kafka consumer reconnect? | <p>My kafka consumer is connected to a cluster of brokers. There is a domain name server in between. Each broker has a domain name associated with an IP address.
Problem is, the IPs are not static and for some reason, I have to restart the broker.
The consumers are configured to reconnect.
My question is when it will t... | <python><kafka-python> | 2023-02-21 19:53:07 | 2 | 927 | sovon |
75,525,102 | 15,923,186 | SerDe problem with django rest framework and foreign key | <p><strong>Context:</strong></p>
<p>I have written a simple django rest framework app as BE and a react JS app as FE. The db is SQLite and it's gonna stay that way, since there are only 2 simple models and the number of users will be quite limited as well.
For the sake of the example let's assume there is only one team... | <python><python-3.x><django><django-rest-framework><django-serializer> | 2023-02-21 19:35:19 | 2 | 1,245 | Gameplay |
75,525,016 | 5,698,673 | How to pytest monkeypatch a mixin class in python 3.x | <p>I need to monkeypatch a mixin class inherited by other classes using pytest, python 3.x, I have this example:</p>
<pre><code>class A:
@classmethod
def foo(cls) -> str:
# do some database operation
return "foo"
class B(A):
pass
</code></pre>
<p>I initially thought of monkeypatching the met... | <python><python-3.x><pytest> | 2023-02-21 19:24:35 | 1 | 1,073 | Moad Ennagi |
75,524,792 | 4,382,391 | Error when importing flask_socket-io : AttributeError: module 'collections' has no attribute 'MutableMapping' | <p>With a python file that is just:</p>
<pre><code>from flask_socketio import SocketIO
</code></pre>
<p>I get the error:</p>
<pre><code>> python .\app.py
Traceback (most recent call last):
File "C:\{...}\server\app.py", line 127, in <module>
from flask_socketio import SocketIO
File "C:\{... | <python><flask-socketio><eventlet> | 2023-02-21 18:57:21 | 1 | 1,070 | Null Salad |
75,524,716 | 7,800,760 | How to store Stanza Span in MongoDB collection? | <p>I am trying to add a list of dictionaries (whose name is <code>stanzanerlist</code>) like the following:</p>
<pre class="lang-python prettyprint-override"><code>stanzanerlist = [{
"text": "Harry Potter",
"type": "PER",
"start_char": 141,
"end_char":... | <python><mongodb><pymongo><stanford-nlp> | 2023-02-21 18:49:25 | 1 | 1,231 | Robert Alexander |
75,524,656 | 4,837,637 | Flask Rest Api error SQLAlchemyAutoSchema | <p>i have deployed my flask rest api app on cloud run, using this dockerfile:</p>
<pre><code># Python image to use.
FROM python:3.10-alpine
# Set the working directory to /app
WORKDIR /app
# copy the requirements file used for dependencies
#COPY requirements.txt .
# Copy the rest of the working directory contents int... | <python><sqlalchemy><marshmallow><marshmallow-sqlalchemy> | 2023-02-21 18:42:43 | 1 | 415 | dev_ |
75,524,624 | 7,544,279 | How to solve decimal.InvalidOperation: [<class 'decimal.InvalidOperation'>] occurred due to large input number? | <p>I am having an issue with handling large integers. I am trying to implement threshold secret sharing scheme by following the article in the <a href="https://www.geeksforgeeks.org/implementing-shamirs-secret-sharing-scheme-in-python/" rel="nofollow noreferrer">link</a>. I have modified the driver code to the followin... | <python><cryptography><integer><secret-key><largenumber> | 2023-02-21 18:39:40 | 1 | 495 | Purushotam Sangroula |
75,524,171 | 550,705 | Python >= 3.8 container on GCP (Vertex AI Workbench) | <p>Problem: Python 3.7 is outdated, yet prebuilt containers for Vertex AI Workbench are all are built w/ 3.7.</p>
<p>Is there a way to modify (e.g. rebuild the base containers that work w/ Vertex AI workbench), e.g. perhaps by setting an ARG command to rebuild a working base container with Python >= 3.8?</p>
<p>Alte... | <python><google-cloud-platform><jupyter-lab><google-cloud-vertex-ai><google-dl-platform> | 2023-02-21 17:53:28 | 2 | 763 | Brian Bien |
75,524,091 | 5,695,336 | Catch error inside Firestore on_snapshot from the outer scope | <p>I'm writing a python program, when it catches any error, it will reset everything and restart itself.</p>
<p>It goes like this</p>
<pre><code>async def main_loop():
while True:
try:
await main()
except:
stop_everything()
reset_everything()
await asyncio... | <python><firebase><google-cloud-firestore><python-asyncio><try-except> | 2023-02-21 17:44:53 | 1 | 2,017 | Jeffrey Chen |
75,524,034 | 2,366,887 | Trying to run a python program but I keep getting file is not a package error | <p>I've got a python program "LoginServiceBase.py" Defined inside a directory called 'LoginService'. I've created an __init__.py file that looks like this:</p>
<pre><code> # Import views and other necessary modules
from .views import LoginView, SignupView
from .Log... | <python><django> | 2023-02-21 17:38:16 | 1 | 523 | redmage123 |
75,524,026 | 1,050,187 | Tensorflow 2.11 error: AttributeError: module 'tensorflow._api.v2.compat.v2.__internal__' has no attribute 'register_load_context_function' | <p>I had to update Tensorflow to the currently latest version 2.11. when importing i get "AttributeError: module 'tensorflow._api.v2.compat.v2.<strong>internal</strong>' has no attribute 'register_load_context_function'". I have also completely reinstalled a full anaconda environment and downgraded Python to ... | <python><tensorflow><keras> | 2023-02-21 17:37:11 | 2 | 623 | fede72bari |
75,523,841 | 3,971,855 | Aggregating the columns having list as values in pandas dataframe | <p>I have a dataframe which have 3 columns with one of the columns having a list of values.</p>
<p>I want aggregate that list into single list when doing groupby.</p>
<p>DataFrame looks like this</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>C1</th>
<th>C2</th>
<th>C3</th>
</tr>
</thead>
... | <python><pandas><list><group-by> | 2023-02-21 17:19:13 | 3 | 309 | BrownBatman |
75,523,824 | 7,154,462 | Custom module not found error on google colab | <p>I am trying to run a pytorch code in google colab. The github repository is:</p>
<p><a href="https://github.com/BrightXiaoHan/FaceDetector" rel="nofollow noreferrer">GitHub - BrightXiaoHan/FaceDetector: A re-implementation of mtcnn. Joint training, tutorial and deployment together.</a></p>
<p>There is a custom modul... | <python><pytorch><google-colaboratory> | 2023-02-21 17:17:22 | 1 | 898 | desertSniper87 |
75,523,818 | 3,763,732 | Pandas: Combining Product and Apply | <p>I have a df created from a spreadsheet containing mostly strings:</p>
<pre><code> # age sex employed educ marital race
0 1 35 to 44 years F Full time Some Col DIV White
1 2 65 to 74 years M Retired BA/BS SING White
2 3 45 to 54 years F Ful... | <python><pandas> | 2023-02-21 17:16:48 | 1 | 1,759 | AutomaticStatic |
75,523,779 | 4,178,189 | How to get details of group selection in streamlit-aggrid | <p>I am using <a href="https://streamlit.io/" rel="nofollow noreferrer">streamlit</a> extension <a href="https://github.com/PablocFonseca/streamlit-aggrid" rel="nofollow noreferrer">streamlit-aggrid</a> and I have a selectable table with row groups. I am not able to gather all details of the rows selected when selectin... | <python><ag-grid><streamlit> | 2023-02-21 17:13:07 | 2 | 1,493 | pietroppeter |
75,523,579 | 2,473,382 | Ignore a failed alembic migration | <p>For the context: I am using a Postgres RDS which comes with some infinite timestamp for some default roles. Alembic (or more precisely, psycopg) does not like that at all. My first revision is updating some those timestamps to something legit (aka year 9999).</p>
<p>The thing is that I test on docker first, where th... | <python><sqlalchemy><alembic> | 2023-02-21 16:54:56 | 0 | 3,081 | Guillaume |
75,523,547 | 12,300,981 | Scipy Minimization Problem, how to find the global minima when there is multiple local minima | <p>I have a function with 2 adjustable variables g(x,y) that I am minimizing to fit function f(a,b) with bounds 0 to inf.</p>
<p>This is done using the basic</p>
<pre><code>bnds=np.array([0,np.inf])
minimize(min_fun,args=(funx_output), x0=[0,0], bounds=bnds,method='L-BFGS-B')
</code></pre>
<p>The problem isn't the code... | <python><scipy> | 2023-02-21 16:52:25 | 0 | 623 | samman |
75,523,498 | 11,680,995 | Python Polars: How to get the row count of a LazyFrame? | <p>The CSV file I have is 70 Gb in size. I want to load the DF and count the number of rows, in lazy mode. What's the best way to do so?</p>
<p>As far as I can tell, there is no function like shape in lazy mode according to the documentation.
I found this <a href="https://stackoverflow.com/questions/41553467/how-can-i-... | <python><dataframe><python-polars> | 2023-02-21 16:48:11 | 1 | 343 | roei shlezinger |
75,523,415 | 6,552,836 | Scipy Optimise with Mystic - constraint keeps getting violated | <p>I'm trying to optimize a 52x5 matrix to maximize a return value <code>y</code>. I first flatten the matrix into an array of 260 elements, then apply Scipy optimize and mystic. However, the <code>max_limit</code> constraint keeps getting violated?</p>
<p>Please see the main part of the code below:</p>
<pre><code>max_... | <python><optimization><scipy><scipy-optimize><mystic> | 2023-02-21 16:40:05 | 1 | 439 | star_it8293 |
75,523,336 | 301,302 | Streaming redirected stdout output in real time | <p>I'm using the <a href="https://docs.python.org/3/library/code.html" rel="nofollow noreferrer">InteractiveInterpreter</a> to execute code that has delays in it (see below). I'd like to capture the output from <code>stdout</code> as the output is written. I'm currently using <code>contextlib</code> to redirect <code>s... | <python><python-3.x> | 2023-02-21 16:34:29 | 1 | 2,958 | naivedeveloper |
75,523,328 | 850,781 | pip does not see the latest pandas version | <p><a href="https://pandas.pydata.org/" rel="nofollow noreferrer">pandas</a> 1.5.3 was released on Jan 19, 2023.</p>
<p>However, <code>pip</code> seems to be unable to install it (same for 1.5.2 &c):</p>
<pre><code>$ pip3 install --user pandas==1.5.3
ERROR: Could not find a version that satisfies the requirement pa... | <python><pandas><pip> | 2023-02-21 16:34:02 | 1 | 60,468 | sds |
75,523,158 | 20,967,663 | Sqlalchemy specify table size during create_all call | <p>Is there any way to specify the size for the tables in Oracle database when I use <code>schema.create_all()</code>?</p>
<p>Generally speaking, I am looking for ways to increase Oracle table space size from python and I am specifically using sqlalchemy to work with the database. I know I can use Oracle's SQL command ... | <python><oracle-database><sqlalchemy> | 2023-02-21 16:20:18 | 0 | 303 | Osman Mamun |
75,523,134 | 13,627,237 | Passing param to Airflow DAG from another DAG with TriggerDagRunOperator | <p>I'm trying to pass a param to Airflow DAG from another DAG with TriggerDagRunOperator, here is the code:</p>
<pre><code>@dag(default_args=default_args, catchup=False, #schedule_interval=DAG_SCHEDULE_INTERVAL,
dagrun_timeout=timedelta(seconds=3600), tags=["tag1"], doc_md=DOC_MD, max_active_runs=1)
def ... | <python><airflow><jinja2> | 2023-02-21 16:18:35 | 1 | 774 | Cristian Ispan |
75,523,072 | 12,193,952 | Pandas - Find the lowest value in range defined by certain values? | <p>I struggle while finding the lowest value within a range defined by values in other column. The range is always defined by two similar values in <code>boo</code> column (1-1, 2-2), shown also on image below. Values (<code>boo</code> column) are not known in advance (<em>so I cannot make a list and compare them</em>... | <python><pandas><dataframe> | 2023-02-21 16:12:52 | 3 | 873 | FN_ |
75,522,916 | 11,027,207 | sqlalchemy - automap_base dynamically generates mapped classes | <p>How i can make below code to work dynamically by given list of tables .</p>
<pre><code>from sqlalchemy import create_engine,MetaData
from sqlalchemy.orm import Session
engine = create_engine('postgresql://admin:admin@192.168.1.113:5432/target')
session = Session(engine)
from sqlalchemy.ext.automap import automap_b... | <python><sqlalchemy><orm> | 2023-02-21 15:59:18 | 0 | 424 | AviC |
75,522,890 | 4,225,430 | Python: Fail to produce diamond since unable to add space in the first line | <p>I'd like to produce a diamond with python, but failed because python cannot allow spaces in the starting positions in the first line. Need your help for advice. My code:</p>
<pre><code>space = " "
n = int(input('Enter the number of upper-half column of diamond : '))
for i in range (n):
print(space * ... | <python><for-loop> | 2023-02-21 15:57:08 | 1 | 393 | ronzenith |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.