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,210,615 | 4,409,163 | How to reproduce visual division of pages with Gtk.TextView | <p>I'm working on a text editing application, initially aimed at serving literary writers. I'm using Gtk4, Python and Flatpak and I'm having some difficulties implementing things the way I want. So I have a few questions:</p>
<p>1 - I know that it is possible to display the same <strong>Gtk.TextBuffer</strong> in sever... | <python><gtk><pygobject><gtk4> | 2023-10-01 13:16:03 | 0 | 544 | Kripto |
77,210,527 | 12,462,568 | Does Langchain’s `create_csv_agent` and `create_pandas_dataframe_agent` functions work with non-OpenAl LLMs | <p>Does Langchain's <code>create_csv_agent</code> and <code>create_pandas_dataframe_agent</code> functions work with non-OpenAl LLM models too like Llama
2 and Vicuna? The only example I have seen in the documentation (in the links below) are only using OpenAI API.</p>
<p><code>create_csv_agent</code>:
<a href="https:/... | <python><openai-api><langchain><large-language-model><llama> | 2023-10-01 12:45:47 | 1 | 2,190 | Leockl |
77,210,245 | 10,499,751 | Pandas get the combined sum of each row and colum | <p>I'm trying to add the "vertical" and "horizontal" sum for each cell.</p>
<p><a href="https://i.sstatic.net/OC9VS.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/OC9VS.png" alt="enter image description here" /></a></p>
<p>So far I've tired to get the sum of each row and column. But ... | <python><python-3.x><pandas><dataframe> | 2023-10-01 11:18:26 | 1 | 646 | Lukas Neumann |
77,210,197 | 3,312,274 | flask error with sqlalchemy when doing rollback | <p>My error handler for 500 is throwing an error at <code>db.session.rollback</code>.</p>
<pre><code>@bp.app_errorhandler(500)
def internal_error(error):
db.session.rollback()
return render_template('errors/500.html'), 500
</code></pre>
<p>I tried to catch the error with try..except as follows:</p>
<pre><code>t... | <python><flask><error-handling><sqlalchemy> | 2023-10-01 11:02:42 | 1 | 565 | JeffP |
77,210,131 | 4,430,968 | Can I force pip to install dependencies for x86_64 architecture in powershell to make Lambda layer? | <p>I'm trying to create a lambda layer that includes pydantic/pydantic_core (Lambda python 3.11, x86_64) but getting the following error: <code>"Unable to import module 'reddit_lambda': No module named 'pydantic_core._pydantic_core'"</code></p>
<p>For context, I'm installing this on a windows x64 machine.</p>... | <python><powershell><aws-lambda><pydantic> | 2023-10-01 10:43:38 | 1 | 528 | Davis |
77,209,783 | 3,692,272 | Create single parent figure where the Y-axis represents depth | <p>Using the dataset below, it represent amplitudes recorded a varying depths across time.</p>
<pre><code>data = {
'Time': [0, 2.5, 5, 7.5, 10],
'Depth_63.5': [161, 143, 134, 147, 163],
'Depth_64.5': [183, 190, 375, 255, 241],
'Depth_65.5': [711, 727, 914, 756, 747],
}
</code></pre>
<p>I can plot the gr... | <python><matplotlib><time-series><axis> | 2023-10-01 08:40:43 | 2 | 992 | Umar Yusuf |
77,209,768 | 209,834 | How to merge pandas columns in a comma separated way | <p>I have a pandas dataframe like below</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th style="text-align: left;">Id</th>
<th style="text-align: left;">Other columns</th>
<th style="text-align: left;">Param1</th>
<th style="text-align: left;">Param2</th>
<th style="text-align: left;">Param3... | <python><pandas><dataframe> | 2023-10-01 08:35:14 | 3 | 8,498 | Suhas |
77,209,550 | 4,281,353 | Why does dividing columns by another column yield NaN? | <p>There is a Pandas dataframe <code>df</code>.</p>
<pre><code>df.info()
---
<class 'pandas.core.frame.DataFrame'>
Int64Index: 3 entries, 1 to 3
Data columns (total 3 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 0 3 non-null int64
1 1 3 non-null int... | <python><pandas><dataframe> | 2023-10-01 07:13:29 | 1 | 22,964 | mon |
77,209,527 | 2,696,565 | Plotly box plot: remove transparency | <p>Boxplots in plotly by default are semi-transparent, how can I turn this off please. This has been asked on <a href="https://github.com/plotly/plotly.py/issues/3404" rel="nofollow noreferrer">plotly forums</a> before, but I'm not quite sure how to implement the suggestion. Below is a simple box plot from plotly doc, ... | <python><plotly> | 2023-10-01 07:00:26 | 1 | 629 | user2696565 |
77,209,292 | 4,838,216 | Why do these folders get created when I create a virtual env for python instead of just a single venv folder? | <p>Did something change with using <code>venv</code>? I tried to use this command to create a virtual env in <code>C:\Users\USER\Desktop\FOLDER1\FOLDER2\venv</code>, but instead it created two folders - <code>v2</code> and <code>Windows</code> in <code>C:\Users\USER\Desktop\FOLDER1\FOLDER2</code>. Why did it do this? W... | <python><python-3.x><windows><windows-10><python-venv> | 2023-10-01 04:53:39 | 0 | 2,326 | whatwhatwhat |
77,209,153 | 4,235,960 | How to dynamically create dataframes with a for loop | <p>My code currently looks like this:</p>
<pre><code>df_1 = portfolio_all[0].rename(columns={'Close': 'Close_1'} )
df_2 = portfolio_all[1].rename(columns={'Close': 'Close_2'} )
df_3 = portfolio_all[2].rename(columns={'Close': 'Close_3'} )
df_4 = portfolio_all[3].rename(columns={'Close': 'Close_4'} )
df_5 = portfolio_... | <python><pandas><dataframe> | 2023-10-01 03:46:03 | 2 | 3,315 | adrCoder |
77,209,084 | 13,000,229 | Flask: How can I use `app` variable in the entire project? | <p>I would like to know how to use <code>app</code> variable in any files in my project.</p>
<p>Tutorial: <a href="https://flask.palletsprojects.com/en/2.3.x/tutorial/" rel="nofollow noreferrer">https://flask.palletsprojects.com/en/2.3.x/tutorial/</a><br />
Code to create a variable <code>app</code>: <a href="https://g... | <python><flask> | 2023-10-01 03:00:21 | 1 | 1,883 | dmjy |
77,209,020 | 21,305,238 | Using @singledispatchmethod on __eq__(): Signature of "__eq__" incompatible with supertype "object" | <p>Here's a minimal reproducible example of what I'm trying to do (<a href="https://mypy-play.net/?mypy=latest&python=3.11&flags=strict&gist=a620d21948f7f7c3c22d204619fd084c" rel="nofollow noreferrer">mypy playground</a>):</p>
<pre class="lang-py prettyprint-override"><code>from functools import singledispa... | <python><mypy><python-typing> | 2023-10-01 02:18:46 | 2 | 12,143 | InSync |
77,208,996 | 5,986,907 | How can I profile mypy? | <p>Mypy is taking an unreasonably long time to type check my small project. How can I profile it to find out where it's spending all its time? I tried <code>mypy -v</code>, which gives a bit more of an idea, but there aren't timestamps on the logs so it's not practical.</p>
| <python><profiling><mypy> | 2023-10-01 02:05:00 | 1 | 8,082 | joel |
77,208,975 | 4,235,960 | Merge 4 or more Dataframes | <p>I've read the following thread: <a href="https://stackoverflow.com/questions/44327999/how-to-merge-multiple-dataframes">How to merge multiple dataframes</a></p>
<pre><code>data_frames = [df1, df2, df3]
df_merged = reduce(lambda left,right: pd.merge(left,right,on=['DATE'],
... | <python><dataframe><merge> | 2023-10-01 01:54:29 | 1 | 3,315 | adrCoder |
77,208,951 | 19,130,803 | Detect page change in dash | <p>I am developing a <code>dash</code> web application which is a <code>multi</code> page app. Below is my structure</p>
<pre><code>- project/
- pages/
- home.py
- contact.py
- graph.py
- app.py
- index.py
</code></pre>
<p>In <code>app.py</code>, I have a component <code>dcc.Location(id="url&q... | <javascript><python><plotly-dash> | 2023-10-01 01:32:18 | 1 | 962 | winter |
77,208,902 | 5,032,387 | Invalid data binding expression when running AzureML pipeline | <p>I'm running an AzureML pipeline using the command line where the sole job (for now) is a sweep.</p>
<p>When I run
<code>run_id=$(az ml job create -f path_to_pipeline/pipeline.yaml --query name -o tsv -g grp_name -w ws-name)</code>,
I get the following error:</p>
<pre><code>ERROR: Met error <class 'Exception'>:... | <python><azure-ml-pipelines> | 2023-10-01 01:00:55 | 2 | 3,080 | matsuo_basho |
77,208,687 | 4,324,307 | Why is for x in arr seem to evaluate multiple times? | <p><a href="https://leetcode.com/problems/permutations/" rel="nofollow noreferrer">https://leetcode.com/problems/permutations/</a></p>
<pre><code>class Solution:
def permute(self, nums: List[int]) -> List[List[int]]:
result = []
set_num = set(nums)
self.loop = 0
def dfs(curr):
... | <python> | 2023-09-30 22:51:15 | 0 | 941 | zcahfg2 |
77,208,681 | 9,739,007 | Regex to find all class names from .css file | <p>I am working on a ticket for an open source project. There are over 800+ css files, and I need to get all the class names from all these files, and then check all the HTML files for these class names. The goal is to find which classes aren't being used anywhere in the project & delete them. So the 1st step is ex... | <python><regex><regex-lookarounds> | 2023-09-30 22:49:10 | 2 | 1,205 | Jamie |
77,208,623 | 188,096 | Why am I getting invalid model error with "gpt-35-turbo-16k" model in Azure Open AI but not with "gpt-35-turbo"? | <p>I have built a very simple application using Azure Open AI, Langchain and Streamlit. Following is my code:</p>
<pre><code>from dotenv import load_dotenv,find_dotenv
load_dotenv(find_dotenv())
import streamlit as st
from langchain.llms import AzureOpenAI
from langchain.prompts import PromptTemplate
LLM = AzureOpe... | <python><azure><streamlit><langchain><azure-openai> | 2023-09-30 22:16:55 | 1 | 136,942 | Gaurav Mantri |
77,208,622 | 22,466,650 | How to summarize a json based on the type of objects it holds? | <p>My input is this json:</p>
<pre class="lang-py prettyprint-override"><code>object = {'name': 'John',
'age': 30,
'address': {'street': '123 Main St',
'city': 'Sampletown',
'zipcode': '12345',
'frequency': 12.55},
'interests': ['Python programming',
{'hobbies': ['Playing chess',
{'outdoor': {'activity1'... | <python><json> | 2023-09-30 22:16:23 | 1 | 1,085 | VERBOSE |
77,208,291 | 638,504 | How to use dynamic (growing) analytics data with Pandas | <p>I want to use Pandas for statistical analysis of analytics data. This data is not fixed, it's growing every day.</p>
<p>Saving the analytics data in a database just to convert it to the dataframe every time I run the analysis feels not very efficient to me as I need to run the analysis daily.</p>
<p>I can of course ... | <python><pandas><analytics> | 2023-09-30 20:09:06 | 0 | 2,193 | ddofborg |
77,207,944 | 3,555,115 | Remove First 5 directories in a file path column from data frame | <p>My dataframe looks like</p>
<pre><code>print df_function
address function file_name
0xffffffff87954120 load_buf /a/b/c/d/e/f/...
0xffffffff87954121 load_buf /a/b/c/d/e/f/...
....
....
</code></pre>
<p>Column "file_name" isn't displaying complet... | <python> | 2023-09-30 18:18:05 | 2 | 750 | user3555115 |
77,207,555 | 7,695,845 | pkg_resources DeprecationWarning when running pytest? | <p>I am working on a Python library and I recently wanted to integrate <code>pytest</code> into my development workflow. I tried running a simple test that passed, but I got a warning:</p>
<pre><code>.venv\Lib\site-packages\pygame\pkgdata.py:25
D:\dev\python\physiscript\.venv\Lib\site-packages\pygame\pkgdata.py:25: D... | <python><pytest> | 2023-09-30 15:15:38 | 2 | 1,420 | Shai Avr |
77,207,553 | 1,073,946 | Regex pattern - couples' names | <p>I am looking for a regex pattern that matches patterns like "Jane and John Smith" (I mean first-name and first-name last-name) in the middle of a text. It should not match "Jane Smith and John Smith".</p>
<p>Then I want to substitute all found "Jane and John Smith"s with "Jane Smit... | <python><regex> | 2023-09-30 15:14:48 | 2 | 439 | Bahar S |
77,207,534 | 2,030,601 | Using Terminal, Launch VSCode into a project folder and open a project file | <p>I am writing a Python Script and I want to use <code>subprocess</code> - basically MacOS <code>terminal</code> (Flavor probably not important) to launch <code>VSCode</code> (installed) into a project directory e.g. <code>~/workspace/my/project/</code> and have it open a file within that folder e.g. <code>~/workspace... | <python><macos><visual-studio-code><terminal><subprocess> | 2023-09-30 15:08:55 | 1 | 1,145 | Decoded |
77,207,529 | 10,431,629 | Finding the closest pair (within a tolerance) of tuple from a pandas data frame in O(N) time complexity or better | <p>The problem I am facing may be realizable in a looping, however, I need to figure out a pythonic solution with max O(N) time complexity:</p>
<p>So the problem is this:</p>
<p>I have a data frame (which I call say lookup) say as follows:(it may be a very big data frame of 100M + rows) ( my A & B are the columns t... | <python><pandas><indexing><grouping><lookup> | 2023-09-30 15:06:20 | 1 | 884 | Stan |
77,207,347 | 4,619,822 | Porting BSGS (ECDSA) on rust | <p>Hi guys I'm porting Baby step Giant Step algorithm from examples displayed here to Rust programming language.
<a href="https://github.com/ashutosh1206/Crypton" rel="nofollow noreferrer">https://github.com/ashutosh1206/Crypton</a>
the normal version is ported successfully without problems here is an example.</p>
<pre... | <python><rust><cryptography><sage><secp256k1> | 2023-09-30 14:16:13 | 0 | 1,598 | PrinceZee |
77,207,062 | 15,632,586 | What should be done to make my own weighted loss function for BertForSequenceClassification? | <p>I am trying to fine tune SciBERT with a new dataset, but my dataset is having a high imbalance among classes (the class with highest number of elements has ~760 elements, while there are classes with 10-20 elements). Due to this problem, I am trying to make my own weighted loss function (using logits) for the fine-t... | <python><pytorch><huggingface-transformers><bert-language-model> | 2023-09-30 12:47:39 | 1 | 451 | Hoang Cuong Nguyen |
77,206,851 | 19,358,731 | Confused about pip dependency package version resolution | <p>On two separate computers running Windows 11, I am trying to install the <code>tflite-support</code> package (PyPI link: <a href="https://pypi.org/project/tflite-support/" rel="nofollow noreferrer">https://pypi.org/project/tflite-support/</a>)</p>
<p>Computer A is running Python 3.8.10 and computer B is running Pyth... | <python><python-3.x><pip> | 2023-09-30 11:41:53 | 0 | 355 | andynewman |
77,206,483 | 6,394,722 | subprocess (launch ssh process in background) communicate hang if enable stderr | <p>I have next code, it will do next:</p>
<ol>
<li>subprocess for <code>ssh -f -M</code> to let ssh launch a shared socket in background</li>
<li>As above is in background, so for the second ssh connection we could just reuse the socket <code>/tmp/control-channel</code> to connect ssh server without password.</li>
</ol... | <python><python-3.x><linux><ssh><subprocess> | 2023-09-30 09:45:53 | 2 | 32,101 | atline |
77,206,414 | 13,086,128 | Get elements multiplied by their frequencies from a dictionary | <p>Suppose there is a dictionary with 1 Million records.</p>
<p>a minimum reproducible example:</p>
<pre><code>d = {1:2, 2:4, 3:5}
</code></pre>
<p>here keys represent the elements and values represent their respective frequencies.</p>
<p>Now, I want to get all the elements in a list like:</p>
<pre><code>[1, 1, 2, 2, 2... | <python><list><dictionary> | 2023-09-30 09:25:35 | 2 | 30,560 | Talha Tayyab |
77,206,297 | 13,498,175 | Proper way of inverting matrix with so small elements as 1e-20 | <p>I am generating matrix which is symmetric, and the magnitude of its elements depend on the length scale of the problem I am dealing with. Typically the matrix is 9x9, but 6x6 version could be also used.</p>
<p>One example of the matrix is like this</p>
<pre><code>// A
2.8538093853e-21 7.1747731778e-22 7.1747731778e-... | <python><numpy><matrix> | 2023-09-30 08:51:24 | 1 | 455 | Sangjun Lee |
77,206,182 | 11,608,962 | Uploading bytes object to s3 throwing ValueError: Fileobj must implement read | <p>I am trying to upload a base64 string representing a <code>jpeg</code> file format but getting <code>ValueError</code>.</p>
<p>Code:</p>
<pre class="lang-py prettyprint-override"><code>with open(base64_txt_file, 'r') as file:
base64_content = file.read()
img_data = base64_content.encode()
img_content = base64.b... | <python><amazon-web-services><amazon-s3> | 2023-09-30 08:10:30 | 1 | 1,427 | Amit Pathak |
77,206,151 | 1,618,465 | How to load multiple SSL certificates on server with python with sockets | <p>I'm creating a server that should support SSL. I have two pairs of signed cert and keyfile for two different domains.</p>
<p>To add both certs to the context I've tried two things:</p>
<ul>
<li>Calling twice to <code>context.load_cert_chain(certfile=certfile, keyfile=keyfile)</code></li>
<li>Concatenating both certf... | <python><sockets><ssl><sni> | 2023-09-30 07:58:53 | 1 | 1,961 | user1618465 |
77,205,923 | 14,154,784 | Simple Example of Multiple ManyToMany Model Relations in Django | <p>I'm writing a workout app and have a number of models that need to link together. Specifically, I have an Exercise model that needs to track the name of each exercise as well as the primary and secondary muscle groups targeted by the exercise. I also need a muscle group model, and these all need to link together in ... | <python><django><django-models><django-orm> | 2023-09-30 06:37:52 | 1 | 2,725 | BLimitless |
77,205,618 | 3,204,212 | When a file is on the Windows clipboard, how can I (in Python) access its path? | <p><strong>I don't mean reading text from the clipboard.</strong></p>
<p>When a user right-clicks a file in Explorer and selects 'Copy', a value is placed on the clipboard that is not simply its path as a string. Pasting that value behaves differently in different contexts: in Explorer, it would create a new file; in A... | <python><clipboard> | 2023-09-30 04:02:25 | 1 | 2,480 | GreenTriangle |
77,205,575 | 2,487,607 | seaborn 0.13.0 pointplot native_scale TypeError: pointplot() got an unexpected keyword argument 'native_scale' | <p>According to the <a href="https://seaborn.pydata.org/generated/seaborn.pointplot.html" rel="nofollow noreferrer">documentation</a> seaborn pointplot says:</p>
<blockquote>
<p>By default, this function treats one of the variables as categorical and draws data at ordinal positions (0, 1, … n) on the relevant axis. As ... | <python><matplotlib><seaborn><scale><pointplot> | 2023-09-30 03:28:48 | 0 | 8,557 | travelingbones |
77,205,208 | 1,889,720 | How do I make my Cloud Run Job last indefinitely? | <p>I have a Job in Cloud Run that ingests data from an external source, and writes that data into Firebase Firestore. I want this job to run indefinitely - 365 days per year, 24 hours per day.</p>
<p>As I understand, these Cloud Run jobs have a timeout. The timeout is the reason I migrated from Firebase Functions to Cl... | <python><error-handling><timeout><google-cloud-run><indefinite> | 2023-09-29 23:37:39 | 2 | 7,436 | Evorlor |
77,205,203 | 1,687,469 | How can I dynamically change TreeView columns without TreeView width growing beyond column widths? | <p>I'm trying to update a ttk.TreeView's columns, but the TreeView always expands beyond the column widths. The issue is shown in the screenshots below.</p>
<p>Here is a minimum reproducible example:</p>
<pre class="lang-py prettyprint-override"><code>import tkinter as tk
from tkinter import ttk
class DataView(ttk.La... | <python><tkinter><treeview> | 2023-09-29 23:33:41 | 1 | 853 | Tur1ng |
77,205,123 | 1,773,216 | How do I slim down SBERT's sentencer-transformer library? | <p>SBERT's (<a href="https://www.sbert.net/" rel="noreferrer">https://www.sbert.net/</a>) <code>sentence-transformer</code> library (<a href="https://pypi.org/project/sentence-transformers/" rel="noreferrer">https://pypi.org/project/sentence-transformers/</a>) is the most popular library for producing vector embeddings... | <python><pytorch><huggingface><large-language-model><sentence-transformers> | 2023-09-29 22:53:58 | 1 | 1,657 | nmurthy |
77,204,995 | 1,035,897 | How to specify version of module installed from git repo with pip install -r requirements.txt | <p>In my <strong>Python</strong> <strong>FastAPI</strong> app, I need <strong>Pydantic</strong> version 2 to solve <a href="https://stackoverflow.com/questions/77203896/list-of-union-only-accepts-first-type-of-union-with-pydantic/77204842">an issue</a> with <code>Unions</code> that is fixed in version 2 only.</p>
<p>Si... | <python><version><fastapi><pydantic><sqlmodel> | 2023-09-29 22:09:15 | 2 | 9,788 | Mr. Developerdude |
77,204,947 | 19,907,524 | Is there a good way to compile .pyx cython files for AWS Lmabda? | <p>So I'm currently compiling <code>.pyx</code> files using a AWS EC2 instance because I didn't find a way to do it locally on my macbook. Is there an obvious solution to do this locally or do I just continue with how I'm doing it?</p>
<p>I thought maybe setting the <code>platform</code> kwarg to <code>'manylinux2014_x... | <python><cython> | 2023-09-29 21:51:49 | 0 | 551 | Daniel Olson |
77,204,874 | 820,011 | Is it possible to type a dict of type -> handler functions for that type in python? | <p>eg, imagine a class hierarchy rooted at <code>Base</code> (which is abstract) with subclasses <code>A</code> and <code>B</code>. I'd like to be able to do something like this:</p>
<pre class="lang-py prettyprint-override"><code>T = TypeVar('T', bound=Base)
dispatch: dict[Type[T], Callable[[T], RetType] = {
A: a_ha... | <python><generics><mypy> | 2023-09-29 21:28:48 | 1 | 2,535 | ben w |
77,204,822 | 1,187,621 | GEKKO IPOPT trajectory propagation | <p>I am trying to propagate a spacecraft to optimize the time of flight using IPOPT in GEKKO/Python. Here is the code for my GEKKO model:</p>
<pre><code>m = GEKKO()
#manipulating variables and initial guesses
al_a = m.MV(value = -1, lb = -2, ub = 2)
al_a.STATUS = 1
l_e = m.MV(value = 0.001, lb = 0, ub = 10**6)
l_e.STA... | <python><gekko><ipopt> | 2023-09-29 21:17:28 | 1 | 437 | pbhuter |
77,204,672 | 1,173,913 | Paho MQTT in browser with jupyterlite | <p>I'm attempting to run Paho MQTT in a browser using jupyterlite and pyodide. I was able to install paho using micropip (see example in link below). But the paho client times out when attempting to connect. I tried using websockets but this also failed with timeout. I tried ports 443, 9001 but that failed.</p>
<blockq... | <python><mqtt><paho><pyodide><jupyterlite> | 2023-09-29 20:37:19 | 0 | 581 | Graham |
77,204,626 | 2,034,048 | Flask 404 errors | <p>I am getting 404 errors from a Flask app with Blueprints. This is on Windows 10 running the latest PyCharm and python 3.11.</p>
<p>I have seen several, usualy many years old, version of this question. I have a Flask app that was not complete but was "working" in early development. I was put on a series ... | <python><flask><pycharm> | 2023-09-29 20:25:45 | 1 | 2,579 | 7 Reeds |
77,204,503 | 5,420,846 | Polars - Split LazyFrame collection based on key column | <h2>Problem</h2>
<p>I have a fairly large LazyFrame that crashes even if I use <code>.collect(streaming=True)</code>. In order to split up the calculation into smaller subsets handleable in memory, I'd like to separate the table into multiple tables, based on the value of a "Key Column".</p>
<hr />
<h2>Exampl... | <python><python-polars> | 2023-09-29 19:55:07 | 1 | 1,988 | Joe |
77,204,421 | 10,197,791 | How can I upload a file to Synology NAS using python with Synology NAS API? | <p>I am trying to create a python script to upload an xlsx file to synology NAS using the official Synology NAS API and the python requests module. I have been able to successfully log in and display filestation information using the SYNO.API.Auth and SYNO.FileStation.List apis respectively, but for some reason I can n... | <python><python-requests><synology><nas> | 2023-09-29 19:37:04 | 1 | 375 | NicLovin |
77,204,417 | 3,291,993 | How to show xaxis ticklabels in a grid | <p>How to show xaxis ticklabels below the grid?</p>
<pre><code>ax.set_xticklabels([0.1, '', '', '', 0.5, '', '', '', '', 1.0], minor=True)
</code></pre>
<p>When I run the code I get the figure below.</p>
<p><a href="https://i.sstatic.net/iRLhP.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/iRLhP.png" al... | <python><matplotlib><axis-labels> | 2023-09-29 19:35:33 | 1 | 1,147 | burcak |
77,204,385 | 9,766,795 | Signature for this request is not valid. - Binance API | <p>I'm getting the following error when using the binance-connector with python:</p>
<pre><code> "price": 20348.91, "quantity": 4.914e-05, "side": "BUY", "symbol": "BTCUSDT", "timeInForce": "GTC", "timestamp": 1696014956799, "... | <python><binance><python-binance> | 2023-09-29 19:27:14 | 1 | 632 | David |
77,204,366 | 9,112,151 | How to perform selectinload behind many-to-many? | <p>With code below:</p>
<pre><code>import logging
from faker import Faker
from sqlalchemy import create_engine, ForeignKey, select
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column, relationship, Session, selectinload
engine = create_engine("sqlite:///:memory:")
fake = Faker('ru_RU')
loggin... | <python><sqlalchemy> | 2023-09-29 19:22:38 | 1 | 1,019 | Альберт Александров |
77,204,171 | 1,889,720 | How do I make a Dockerfile for Cloud Run? | <p>I am deploying and running Python Jobs to Cloud Run. I can successfully deploy and run my jobs, and they behave as expected.</p>
<p>I am adding <code>import requests</code> to my job, and it is giving me the error:</p>
<pre><code>Traceback (most recent call last):
File "/workspace/main.py", line 3, in &... | <python><python-requests><dockerfile><google-cloud-run> | 2023-09-29 18:40:13 | 2 | 7,436 | Evorlor |
77,203,986 | 20,530,490 | Airflow Snowflake Operator Error - AttributeError: 'dict' object has no attribute 'sfqid' | <p>I've recently upgraded our MWAA instance from Airflow 2.2.2 to 2.4.3 but i'm now getting the below error whenever I use the <a href="https://airflow.apache.org/docs/apache-airflow-providers-snowflake/3.0.0/_api/airflow/providers/snowflake/operators/snowflake/index.html#airflow.providers.snowflake.operators.snowflake... | <python><sqlalchemy><snowflake-cloud-data-platform><airflow><mwaa> | 2023-09-29 18:03:43 | 1 | 371 | CallumO |
77,203,958 | 2,410,605 | Using Python Selenium 4.13, still getting "your version of chrome not supported message" | <p>I just updated and verified that I am using Selenium 4.13. It's my understanding that Selenium Manager was being used with everything after Selenium 4.10 so I wouldn't have to worry about downloading the latest chromedriver every time a new Chrome version came out. I'm still in the learning stages with python so app... | <python><selenium-webdriver><selenium-chromedriver><seleniummanager> | 2023-09-29 17:58:51 | 1 | 657 | JimmyG |
77,203,897 | 5,084,560 | changing early_stopping_rounds on xgboost doesn't effect the performance. what's wrong? | <p>I have a binary classification dataset. I use xgboost. I changed early_stopping_rounds value and fit. it gave same results every time. I shared screenshots below. what is the reason of same results?</p>
<p><strong>early_stopping_rounds=10</strong>
<a href="https://i.sstatic.net/KPnpz.png" rel="nofollow noreferrer"><... | <python><optimization><xgboost><hyperparameters> | 2023-09-29 17:46:23 | 1 | 305 | Atacan |
77,203,896 | 1,035,897 | List of Union only accepts first type of union with Pydantic | <p>With the following python type definitions:</p>
<pre><code>import pydantic
from typing import List, Union
import sys
import pprint
class TypeA(pydantic.BaseModel):
name:str = "Type A"
type_a_spesific:float = 1337
class TypeB(pydantic.BaseModel):
name:str = "Type B"
type_b_spesif... | <python><list><union><python-typing><pydantic> | 2023-09-29 17:46:08 | 1 | 9,788 | Mr. Developerdude |
77,203,810 | 2,520,186 | Pandas DataFrame: Replace a column by a list with a new column name | <p>I have a Pandas <code>DataFrame</code> and want to replace a column with a new one. The column should have a new name and a list gives its content. I can do this in two different ways. See the code below.</p>
<pre><code>import pandas as pd
df = pd.DataFrame({
'Name': ['Alice','Bob','Charlie'],
'Age': [18,19... | <python><python-3.x><pandas><dataframe> | 2023-09-29 17:29:35 | 3 | 2,394 | hbaromega |
77,203,702 | 6,260,154 | Get only folder names using glob.glob * pattern | <p>I am using below line of code to recursively find the folders which has a particular sub-file name endswith <code>.log</code>.</p>
<pre><code>glob.iglob(f"{ROOT}/**/*.log", recursive = True)
</code></pre>
<p>Now, this code gives me an iterator which has complete path. But I want to return only the folder n... | <python><glob> | 2023-09-29 17:09:17 | 3 | 1,016 | Tony Montana |
77,203,666 | 1,856,291 | Is it possible to downcast SwigObject to a concrete type? | <p>I have a couple of C files:</p>
<pre class="lang-c prettyprint-override"><code>/*mid.h*/
#ifndef mid_h
#define mid_h
#include <stdlib.h> typedef struct PtrRec *Ptr, PtrStruct;
#endif /*mid_h*/
</code></pre>
<pre class="lang-c prettyprint-override"><code>/*left.h*/
#ifndef left_h
#define left_h
#include... | <python><c><pointers><polymorphism><swig> | 2023-09-29 17:01:53 | 1 | 529 | Sugar |
77,203,655 | 12,407,899 | How to draw a box plot with white face color on top of a violin plot and swarm plot | <p>I want to draw the following box-plot with white face color overlaid on a violin plot and swarmplot, something similar to the following plot:</p>
<p><a href="https://i.sstatic.net/aeeW3.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/aeeW3.png" alt="enter image description here" /></a></p>
<p>This is ... | <python><matplotlib><seaborn><boxplot><violin-plot> | 2023-09-29 16:59:25 | 0 | 1,014 | Aditya Bhattacharya |
77,203,546 | 8,040,369 | Label Encoding of Categorical values for Future df | <p>I am building a model where <code>LabelEncoding</code> of 2 categorical columns is a better approach. So I had implemented the same on the <code>train_df</code> and finalized the model.</p>
<p>And for predicting the <code>test_df</code>, I used to fit the 2 categorical columns on <code>train_df</code> and then trans... | <python><machine-learning><scikit-learn><label-encoding> | 2023-09-29 16:40:48 | 1 | 787 | SM079 |
77,203,530 | 4,529,487 | Python Popen Subprocess - interacting with executable not possible until stdin is closed | <p>I am trying to interact with a Commandline Executable, but I am stucked.
I would like to print out every line, the .exe is producing to stdout.
Until I get "condition" in a line -> then it should write "y\n" to stdin</p>
<p>This works, but as soon as I am writing to stdin, I don't get any stdo... | <python><subprocess><stdout><stdin><popen> | 2023-09-29 16:38:42 | 1 | 675 | Manuel |
77,203,353 | 2,123,706 | Add column to existing SQL table usig sqlalcehmy | <p>I have a sqlalchemy connection and an existing table</p>
<pre><code>database_con = f'mssql://@{server}/{database}?driver={driver}'
engine = create_engine(database_con)
con = engine.connect()
tbl = '#temp'
df = pd.DataFrame({'col1':[1,2,3], 'col2':['a','b','c']})
df.to_sql(
name=tbl,
con=con... | <python><sqlalchemy> | 2023-09-29 16:05:26 | 1 | 3,810 | frank |
77,203,229 | 18,878,905 | Compare 1 independent vs many dependent variables using plotly in a horizontal plot | <p>I'm looking for the answer to the same question as on <a href="https://stackoverflow.com/questions/31966494/compare-1-independent-vs-many-dependent-variables-using-seaborn-pairplot-in-an-h">Compare 1 independent vs many dependent variables using seaborn pairplot in an horizontal plot</a> but using Plotly.</p>
<p>I'v... | <python><plotly> | 2023-09-29 15:43:22 | 0 | 389 | david serero |
77,203,214 | 1,820,665 | python-daemon pidfile is not created | <p>I implement a Python daemon that uses <code>python-daemon</code> to daemonize.</p>
<p>A stripped down minimal example would be:</p>
<pre><code>import daemon
import daemon.pidfile
import threading
import syslog
import signal
class Runner:
def run(self):
syslog.syslog("Running something")
d... | <python><pid><python-daemon><lockfile> | 2023-09-29 15:41:07 | 1 | 1,774 | Tobias Leupold |
77,202,887 | 7,158,019 | Cannot install mysqlclient on Elastic BeanStalk Instance | <p>How can I get pip to install mysqlclient in Amazon Linux 2/Python 3.8 instance?</p>
<p>I am deploying a Django application to Elastic Bean Stalk. While the deployment process is running <code>pip install -r requirements.txt</code>, it fails and I get this error on eb-engine.log.</p>
<pre><code> × Getting requiremen... | <python><amazon-web-services><amazon-ec2><amazon-elastic-beanstalk><mysql-python> | 2023-09-29 14:45:52 | 1 | 669 | ytobi |
77,202,849 | 8,938,220 | python dbf query between two dates | <p>I am using <a href="http://pypi.python.org/pypi/dbf/" rel="nofollow noreferrer">dbf module</a>. I need to search (query) all the products where invoice date between 2023-01-23 to 2023-01-25, include both dates.</p>
<p>I have dbf table ( product.dbf ) with below data</p>
<pre><code>invno invdt hsn mname... | <python><dbf> | 2023-09-29 14:41:26 | 2 | 343 | Ravi Kannan |
77,202,787 | 9,484,595 | Grouping in assigning colors to plotly histogram | <p>I am trying to get started with using Dash and I have a simple problem. I have a data table</p>
<pre><code>Index, Product, Customer_Age, Revenue
1, A, 12, 10
2, B, 99, 12
</code></pre>
<p>and so on.</p>
<p>I want to plot the revenue per product as a histograms. However, I want to have the bars split into different c... | <python><pandas><plotly><histogram><plotly-dash> | 2023-09-29 14:31:43 | 1 | 893 | Bubaya |
77,202,743 | 2,535,207 | How to efficiently implement forward fill in pytorch | <p>How can I efficiently implement the fill forward logic (inspired for pandas <code>ffill</code>) for a vector shaped NxLxC (batch, sequence dimension, channel). Because each channel sequence is independent this can be equivalent to working with a tensor shaped (N*C)xL.</p>
<p>The computation should keep the torch var... | <python><pytorch> | 2023-09-29 14:26:48 | 5 | 2,682 | Jeremy Cochoy |
77,202,550 | 1,726,779 | how to mock a function in pytest monkeypatch? | <p>I am trying to mock a simple function but I get an AttributeError and have no clue on how to fix it.</p>
<pre><code>def my_function():
return "original"
def mock_my_function():
return "mocked"
def test_my_function(monkeypatch):
monkeypatch.setattr(__name__, 'my_function', mock_my_fu... | <python><pytest><monkeypatching> | 2023-09-29 13:59:24 | 2 | 2,460 | vmp |
77,202,430 | 13,944,524 | understanding ContextVar object in Python | <p>Here is a simple echo server that works correctly as expected - by "correctly" I mean, in the output we see that every user gets its own unique address when echoing inside <code>listen_for_messages</code>.</p>
<pre class="lang-py prettyprint-override"><code>import asyncio
from contextvars import ContextVar... | <python><python-3.x><asynchronous><python-asyncio><python-contextvars> | 2023-09-29 13:40:46 | 1 | 17,004 | S.B |
77,202,380 | 3,731,823 | How to install tensorflow-gpu from anaconda? | <p>I have run some very basic steps (<a href="https://anaconda.org/conda-forge/tensorflow-gpu" rel="noreferrer">tensorflow-gpu</a> is currently at 2.12.1):</p>
<pre><code>conda create --name py311_tf212 python=3.11 numpy numba scipy spyder pandas
conda activate py311_tf212
time conda install -c conda-forge tensorflow-g... | <python><tensorflow><anaconda> | 2023-09-29 13:33:13 | 4 | 4,208 | NikoNyrh |
77,202,326 | 685,683 | How do I get smooth text with pythons PIL? | <p>In my Script I open a tiff image and have to paste some text on it in the bottom right corner with PIL. So far so good. But the quality of the text is unusable! The the text should be white. Instead it has pixels cut out. It looks as though, when copying the text onto the original image, there is a cutoff on the alp... | <python><python-imaging-library> | 2023-09-29 13:26:03 | 1 | 311 | habsi |
77,202,124 | 6,243,129 | Pycharm unable to debug the Python Flask project | <p>I have a simple Flask based project in Pycharm. I am trying to debug this by right clicking and selecting debug option. But keeps getting below error:</p>
<pre><code>Connected to pydev debugger (build 232.9559.58)
* Serving Flask app 'app'
* Debug mode: on
WARNING: This is a development server. Do not use it in a ... | <python><flask><debugging><pycharm> | 2023-09-29 12:57:31 | 2 | 7,576 | S Andrew |
77,201,890 | 12,015,249 | Read/write for different key-pairs in the same dicitonary at the same time will have race condition? | <p>Basically I have one single python dictionary for people to read/write, let's call it diction ary <code>a</code>, and I have two async functions to do actions about this dictionary: <code>write</code> and <code>delete</code>. <br>
The functions to write is discord-server based, which means the key-pair structure is ... | <python><dictionary><discord><python-asyncio><race-condition> | 2023-09-29 12:20:42 | 1 | 646 | TimG233 |
77,201,862 | 12,466,687 | How to install Java manually using .rpm files on cloud (streamlit) using python script? | <p>I am new to <code>unix</code> & <code>cloud</code> not from IT background and not sure how to install <code>Java</code> manually on cloud. I am trying to install Java on <code>streamlit</code> to be able to use <code>Pyspark</code>.</p>
<p>I have tried below code but not sure how to <strong>install</strong> usin... | <python><java><pyspark><streamlit> | 2023-09-29 12:17:01 | 2 | 2,357 | ViSa |
77,201,842 | 9,370,018 | How to read specific frames from a video using OpenCV's Cuda Video Reader in Python? | <p>I've compiled OpenCV 4.8.0 with Cuda 10.2, cudNN 7.6.5.32, Video_Codec_SDK_12.1.14, and am running it on Python 3.9.13. I'm trying to read specific frames from a video file (video.mkv) using OpenCV's Cuda Video Reader, similar to how I would with the CPU-based VideoCapture.</p>
<p>Here's how I would do it using Vide... | <python><c++><opencv><video> | 2023-09-29 12:13:14 | 0 | 992 | Vaio |
77,201,787 | 22,466,650 | How to create a scatter plot with normalized marker transparencies | <p>I have this dataframe :</p>
<pre><code>import pandas as pd
import matplotlib.pyplot as plt
rng = np.random.default_rng(seed=111)
rints = rng.integers(low=0, high=1000, size=(5,5))
df = pd.DataFrame(rints)
0 1 2 3 4
0 474 153 723 169 713
1 505 364 658 854 767
2 718 109 141 797 463
3 ... | <python><pandas><matplotlib><scatter-plot><transparency> | 2023-09-29 12:05:04 | 1 | 1,085 | VERBOSE |
77,201,740 | 9,018,649 | Can someone explain how spark rdd.map decides to read lines insted of words from a textfile? | <p>I have the current code</p>
<pre><code>lines = sc.textFile("file:///SparkCourse/ml-100k/u.data")
ratings = lines.map(lambda x: x.split()[2])
result = ratings.countByValue()
</code></pre>
<p>According to this, 'x' ends up representing a line in text-file:
Excerpt from text-file:</p>
<pre><code>196 242 3 8... | <python><apache-spark><functional-programming> | 2023-09-29 11:57:34 | 2 | 411 | otk |
77,201,383 | 10,430,394 | Store telegram_send API keys on a linux machine and use in python while keeping them private? | <p>I have a bit of a headscratcher on my hands that I am not sure what to do with (or if it is even possible). I have written a script for batch runs of a program called ORCA (quantum chemistry calculation software). It runs on a PC that is available to the entire working group at my uni.</p>
<p>These calculations can ... | <python><bash><telegram> | 2023-09-29 10:57:31 | 0 | 534 | J.Doe |
77,201,374 | 1,586,108 | Alembic - Attempting to autogenerate revision throws "sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:postgresql.psycopg" | <p>Edit: The outputs below were run on Windows with Git bash.</p>
<hr />
<p>I am new to Alembic and SQLAlchemy.</p>
<p>I have been tasked with adding Alembic support to an existing FastAPI + SQLAlchemy application. To this end, I have done some preliminary setup by calling <code>alembic init</code> and updated the <cod... | <python><sqlalchemy><alembic> | 2023-09-29 10:55:26 | 1 | 323 | SargentD |
77,200,902 | 2,030,026 | Why does this function passed as an argument to another function return None? | <pre class="lang-py prettyprint-override"><code>def run_my_func(runner, *args, **kwargs):
runner(*args)
def my_func(name):
return name
out = run_my_func(my_func, "my name is john", kwargs=None)
print(out)
</code></pre>
<p>Why does this print out <code>None</code>?</p>
<p>If I print out the ... | <python><function> | 2023-09-29 09:40:44 | 3 | 1,928 | himmip |
77,200,817 | 1,050,187 | Generalized Goertzel algorithm for better peaks detection than FFT: shifted frequencies with real data? | <p>I have translated the algorithm of the <strong>Generalized</strong> Goertzel technique in Python from the Matlab code that can be found <a href="https://it.mathworks.com/matlabcentral/fileexchange/35103-generalized-goertzel-algorithm" rel="nofollow noreferrer">here</a>.</p>
<p>I have trouble using it on real data an... | <python><fft><frequency-analysis><goertzel-algorithm> | 2023-09-29 09:25:00 | 1 | 623 | fede72bari |
77,200,794 | 10,413,428 | Use match case to handle exceptions | <p>I have a method that receives an exception of type Exception as a parameter and I want to filter which exceptions to show to the user and which to show as general errors.</p>
<p>Since I have more than 10 of these exceptions in the real code, I wanted to use a match case that filters out the different cases.</p>
<p>I... | <python><python-3.x> | 2023-09-29 09:22:07 | 1 | 405 | sebwr |
77,200,781 | 5,010,875 | SQL Alchemy results to Excel conversion in my Flask project | <p>I am a Python novice. I am writing a simple Flask app. I am running into a problem when I try to generate a Excel report from a SQL Alchemy query result. The error I get is:</p>
<blockquote>
<p>TypeError: Value must be a list, tuple, range or generator, or a dict. Supplied value is <class 'dict_keys'></p>
</bl... | <python><flask><flask-sqlalchemy> | 2023-09-29 09:20:02 | 1 | 347 | Steve |
77,200,580 | 7,648,377 | django.db.utils.InterfaceError: connection already closed on unit tests with postgres | <p>My unit tests are working perfectly on sqlite but I'm trying to make them work on postgres. I'm using python 3.6 and Django 2.2.28.</p>
<p>Unit test fails when Django tries to auth the user:</p>
<pre><code>.tox/commonenv/lib/python3.6/site-packages/django/http/response.py:169: in set_cookie
self.cookies[key] = v... | <python><django><pytest> | 2023-09-29 08:49:20 | 1 | 2,762 | Andrei Lupuleasa |
77,200,508 | 1,818,059 | Multiply PDF pages from different documents, with blanks inbetween | <p>I have been asked to create a PDF document consisting of (many) duplicate pages of first page of different documents. I need to have a blanks inbetween.</p>
<p>Example: given PDF documents <code>A</code> and <code>B</code> my new document could be</p>
<pre class="lang-none prettyprint-override"><code>A1 A1 A1 ... A1... | <python><pdf> | 2023-09-29 08:35:57 | 4 | 1,176 | MyICQ |
77,200,419 | 8,219,760 | Bulk create many-to-many objects to self | <p>Having model</p>
<pre class="lang-py prettyprint-override"><code>class MyTable(Model):
close = ManyToManyField("MyTable")
</code></pre>
<p>How to bulk create objects to this relation?</p>
<p>With tables not related to itself, one could use</p>
<pre class="lang-py prettyprint-override"><code>db_payload... | <python><django> | 2023-09-29 08:21:02 | 1 | 673 | vahvero |
77,200,077 | 9,099,423 | Doesnt' follow PyTorch's LRScheduler API - Rewrite function into lambda (lr_lambda) | <p>Is there anyone to know how to rewrite the following lr_lambda <code>def</code> into <code>Lambda</code> format</p>
<pre><code>from torch.optim.lr_scheduler import LambdaLR
def cosine_scheduler(optimizer, training_steps, warmup_steps):
def lr_lambda(current_step):
if current_step < warmup_steps:
... | <python><pytorch><pytorch-lightning> | 2023-09-29 07:13:48 | 1 | 2,109 | W Kenny |
77,200,020 | 128,618 | sum the list of dictionary if there are the same key using pandas | <pre><code>import pandas as pd
customer1 = {'name': 'John Smith',"qty": 10, 'income': 35, 'email': 'john.smith1@email.com'}
customer2 = {'name': 'John Smith', "qty": 10,'income': 28, 'phone': '555-555-5555',"other": "something", 'email': 'john.smith@email.com'}
customer3 = {'name... | <python><python-3.x><pandas> | 2023-09-29 07:02:47 | 1 | 21,977 | tree em |
77,199,972 | 742,033 | LLM model is very slow | <p>I'm running a 34b <a href="https://huggingface.co/Phind/Phind-CodeLlama-34B-v2" rel="nofollow noreferrer">LLM model</a> on an nvidia g5.8xlarge instance (1 Nvidia A10G GPU, 24GB GPU RAM, 32 vCPU, 128GB RAM)</p>
<p>Here is the code for the inference</p>
<pre><code>from transformers import AutoTokenizer,LlamaForCau... | <python><machine-learning><large-language-model><llama> | 2023-09-29 06:54:14 | 0 | 2,642 | Abhijith |
77,199,725 | 1,581,090 | Redirection of python script output to file not working | <p>I have a simple python file on a Linux VM</p>
<pre><code>import time
while True:
print("test")
time.sleep(10)
</code></pre>
<p>which I start with</p>
<pre><code>python test.py > test.log
</code></pre>
<p>but even after a longer time that file is empty</p>
<pre><code>-rwxrwx--- 1 root vboxsf ... | <python><linux> | 2023-09-29 06:00:28 | 1 | 45,023 | Alex |
77,199,597 | 843,400 | Mypy complaining "unsupported right operand type for in ("object") and "object" has no attribute "get" but interpreter runs fine? | <p>I have some really simply python code running and I don't understand why mypy is complaining about it. I am kind of new to using Python, so maybe it's obvious, but I haven't had much luck.</p>
<p>I have this dict:</p>
<pre><code> DEFAULTS = {
"environments": {
"beta": {
... | <python><mypy> | 2023-09-29 05:24:09 | 1 | 3,906 | CustardBun |
77,199,304 | 7,709,727 | How to use mock.patch with wraps on a class method? | <p>I am using <code>unittest.mock.patch</code> with <code>wraps</code> to mock a function while being able to access the original function. For example:</p>
<pre class="lang-py prettyprint-override"><code>from unittest import mock
def f(x, y):
return x * y
print(f(2, 3)) # output: 6
original_f = f
def m(x, y):
... | <python><mocking> | 2023-09-29 03:32:55 | 1 | 1,570 | Eric Stdlib |
77,199,237 | 5,942,100 | Tricky calculation refresh based on columns using Pandas | <p>Logic is to add the value in the new_r_aa after the first line of code output under 'aa_cumul' Example, the code will take 3 (which is the first output under 'aa_cumul') and sum it with the value 8 under the 'new_r_aa' column. This will result in 3+8 = 11 11+9=20, 20+ 8=28, 28+8=36 and so on. But remember the f... | <python><pandas><numpy> | 2023-09-29 03:01:09 | 1 | 4,428 | Lynn |
77,198,918 | 5,924,264 | SQL query from date column (represented as an int) returns a datetime.date object | <p>I have a sql table with a single row. It has a column <code>date</code> with the entry <code>20230906</code>.
In the program I am using, when I do:</p>
<pre><code>query = "select max(date) from table_name"
print("res max", cursor.execute(query).fetchall()[0][0])
query = "select date from tab... | <python><sql><sqlite><datetime> | 2023-09-29 00:35:24 | 0 | 2,502 | roulette01 |
77,198,874 | 20,771,478 | Send mail from Outlook with Python and Graph API - Authentication Problem | <p>I have written a Python script that uses the <a href="https://github.com/vgrem/Office365-REST-Python-Client" rel="nofollow noreferrer">office365</a> library and loads Excel files from SharePoint to my local system. From there I push selected content via SQL Alchemy to a SQL server.</p>
<p>This process is to run dail... | <python><microsoft-graph-api><office365> | 2023-09-29 00:12:19 | 1 | 458 | Merlin Nestler |
77,198,755 | 3,326,666 | Expand list of tuples | <p>I have a big list of tuples (20-30 million entries). Each sub-tuple has three pieces of information <code>(start, end, value)</code> and is supposed to only represent one position in a sequence. However, the program generating this data has concatenated some of the values of adjacent positions if the value is the sa... | <python><for-loop><tuples> | 2023-09-28 23:22:50 | 2 | 1,597 | G_T |
77,198,734 | 5,942,100 | Tricky create calculation that pulls in retro values using Pandas | <p>I have a dataset where I would like to create a new column called 'aa_cumul', by taking the sum, (Where the first instance of a numerical value occurs) for a specific city and ID of the value in the column,'new_r_aa', which is 2, and the value in the column 'cml_aa_bx', 1 = 3.
From there we will take the cumulative ... | <python><pandas><numpy> | 2023-09-28 23:12:17 | 2 | 4,428 | Lynn |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.