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 ⌀ |
|---|---|---|---|---|---|---|---|---|
74,974,103 | 1,788,656 | Reading netcdf time with unit of years | <p>All,
I am trying to read the time coordinate from Berkley Earth in the following temperature file. The time spans from 1850 to 2022. The time unit is in the year A.D. (1850.041667, 1850.125, 1850.208333, ..., 2022.708333, 2022.791667,2022.875).</p>
<p>The <code>pandas.to_datetime</code> cannot correctly interpret t... | <python><python-3.x><pandas><python-2.7><datetime> | 2023-01-01 10:24:55 | 1 | 725 | Kernel |
74,974,056 | 15,342,452 | Is there a faster way to compress files/make an archive in Python? | <p>I'm making archive of a folder that has around ~1 GB of files in it. It takes like 1 or 2 minutes but I want it to be faster.</p>
<p>I am making a UI app in Python that allows you to ZIP files (it's a project, I know stuff like 7Zip exists lol), and I am using a folder with ~1GB of files in it, like I said. The prog... | <python><python-3.x><shutil> | 2023-01-01 10:13:01 | 1 | 496 | WhatTheClown |
74,973,982 | 7,849,631 | Selenium - How to find an element by part of the placeholder value? | <p>Is there any way to find an element by a part of the placeholder value? And ideally, case insensitive.</p>
<p><code><input id="id-9" placeholder="some TEXT"></code></p>
<p>Search by the following function doesn't work</p>
<p><code>browser.find_element(by=By.XPATH, value="//input[@place... | <python><selenium><selenium-webdriver><xpath><placeholder> | 2023-01-01 09:54:10 | 2 | 487 | Mike |
74,973,975 | 6,273,451 | Python: calling a private method within static method | <p>What is the correct way and best practice to call a private method from within a static method in <strong><code>python 3.x</code></strong>? See example below:</p>
<pre><code>class Class_A:
def __init__(self, some_attribute):
self.some_attr = some_attribute
def __private_method(arg_a):
print(... | <python><python-3.x><oop><static-methods><private-methods> | 2023-01-01 09:51:08 | 0 | 334 | Mehdi Rezzag Hebla |
74,973,663 | 6,320,774 | combine multiple dict with different keys but to a dataframe | <p>I am trying to create a dataframe from a dict with different key names.</p>
<p>Here is a MWE:</p>
<pre><code># loads price data
from yahoofinancials import YahooFinancials
yahoo_tickers = ['SMT.L', 'MSFT', 'NIO']
yahoo_financials = YahooFinancials(yahoo_tickers)
data = yahoo_financials.get_historical_price_data(... | <python><pandas><dictionary> | 2023-01-01 08:15:15 | 2 | 1,581 | msh855 |
74,973,455 | 13,000,695 | AWS Cloudwatch synthetics - how to install external dependencies for runnning canaries | <p>I have a python selenium script that needs a third party library ('redis' package for instance).
I would like to run this script as an AWS cloudwatch synthetic canary. But it fails because it does not have this library installed.</p>
<p>So far I did not find in the <a href="https://docs.aws.amazon.com/AmazonCloudWat... | <python><amazon-web-services><selenium><amazon-cloudwatch> | 2023-01-01 07:04:19 | 1 | 4,032 | jossefaz |
74,973,437 | 4,215,840 | Database more efficient way storing the referral to 1'st table in every line in the 2'nd table | <p>I have 2 tables on my DB</p>
<p><a href="https://i.sstatic.net/d14G3.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/d14G3.png" alt="enter image description here" /></a></p>
<p>I want to avoid the <strong>"account ref"</strong> for every line in dates table, is there a way to keep fast fetch... | <python><database><postgresql> | 2023-01-01 06:55:59 | 0 | 451 | Sion C |
74,973,427 | 7,347,925 | How to concatenate csv files and continue the last row value? | <p>I have multiple csv files which have <code>case</code> column which begins from 0.</p>
<p>I want to concatenate them by setting the last <code>case</code> value +1 as the beginning value of the next one.</p>
<p>I know I can create a for loop to read each csv file and add the last value to the <code>case</code> colum... | <python><pandas> | 2023-01-01 06:52:03 | 2 | 1,039 | zxdawn |
74,973,347 | 13,097,857 | I can't run a function in a loop for certain amount of time | <p>ok, so I have this function that consists in a game that will always return a random value,</p>
<p>and the thing is that I want to run this function 10,000 times to receive 10,000 different values, and it works when I run it individually, but when I run it with a loop, it shows me this error:</p>
<p>Loop:</p>
<pre><... | <python><python-3.x><function><loops><error-handling> | 2023-01-01 06:19:41 | 2 | 302 | Sebastian Nin |
74,973,249 | 3,667,693 | Pandas merge not working as expected in streamlit | <h3>Summary</h3>
<p>When using pandas <em>merge</em> function within a callback function, the dataframe is not updated correctly. However, the pandas <em>drop</em> function works as expected</p>
<p>Note that although i have turned on st.cache. The same behavior is noted when removing the cache function as well.</p>
<h3... | <python><pandas><streamlit> | 2023-01-01 05:34:47 | 1 | 405 | John Jam |
74,973,096 | 5,029,589 | Insert JSON Array into Elasticsearch Using Python Bulk API | <p>I have a JSON array of 100 records , I want to insert it into elasticsearch ,I tried it using the below code but it gives me JSON Error exception . I am not sure where I am doing it wrong . The code which I am using to insert record is</p>
<pre><code>
from esService.esClient import ESCient
from elasticsearch.helpers... | <python><json><elasticsearch> | 2023-01-01 04:25:12 | 1 | 2,174 | arpit joshi |
74,973,032 | 3,099,733 | Can I use a typing.Callable type to annotate a function automatically? How? | <p>Suppose we define a type for a callback like so:</p>
<pre class="lang-py prettyprint-override"><code>CallbackFn = Callable[[str, str, int, int], None]
</code></pre>
<p>When I want to implement a callback function, and have external tools type-check it against <code>CallbackFn</code>, I have to annotate the types exp... | <python><python-typing> | 2023-01-01 03:49:24 | 2 | 1,959 | link89 |
74,972,995 | 10,597,313 | OpenCV - AWS Lambda - /lib64/libz.so.1: version `ZLIB_1.2.9' not found | <p>In Python, trying to run the opencv package in an AWS lambda layer. Using opencv-python-headless but keep getting this error.</p>
<pre><code>Response
{
"errorMessage": "Unable to import module 'lambda_function': /lib64/libz.so.1: version `ZLIB_1.2.9' not found (required by /opt/python/lib/python3.8/... | <python><amazon-web-services><lambda><aws-lambda> | 2023-01-01 03:31:14 | 4 | 389 | John Welsh |
74,972,850 | 11,070,463 | jax.lax.select vs jax.numpy.where | <p>Was taking a look at the <a href="https://flax.readthedocs.io/en/latest/_modules/flax/linen/stochastic.html#Dropout" rel="nofollow noreferrer">dropout implementation in flax</a>:</p>
<pre class="lang-py prettyprint-override"><code>def __call__(self, inputs, deterministic: Optional[bool] = None):
""&quo... | <python><numpy><machine-learning><deep-learning><jax> | 2023-01-01 02:11:45 | 1 | 4,113 | Jay Mody |
74,972,685 | 17,148,496 | Feature importance using gridsearchcv for logistic regression | <p>I've trained a logistic regression model like this:</p>
<pre><code>reg = LogisticRegression(random_state = 40)
cvreg = GridSearchCV(reg, param_grid={'C':[0.05,0.1,0.5],
'penalty':['none','l1','l2'],
'solver':['saga']},
c... | <python><matplotlib><scikit-learn><logistic-regression> | 2023-01-01 00:48:19 | 1 | 375 | Kev |
74,972,602 | 6,635,590 | SQLite select subquery return multiple rows as a list in column | <p>So I've redesigned my database after I realized it can be made better by splitting previous columns that were "lists" (a string of words/strings split by a space), into different tables instead.</p>
<p>My issue is that I need to get the file names from one table that have a certain <code>uid</code> that re... | <python><sqlite> | 2023-01-01 00:07:46 | 1 | 734 | tygzy |
74,972,493 | 4,931,135 | Are "map" and "filter" subclasses of the class "iterator"? | <p>I read in the python documentation that <code>map</code> and <code>filter</code> return "iterator" object.
but when I check the type of the returned object, I find that it's of type <code><class 'filter'></code> and <code><class 'map'></code></p>
<pre><code>x = [1,2,3,4]
print(type(filter(lambd... | <python><python-3.x> | 2022-12-31 23:22:08 | 1 | 1,763 | Bassel |
74,972,442 | 159,072 | How can I send a request to flask socket.io with the click of a button? | <p>The following source code sends a request to the server upon page load, and when the task is done, the page is updated automatically.</p>
<p><strong>app.py</strong></p>
<pre><code>from flask import Flask, render_template
from flask_socketio import SocketIO, emit, disconnect
from time import sleep
async_mode = None... | <python><flask><flask-socketio> | 2022-12-31 23:02:55 | 1 | 17,446 | user366312 |
74,972,396 | 3,313,563 | Plot `semilogx` graph for Euclidean distances matrix | <p>I am struggling to make a <code>semilogx</code> plot for the Euclidean distances matrix. I want a single line to show the differences, but the Euclidean distances matrix lists different items.</p>
<p>When making the plot using the <code>distance = np.arange(0.05, 15, 0.1) ** 2</code>, the line appears as expected.</... | <python><numpy><matplotlib><matrix> | 2022-12-31 22:47:48 | 1 | 6,121 | mmik |
74,972,126 | 159,072 | Unable to insert data into SQLite table | <p>The following source code is giving me an error:</p>
<pre><code>405 Method not allowed
</code></pre>
<p>when I am pressing [Submit] button.</p>
<ol>
<li>Why is it happening?</li>
<li>How can I fix it?</li>
</ol>
<p><strong>app.py</strong></p>
<pre><code>from flask import Flask, render_template, request, redirect
fro... | <python><flask><sqlalchemy> | 2022-12-31 21:21:19 | 1 | 17,446 | user366312 |
74,972,054 | 20,433,449 | I'm trying make a list into a string in Python | <p>I change the list into a string but it is not printing on the same line</p>
<pre><code>spam= ['apples', 'bananas', 'tofu', 'cats']
for i in spam:
print(str(i))
</code></pre>
| <python><string><list> | 2022-12-31 20:58:32 | 1 | 619 | DarkPhinx |
74,971,956 | 7,973,902 | FuelSDK: use get() to pull salesforce items into a dataframe | <p>I'm attempting to use Salesforce FuelSDK to pull audit items (i.e. click events, unsub events, bounce events, etc.) from our client's Marketing Cloud. I'm sure this is down to my inexperience with APIs, but although I'm able to get a success code from "get()", I'm not sure how to pull the actual content. T... | <python><pandas><soap><get><salesforce> | 2022-12-31 20:30:32 | 1 | 434 | lengthy_preamble |
74,971,910 | 5,053,347 | how to remove confidance interval in pairplot? | <p>May you please help to remove the confidence interval in the seaborn pairplot.</p>
<pre><code>import seaborn as sns
penguins = sns.load_dataset("penguins")
sns.pairplot(penguins,kind="reg")
</code></pre>
<p>I know it is possible in regplot or lmplot using ci=None, but I would like the same functi... | <python><seaborn><pairplot> | 2022-12-31 20:16:21 | 1 | 497 | Seyed Omid Nabavi |
74,971,907 | 15,520,615 | PySpark / Python Slicing and Indexing Issue | <p>Can someone let me know how to pull out certain values from a Python output.</p>
<p>I would like the retrieve the value 'ocweeklyreports' from the the following output using either indexing or slicing:</p>
<pre><code>'config': '{"hiveView":"ocweeklycur.ocweeklyreports"}
</code></pre>
<p>This shou... | <python><apache-spark><pyspark><azure-databricks> | 2022-12-31 20:15:34 | 3 | 3,011 | Patterson |
74,971,896 | 4,796,942 | clear validated cells using a batch update using pygsheets | <p>I have a pygsheets work sheet with cells that have been filled in and would like to clear the cells after pulling the data into python.</p>
<p>My issue is that I have validated the cells with a particular data format then when I try to batch update the sheet the cells are either not going empty (if I use <code>None<... | <python><google-sheets><formatting><gspread><pygsheets> | 2022-12-31 20:13:17 | 1 | 1,587 | user4933 |
74,971,599 | 7,778,016 | Generating a maze in python and saving it into an image file resolves in to a black image | <p>I split the code into two sections for easier viewing as it's little long. I have the following code that generates a maze in python and prints it into the terminal. This part of code works as expected:</p>
<pre><code>import random
from PIL import Image
# The width and height of the maze
width = 30
height = 30
# T... | <python><python-imaging-library><maze> | 2022-12-31 19:05:40 | 1 | 1,012 | P_n |
74,971,536 | 6,663,588 | Reorder expression in descending negtive power of a variable using Sage or Sympy | <p>I have an expression</p>
<pre class="lang-py prettyprint-override"><code>1/24*(8*(l + 1)*l + 5*(2*E*(l + 1)*l + 3)/E - 6)/E
</code></pre>
<p>I want to reorder it to the form</p>
<pre class="lang-py prettyprint-override"><code>a * E**1 + b * E**0 + c * E**(-1) + d * E**(-2) + ...
</code></pre>
<p><code>sympy.simplify... | <python><sympy><sage> | 2022-12-31 18:54:47 | 1 | 652 | IvanaGyro |
74,971,337 | 3,361,975 | Python numpy dataframe conditional operation (e.g. sum) across two dataframes | <p>I'm trying to calculate a conditional sum that involves a lookup in another dataframe.</p>
<pre><code>import pandas as pd
first = pd.DataFrame([{"a": "aaa", "b": 2, "c": "bla", "d": 1}, {"a": "bbb", "b": 3, "c": "... | <python><pandas><dataframe> | 2022-12-31 18:11:55 | 2 | 1,653 | SCBuergel |
74,971,083 | 14,391,210 | Pandas losing inheritance when subsetting dataframe | <p>I made my own pandas class to add some custom methods, here's the code</p>
<pre><code>Class Mypandas(pd.DataFrame):
def foo(sefl):
return self
</code></pre>
<p>When I run the following, I get an AttributeError saying 'DataFrame' object has no attribute</p>
<pre><code>df = Mypandas(df)
df = df.query('c... | <python><pandas><class> | 2022-12-31 17:18:13 | 0 | 621 | Marc |
74,971,030 | 8,602,367 | How to convert encoded unicode string to native string in Python | <p>How do I convert a string that looks like the following:</p>
<pre><code>s1 = u'MDcxNTFjZWU5MzQ2MTRjZmZiOWIyNTBhYjJlZDhkODY0OTEyYmE2Yjp7ImFjdHVhbF9jcmVhdGVkX3RpbWVzdGFtcCI6ICIxNjcyNDg5NjAxLjMyOTg5MyIsICJhY3R1YWxfaWQiOiAiYWhGa1pYWi1ibWxuYUhSc2IyOXdMVzVsZDNJakN4SWJibWxuYUhSc2IyOXdYMUpsYzJWeWRtRjBhVzl1UVdOMGRXRnNHTUc3QV... | <python><python-3.x><python-2.7> | 2022-12-31 17:09:39 | 1 | 1,605 | Dave Kalu |
74,970,947 | 5,651,481 | How to identify inputs for a diffusion model? | <p>I'm calling a Stable Diffusion in-painting model with the following code, however I know there are more parameters available in the model pipeline. How do I identify all the available parameters in <a href="https://huggingface.co/runwayml/stable-diffusion-inpainting" rel="nofollow noreferrer">this stable diffusion i... | <python><huggingface-tokenizers><huggingface><stable-diffusion> | 2022-12-31 16:53:14 | 1 | 1,769 | cormacncheese |
74,970,914 | 7,654,773 | How to create table from function and add to docx document | <p>I have working code that builds a document with several tables using a for-loop.
To keep the code clean I would like to break out the table creation into its own function but cannot see how to do this from the API doc.</p>
<p>Essentially, I want to call a function to create & return a Table() object and then add... | <python><python-docx> | 2022-12-31 16:46:11 | 1 | 696 | Bill |
74,970,894 | 6,663,588 | Solve recurrence with symbols using SymPy: I got None | <p>I tried to solve a recurrence relation.</p>
<p><a href="https://i.sstatic.net/XgcoN.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/XgcoN.png" alt="enter image description here" /></a></p>
<pre class="lang-tex prettyprint-override"><code>$$
\def\r #1{\langle r^{#1} \rangle}
0 = 8 n E \r{n - 1}
+ (... | <python><sympy><sage> | 2022-12-31 16:42:42 | 0 | 652 | IvanaGyro |
74,970,892 | 2,411,604 | Singleton and inheritance overriding | <p>I m stumbling upon singleton and multiple inheritance.</p>
<p>In the following code if i create <strong>slow_grizzly</strong> first i got the expected results.</p>
<p>But if i create <strong>alaska_bear</strong> first the <strong>slow_grizlly</strong> is completelely overridden by <strong>alaska_bear</strong>.</p>
<... | <python><inheritance><singleton> | 2022-12-31 16:42:26 | 0 | 518 | Alexis |
74,970,712 | 9,827,719 | Python JIRA Rest API get cases from board ORDER BY last updated | <p>I have sucessfully managed to get a Jira rest API working with Python code. It lists cases. However, it lists the last 50 cases order by created date. I want to list the 50 cases order by updated date.</p>
<p>This is my Python code:</p>
<pre><code>jiraOptions = {'server': "https://xxx.atlassian.net"}
jira ... | <python><jira> | 2022-12-31 16:12:03 | 1 | 1,400 | Europa |
74,970,507 | 8,384,089 | How do you clip a circle (or any non-Rect) from an image in pygame? | <p>I am using Pygame and have an image. I can clip a rectangle from it:</p>
<pre class="lang-py prettyprint-override"><code>image = pygame.transform.scale(pygame.image.load('example.png'), (32, 32))
handle_surface = image.copy()
handle_surface.set_clip(pygame.Rect(0, 0, 32, 16))
clipped_image = surface.subsurface(hand... | <python><python-3.x><pygame><pygame-surface> | 2022-12-31 15:26:58 | 1 | 762 | Anonymous |
74,970,481 | 7,892,936 | Python: How to match the words in split and non split? | <p>I have a Dataframe as below and i wish to detect the repeated words either in split or non split words:</p>
<p>Table A:</p>
<pre><code>Cat Comments
Stat A power down due to electric shock
Stat A powerdown because short circuit
Stat A top 10 on re work
Stat A top10 on rework
</code></pre>
<p>I wish ... | <python><python-3.x><pandas><dataframe><arraylist> | 2022-12-31 15:22:23 | 2 | 2,521 | Shi Jie Tio |
74,970,255 | 3,010,334 | python -We ResourceWarning not erroring | <p>If I take a simple test script like this, which results in ResourceWarning:</p>
<pre><code>import asyncio
import aiohttp
async def main():
client = aiohttp.ClientSession()
await client.get("https://google.com")
asyncio.run(main())
</code></pre>
<p>Run it with <code>python -bb -We -X dev test.py</... | <python><python-asyncio><warnings> | 2022-12-31 14:44:37 | 1 | 3,364 | Sam Bull |
74,970,235 | 19,238,204 | How to Add another subplot to show Solid of Revolution toward x-axis? | <p>I have this code modified from the topic here:</p>
<p><a href="https://stackoverflow.com/questions/59402531/how-to-produce-a-revolution-of-a-2d-plot-with-matplotlib-in-python">How to produce a revolution of a 2D plot with matplotlib in Python</a></p>
<p>The plot contains a subplot in the XY plane and another subplot... | <python><numpy><matplotlib><plot> | 2022-12-31 14:41:54 | 1 | 435 | Freya the Goddess |
74,970,230 | 5,617,608 | How can I hide my source code in HuggingFace spaces? | <p>I've been trying to figure out how to hide my source code in public HuggingFace spaces, but I wasn't able to find a solution for this. Here is what I've read and tried:</p>
<ol>
<li><p>Using Google Actions to rely on tokens, but the code is synced of course to the HuggingFace space, so it is visible.</p>
</li>
<li><... | <python><huggingface> | 2022-12-31 14:41:11 | 0 | 1,759 | Esraa Abdelmaksoud |
74,970,058 | 6,060,982 | How to type hint results of specific function calls with generic return signature | <p>I believe it is easier to ask this question using a concrete example:</p>
<pre class="lang-py prettyprint-override"><code>import matplotlib.pyplot as plt
_, ax = plt.subplots()
# Pyright: Cannot access member "plot" for type "ndarray[Any, dtype[Any]]"
# Member "plot" is unknown
ax.p... | <python><type-hinting><pyright> | 2022-12-31 14:09:28 | 0 | 700 | zap |
74,970,023 | 7,347,925 | Select rows by column value and include previous row by another column value | <p>Here's an example of DataFrame:</p>
<pre><code>import numpy as np
import pandas as pd
df = pd.DataFrame([
[0, "file_0", 5],
[0, "file_1", 0],
[1, "file_2", 0],
[1, "file_3", 8],
[2, "file_4", 0],
[2, "file_5", 5],
[2, "file... | <python><pandas> | 2022-12-31 14:02:16 | 3 | 1,039 | zxdawn |
74,969,971 | 18,081,244 | FileNotFoundError: Could not find module 'E:\...\exp_simplifier\ExpSim.dll' (or one of its dependencies) | <p>Hope you're having a great day!</p>
<p>I have created an <code>ExpSim.dll</code> file that I compiled from Visual Studio 2022 in a DLL project. Here is the main code:</p>
<pre class="lang-cpp prettyprint-override"><code>#include "ExpressionSimplifier.h"
#include <Windows.h>
#include <Python.h>
... | <python><c++> | 2022-12-31 13:51:07 | 1 | 1,610 | The Coding Fox |
74,969,967 | 6,628,863 | Create all permutations of size N of the digits 0-9 - as optimized as possible using numpy\scipy | <p>i need to create an array of all the permutations of the digits 0-9 of size N (input, 1 <= N <= 10).</p>
<p>I've tried this:</p>
<pre><code>np.array(list(itertools.permutations(range(10), n)))
</code></pre>
<p>for n=6:</p>
<pre><code>timeit np.array(list(itertools.permutations(range(10), 6)))
</code></pre>
<p>... | <python><numpy><scipy> | 2022-12-31 13:50:41 | 1 | 490 | Guy Barash |
74,969,840 | 13,183,164 | Django annotate field value from external dictionary | <p>Lets say I have a following dict:</p>
<pre><code>schools_dict = {
'1': {'points': 10},
'2': {'points': 14},
'3': {'points': 5},
}
</code></pre>
<p>And how can I put these values into my queryset using annotate?
I would like to do smth like this, but its not working</p>
<pre><code>schools = SchoolsExam.objec... | <python><django><django-orm><keyerror><django-annotate> | 2022-12-31 13:30:45 | 1 | 465 | mecdeality |
74,969,645 | 9,078,185 | Kivy widget position not stable as new widgets added | <p>I have a very simple Kivy project where I want to ask the user to input a number and then have the app display some calculations. I start out with the following, which puts the widgets at the top of the screen just as I expect:</p>
<pre><code>class MainApp(App):
def build(self):
self.main = BoxLayout(ori... | <python><kivy> | 2022-12-31 12:49:03 | 1 | 1,063 | Tom |
74,969,579 | 9,640,238 | Format dates on an entire column with ExcelWriter and Openpyxl | <p>I'm trying to write a pandas DataFrame to Excel, with dates formatted as "YYYY-MM-DD", omitting the time. Since I need to write multiple sheets, and I want to use some advanced formatting opens (namely setting the column width), I'm using an <code>ExcelWriter</code> object and <code>openpyxl</code> as engi... | <python><pandas><date><openpyxl> | 2022-12-31 12:37:46 | 2 | 2,690 | mrgou |
74,969,550 | 1,745,291 | How to display app logs in nginx-unit docker? | <p>I am using the official nginx unit docker image, And I would like to run a hello world wsgi application, and being able to print stuff on docker-compose output.</p>
<p>How can I do that ?</p>
<p>Here the hello world:</p>
<pre><code>print('DURING INITIAL SETUP')
def application(environ, start_response):
print('DUR... | <python><docker><logging><wsgi><nginx-unit> | 2022-12-31 12:33:08 | 0 | 3,937 | hl037_ |
74,969,462 | 11,985,743 | Catch a Python exception that a module already caught | <p>I am using the <code>requests</code> Python module to connect to a website through a SOCKS4 proxy. While trying to connect to the website, the program fails to even connect to the SOCKS4. Therefore, the <a href="https://pypi.org/project/PySocks/" rel="nofollow noreferrer">PySocks</a> module throws a <code>TimeoutErr... | <python><exception> | 2022-12-31 12:19:40 | 1 | 3,666 | Xiddoc |
74,969,359 | 2,313,176 | Using local project installs (also called editable installs) with root user | <p>Using git submodules I put the library <code>my-pkg</code> into a subfolder of my scripts. In <code>my-pkg</code> there is a valid package structure for a package <code>my_pkg</code>.</p>
<pre><code>my-pkg/
├─ setup.cfg
├─ setup.py
├─ my_pkg
| ├─ __init__.py
...
</code></pre>
<p>It is possible to <code>pip install ... | <python><pip><pypi> | 2022-12-31 11:59:01 | 0 | 369 | Telcrome |
74,969,352 | 757,714 | Altair: change point symbol | <br>
I use the code below to create this faceted chart:
<p><a href="https://vega.github.io/editor/#/gist/a9f238f389418c106b7aacaa10561281/spec.json" rel="nofollow noreferrer">https://vega.github.io/editor/#/gist/a9f238f389418c106b7aacaa10561281/spec.json</a></p>
<p>I would like to use another symbol (a dash in example)... | <python><charts><symbols><point><altair> | 2022-12-31 11:58:14 | 1 | 5,837 | aborruso |
74,969,204 | 7,500,268 | write a train routine in class with pytorch | <p>I want to write a train function in a class for training a model; The following code reported an error; can anyone give me a hint for solving this issue?</p>
<pre><code>import numpy as np
import os
import sys
sys.executable
sys.version
##define a neuralnet class
import torch
from torch import nn
from torch.utils.dat... | <python><python-3.x><pytorch> | 2022-12-31 11:28:16 | 1 | 797 | Z. Zhang |
74,969,067 | 5,678,057 | How to query dates in pandas using pd.DataFrame.query() | <p>When querying rows in a dataframe based on a datcolumn value, it works when comparing just the year, but not for a date.</p>
<pre><code>fil1.query('Date>2019')
</code></pre>
<p>This works fine. However when giving complete date, it fails.</p>
<pre><code>fil1.query('Date>01-01-2019')
#fil1.query('Date>1-1-20... | <python><pandas> | 2022-12-31 10:58:27 | 3 | 389 | Salih |
74,969,012 | 18,313,588 | replace column values with values in another list when values appear in a specific list | <p>Hi I have a list and a pandas dataframe</p>
<pre><code>[ apple, tomato, mango ]
</code></pre>
<pre><code>values
tomato
pineapple
apple
banana
mango
</code></pre>
<p>I would like to replace the column values that appear in the list with the values in the new list as follow</p>
<pre><code>[ fruit1, fruit2, fruit3 ... | <python><python-3.x><pandas><dataframe> | 2022-12-31 10:44:37 | 2 | 493 | nerd |
74,968,971 | 4,418,481 | Plot each Dask partition seperatly using python | <p>I'm using <code>Dask</code> to read 500 parquet files and it does it much faster than other methods that I have tested.</p>
<p>Each parquet file contains a time column and many other variable columns.</p>
<p>My goal is to create a single plot that will have 500 lines of variable vs time.</p>
<p>When I use the follow... | <python><dask> | 2022-12-31 10:36:02 | 1 | 1,859 | Ben |
74,968,936 | 17,148,496 | How to make a barplot for the target variable with each predictive variable? | <p>I have a pandas df, that looks something like this (after scaling):</p>
<pre><code> Age blood_Press golucse Cholesterol
0 1.953859 -1.444088 -1.086684 -1.981315
1 0.357992 -0.123270 -0.585981 0.934929
2 0.997219 0.998712 2.005212 0.019169
3 2.589318 -0.528543 -1.12348... | <python><pandas><matplotlib><seaborn> | 2022-12-31 10:28:47 | 1 | 375 | Kev |
74,968,869 | 8,118,024 | How to call method in correct asyncio context from a different thread in Python (Textual framework) | <p>I have an old python multithreaded console app using urwid as its visualization library.
I'd like to switch to <a href="https://textual.textualize.io/" rel="nofollow noreferrer">Textual</a> which looks amazing.</p>
<p>I've never managed a mix of multithreaded and asyncio code, and I'd like to avoid rewriting the old... | <python><multithreading><python-asyncio><textual-framework> | 2022-12-31 10:14:33 | 0 | 305 | Alberto Pastore |
74,968,820 | 1,032,099 | Passing a variable to include in extends in Django templates | <p>I have the following structure of templates:</p>
<p><code>main.html</code></p>
<pre><code><html>
<body>
<p>
This works: {% block title %}{% endblock %}
</p>
{% include 'heading.html' with title=title %} {# but this does not work since it is not a variable #}
</body>
</html... | <python><django><django-templates> | 2022-12-31 10:06:15 | 6 | 1,238 | Xilexio |
74,968,761 | 12,200,808 | pip3 can't download the latest tflite-runtime | <p>The current version of <code>tflite-runtime</code> is <code>2.11.0</code>:</p>
<p><a href="https://pypi.org/project/tflite-runtime/" rel="noreferrer">https://pypi.org/project/tflite-runtime/</a></p>
<p>Here is a testing for downloading the <code>tflite-runtime</code> to the <code>tmp</code> folder:</p>
<pre><code>mk... | <python><ubuntu><pip><tensorflow-lite> | 2022-12-31 09:51:59 | 3 | 1,900 | stackbiz |
74,968,585 | 1,139,541 | Using environment variables in `pyproject.toml` for versioning | <p>I am trying to migrate my package from <code>setup.py</code> to <code>pyproject.toml</code> and I am not sure how to do the dynamic versioning in the same way as before. Currently I can pass the development version using environment variables when the build is for development.</p>
<p>The <code>setup.py</code> file l... | <python><version><setuptools><pyproject.toml> | 2022-12-31 09:16:16 | 4 | 852 | Ilya |
74,968,428 | 8,207,701 | Pytorch - Object of type 'method' has no len() | <p>So I'm trying to train a time series model using pytorch lightning library.</p>
<p>But after running the following code,</p>
<pre><code>trainer = pl.Trainer(
max_epochs = N_EPOCHS,
)
trainer.fit(model,data_module)
</code></pre>
<p>I'm getting this error,</p>
<pre><code>/usr/local/lib/python3.8/dist-packages/tor... | <python><machine-learning><pytorch><lstm><pytorch-lightning> | 2022-12-31 08:36:24 | 1 | 1,216 | Bucky |
74,968,179 | 18,044 | Session state is reset in Streamlit multipage app | <p>I'm building a Streamlit multipage application and am having trouble keeping session state when switching between pages. My main page is called mainpage.py and has something like the following:</p>
<pre><code>import streamlit as st
if "multi_select" not in st.session_state:
st.session_state["mult... | <python><session-state><streamlit> | 2022-12-31 07:37:13 | 3 | 23,709 | MvdD |
74,968,078 | 18,059,131 | Does the Gmail API skip verification code emails? Python Gmail API | <p>I'm trying to use the Gmail api to attain verification codes for 2FA. However, the following code seems to like literally skip my verification code emails:</p>
<pre><code> def getEmails(self):
SCOPES = ['https://www.googleapis.com/auth/gmail.readonly']
creds = None
if os.path.exists... | <python><gmail-api> | 2022-12-31 07:13:13 | 1 | 318 | prodohsamuel |
74,968,012 | 755,229 | why does Os.environ.keys() and Os.environ.items() return the semantically same data? | <p>running Ipython3 using Python3.10 on Ubuntu 22.10</p>
<pre><code>a=Os.environ.keys()
b=Os.environ.items()
</code></pre>
<p>I expect <strong>a</strong> to be a <strong>list</strong> of environmental variable keys/names
such as :</p>
<pre><code>['SHELL','SESSION_MANAGER',......]
</code></pre>
<p>but instead I got:</p>... | <python><ubuntu><environment-variables> | 2022-12-31 06:56:23 | 1 | 4,424 | Max |
74,967,983 | 7,477,154 | Remove specific string and all number and blank string from array in python | <p>I want to remove some words and all string that contains number from this array and</p>
<pre><code>reviews = ['', 'alternative', ' ', 'transcript', ' ', 'alive I', 'm Alive I', 'm Alive I', 'm Alive', ' ', 'confidence', ' 0', '987629', ' ', 'transcript', ' ', 'alive I', 'm Alive I', 'm Alive I', 'm Alive yeah', ' ',... | <python><arrays><arraylist> | 2022-12-31 06:50:15 | 1 | 339 | Ferdousi |
74,967,916 | 3,713,236 | How to create Predicted vs. Actual plot using abline_plot and statsmodels | <p>I am trying to recreate <a href="https://medium.com/analytics-vidhya/eda-and-multiple-linear-regression-on-boston-housing-in-r-270f858dc7b" rel="nofollow noreferrer">this plot from this website</a> in Python instead of R:
<a href="https://i.sstatic.net/h1cuZ.png" rel="nofollow noreferrer"><img src="https://i.sstatic... | <python><matplotlib><linear-regression><statsmodels> | 2022-12-31 06:33:34 | 1 | 9,075 | Katsu |
74,967,665 | 1,610,428 | Displaying a Matplotlib plot in Kivy without using the kivy-garden tools | <p>I am just learning to use Kivy and want to embed some plots from Matplotlib and potentially OpenGL graphics in an app. I was looking at this particular <a href="https://kivycoder.com/add-matplotlib-graph-to-kivy-python-kivy-gui-tutorial-59/" rel="nofollow noreferrer">tutorial</a> on how to use kivy-garden to display... | <python><matplotlib><user-interface><kivy> | 2022-12-31 05:19:04 | 1 | 10,190 | krishnab |
74,967,657 | 3,728,901 | UserWarning: The .grad attribute of a Tensor that is not a leaf Tensor is being accessed | <pre class="lang-py prettyprint-override"><code>import torch
from torch.autograd import Variable
x = Variable(torch.FloatTensor([11.2]), requires_grad=True)
y = 2 * x
print(x)
print(y)
print(x.data)
print(y.data)
print(x.grad_fn)
print(y.grad_fn)
y.backward() # Calculates the gradients
print(x.grad)
print(y.grad)... | <python><pytorch><gradient><tensor><user-warning> | 2022-12-31 05:16:59 | 1 | 53,313 | Vy Do |
74,967,508 | 5,509,839 | Django: mysterious slow request before timing middleware kicks in | <p>I'm using Django with Sentry to monitor errors and performance. There's one specific endpoint (this doesn't happen with other endpoints) that seems to stall for a few seconds before actually processing the request.</p>
<ul>
<li>It's a very simple endpoint, but it does get called a lot.</li>
<li>It seems to do nothin... | <python><django> | 2022-12-31 04:24:04 | 0 | 5,126 | aroooo |
74,967,506 | 9,616,557 | try/except vs validate the data while inserting to avoid "Violation of UNIQUE KEY constraint"? | <p>Which is the better option for performance?</p>
<p>Python try/except?</p>
<pre><code>try:
cursor.execute('INSERT INTO date (iyear, imonth, iday) VALUES (?,?,?)',year, month, day)
except Exception:
pass
</code></pre>
<p>or validate the data in database?</p>
<pre><code>cursor.execute('IF NOT EXISTS (SELECT TOP... | <python><sql><sql-server> | 2022-12-31 04:23:47 | 0 | 767 | Astora |
74,967,490 | 7,743,427 | How to find the outer keys in a nested dictionary | <p>I have a large nested JSON in python, which I've converted to a dictionary. In it, there's a key called 'achievements' in some sub-dictionary (don't know how far it's nested). This sub-dictionary is itself either an element of a list, or the value of a key in a larger dictionary.</p>
<p>Assuming all I know is that t... | <python><json><dictionary> | 2022-12-31 04:18:06 | 1 | 561 | Inertial Ignorance |
74,967,458 | 11,925,464 | Pandas: conditional, groupby, cumsum | <p>I have dataframe where i'm trying to create a new column showing the value with conditional groupby.</p>
<p>conditions:</p>
<ol>
<li>tag == 1, profit - cost</li>
<li>tag > 1, -(cost)</li>
<li>net is summed after every iteration</li>
</ol>
<p>original df:</p>
<pre>
╔══════╦═════╦══════╦════════╗
║ rep ║ tag ║ cos... | <python><pandas><group-by><cumsum> | 2022-12-31 04:09:29 | 1 | 597 | ManOnTheMoon |
74,967,443 | 3,728,901 | ERROR: No matching distribution found for torch | <p>Python 3.11.1 , With stable version of PyTorch</p>
<pre><code>pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu117
</code></pre>
<p><a href="https://i.sstatic.net/5ORj6.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/5ORj6.png" alt="enter image description... | <python><pytorch> | 2022-12-31 04:05:00 | 3 | 53,313 | Vy Do |
74,967,413 | 2,009,441 | How do I use the Elasticsearch Query DSL to query an API using Python? | <p>I'm trying to query the public <a href="http://api.artic.edu/docs/#introduction" rel="nofollow noreferrer">Art Institute of Chicago API</a> to only show me results that match certain criteria. For example:</p>
<ul>
<li><code>classification_title</code> = "painting"</li>
<li><code>colorfulness</code> <= ... | <python><elasticsearch><elasticsearch-dsl> | 2022-12-31 03:55:48 | 1 | 515 | Danny |
74,967,353 | 322,513 | Python package version not found, but it's clearly there | <p>I am trying to create specific python environment inside docker for reproducible builds, but package <code>python-opencv</code> that previously was manually installed refuses to get installed with error:</p>
<blockquote>
<p>ERROR: Could not find a version that satisfies the requirement opencv_python==4.7.0 (from ver... | <python><pip> | 2022-12-31 03:35:37 | 1 | 2,230 | Slaus |
74,967,339 | 1,934,510 | How to specify Youtube Channel Id to Upload Video from the same user? | <p>I'm using this code to upload to my Youtube Channel that is working fine. Now I created another channel under my account and I want to upload a video to this new Chanel, how do I specify the channel Id in the code?</p>
<pre><code># Explicitly tell the underlying HTTP transport library not to retry, since
# we are ha... | <python><youtube><youtube-api> | 2022-12-31 03:29:01 | 1 | 8,851 | Filipe Ferminiano |
74,967,311 | 13,494,917 | How to specify a ProgrammingError exception | <p>Sometimes I get this error when executing a to_sql() statement</p>
<blockquote>
<p>Exception: ProgrammingError: (pyodbc.ProgrammingError) ('42000', "[42000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Incorrect syntax near ','. (102) (SQLExecDirectW)")</p>
</blockquote>
<p>I know exactly what I'd... | <python><pyodbc> | 2022-12-31 03:17:04 | 0 | 687 | BlakeB9 |
74,967,083 | 3,591,044 | Combining rows in a DataFrame | <p>I have a Pandas DataFrame shown below consisting of three columns.</p>
<pre><code>import pandas as pd
data = [[1, "User1", "Hello."], [1, "User1", "How are you?"], [1, "User2", "I'm fine."], [2, "User1", "Nice to meet you."], [2, "U... | <python><pandas><dataframe><group-by> | 2022-12-31 01:48:47 | 1 | 891 | BlackHawk |
74,967,048 | 817,659 | Numba Vectorize FakeOverload | <p>This program gives an error when it gets to the "@vectorize(['float32(float32)'], target='cuda')" function with the error:</p>
<pre><code>File "/home/idf/anaconda3/envs/gpu/lib/python3.9/site-packages/numba/cuda/vectorizers.py", line 206, in _compile_core
return cudevfn, cudevfn.overloads[sig... | <python><ubuntu><numba> | 2022-12-31 01:37:27 | 0 | 7,836 | Ivan |
74,966,897 | 13,142,245 | PyStan: TypeError: cannot convert the series to <class ‘int’> | <p>I'm using PyStan in a Jupyter notebook. This is possible with the <code>nest_asyncio.apply()</code> trick. Stan seems to have some issue receiving a numpy array of integer variables.</p>
<pre class="lang-py prettyprint-override"><code>import numpy as np
import pandas as pd
import stan
import nest_asyncio
nest_asyn... | <python><numpy><jupyter-notebook><bayesian><stan> | 2022-12-31 00:52:42 | 0 | 1,238 | jbuddy_13 |
74,966,767 | 1,192,885 | How to extract specific part of html using Beautifulsoup? | <p>I am trying to extract the what's within the 'title' tag from the following html, but so far I didn't manage to.</p>
<pre><code><div class="pull_right date details" title="22.12.2022 01:49:03 UTC-03:00">
</code></pre>
<p>This is my code:</p>
<pre><code>from bs4 import BeautifulSoup
with op... | <python><beautifulsoup><html-parsing> | 2022-12-31 00:19:42 | 1 | 1,303 | Marco Almeida |
74,966,649 | 5,509,839 | Does chaining prefetch_related fetch all sub-queries? | <p>Take this for example:</p>
<p><code>user = User.objects.prefetch_related("foo__bar__baz").get(id=id)</code></p>
<p>In this scenario, do I not need to do:</p>
<p><code>user = User.objects.prefetch_related("foo__bar").get(id=id)</code> if I want to access values on <code>bar</code>, or if they are ... | <python><django> | 2022-12-30 23:46:03 | 0 | 5,126 | aroooo |
74,966,521 | 19,130,803 | Celery: How to abort running task | <p><strong>calculator.py</strong></p>
<pre><code>def add(n):
r = n + n
time.sleep(15) # long running task
return r
</code></pre>
<p><strong>tasks.py</strong></p>
<pre><code>from calculator import add
REDIS_URL = redis://redis:6379/0
celery_app = Celery(__name__, broker=REDIS_URL, backend=REDIS_URL)
@cel... | <python><redis><celery> | 2022-12-30 23:19:50 | 0 | 962 | winter |
74,966,344 | 6,054,404 | Python numpy sampling a 2D array for n rows | <p>I have a numpy array as follows, I want to take a random sample of <code>n</code> rows.</p>
<pre><code> ([[996.924, 265.879, 191.655],
[996.924, 265.874, 191.655],
[996.925, 265.884, 191.655],
[997.294, 265.621, 192.224],
[997.294, 265.643, 192.225],
... | <python><numpy><sample> | 2022-12-30 22:40:55 | 2 | 1,993 | Spatial Digger |
74,966,335 | 726,730 | pywinauto print_control_identifiers for pyqt5 application | <p>Using python 3.10 i am trying to use pywinauto and print_control_identifiers for a PyQt5 app (for example Qt Designer).</p>
<pre><code>from pywinauto.application import Application
import os
app = Application().start("C:/python/Lib/site-packages/QtDesigner/designer.exe")
main_dlg = app.QtDesigner
main_dlg... | <python><pyqt5><controls><pywinauto> | 2022-12-30 22:38:52 | 1 | 2,427 | Chris P |
74,966,241 | 11,692,124 | Python renew a function's definition of imported module and use renewed one in even functions of imported module | <p>I have a <code>file1.py</code>:</p>
<pre><code>def funcCommon1():
pass
def file1Func1():
funcCommon1()
....#other lines of code
</code></pre>
<p>and I have a <code>file2.py</code> which I have imported funcs of <code>file1.py</code></p>
<pre><code>from file1 import *
def file2FuncToReplacefuncCommon1():
... | <python> | 2022-12-30 22:24:50 | 1 | 1,011 | Farhang Amaji |
74,966,221 | 7,267,480 | Regression task for neural network with Keras and Tensorflow, shapes and formats of input data | <p>I am studying Keras to build a neural network for regression purposes.</p>
<p>I have obtained a dataset to train a model - each row represents a case with inputs in separate columns and output.</p>
<p>Here is the example dataset:</p>
<pre><code> x1 x2 x3 x4 x5 y
0 0.00 0.00 0.00 0.00 ... | <python><tensorflow><keras> | 2022-12-30 22:21:12 | 1 | 496 | twistfire |
74,966,220 | 14,403,635 | Python Selenium: How to select the drop down menu with highlighted feature | <p>I am trying to select the drop down menu. Selenium can control Chrome to click the drop down list and the list shows the options. However, it fails to select and click the options. Is it because the drop down list has a feature when the cursor point to the text and the text will be highlighted. The class name will b... | <python><selenium><selenium-webdriver> | 2022-12-30 22:21:01 | 0 | 333 | janicewww |
74,966,144 | 5,865,393 | Flask-WTF StopValidation after default validator fails | <p>I am adding a field and validating it against <code>IPAddress</code> WTForms' validator:</p>
<pre class="lang-py prettyprint-override"><code>from ipaddress import ip_network
from flask_wtf import FlaskForm
from wtforms import StringField
from wtforms.validators import DataRequired, IPAddress, ValidationError, StopV... | <python><validation><flask><flask-wtforms> | 2022-12-30 22:07:19 | 0 | 2,284 | Tes3awy |
74,966,141 | 9,002,634 | Most performant way to search if row exists in sqlalchemy? | <p>Let's say I have a:</p>
<pre class="lang-py prettyprint-override"><code>base = declarative_base()
class Users(base):
__tablename__ = "users"
user_id = Column(BigInteger, primary_key=True, autoincrement=True)
</code></pre>
<p>And I have supposedly a list of user_ids.</p>
<p>What is the most perform... | <python><sqlalchemy> | 2022-12-30 22:06:36 | 1 | 318 | Viet Than |
74,966,045 | 898,042 | how to extract from sqs json msg nested values in python? | <p>my aws chain: lambda->sns->sqs->python script on ec2</p>
<p>the python script gives me error due to unable to extract values i need , wrong structure i think but i cant see the bug.</p>
<p>I can't get the values from "vote" field in sqs msg. How to do that?</p>
<p>The test event structure(raw msg ... | <python><json><amazon-web-services><amazon-sqs> | 2022-12-30 21:47:10 | 1 | 24,573 | ERJAN |
74,965,989 | 13,860,217 | Python list forward fill elements according to thresholds | <p>I have a list</p>
<pre><code>a = ["Today, 30 Dec",
"01:10",
"02:30",
"Tomorrow, 31 Dec",
"00:00",
"04:30",
"05:30",
"01 Jan 2023",
"01:00",
"10:00"]
</code></pre>
<p>and w... | <python><list><fill><forward> | 2022-12-30 21:38:24 | 3 | 377 | Michael |
74,965,968 | 9,537,439 | How can I modify the grid parameters from an trained ML model? | <p>I have trained an <code>xgboost.XGBClassifier</code> model with <code>GridSearchCV</code>, when calling <code>grid_search_xgb.best_estimator_.get_params()</code> to obtain the best parameters of that model I get this:</p>
<pre><code>{'objective': 'binary:logistic',
...
'missing': nan,
'monotone_constraints': '()'... | <python><machine-learning><scikit-learn><parameters><grid-search> | 2022-12-30 21:33:58 | 1 | 2,081 | Chris |
74,965,894 | 3,247,006 | By default, is transaction used in Django Admin Actions? | <p>I know that by default, transaction is used in <strong>Django Admin</strong> when adding, changing and deleting data according to my tests.</p>
<p>But, I selected <strong>Delete selected persons</strong> and clicked on <strong>Go</strong> in <strong>Django Admin Actions</strong>. *I use PostgreSQL:</p>
<p><a href="h... | <python><django><transactions><django-admin><django-admin-actions> | 2022-12-30 21:23:17 | 2 | 42,516 | Super Kai - Kazuya Ito |
74,965,764 | 11,316,253 | How can I properly hash dictionaries with a common set of keys, for deduplication purposes? | <p>I have some log data like:</p>
<pre><code>logs = [
{'id': '1234', 'error': None, 'fruit': 'orange'},
{'id': '12345', 'error': None, 'fruit': 'apple'}
]
</code></pre>
<p>Each dict has the same keys: <code>'id'</code>, <code>'error'</code> and <code>'fruit'</code> (in this example).</p>
<p>I want to <a href="https:/... | <python><python-3.x> | 2022-12-30 21:00:14 | 3 | 549 | dCoder |
74,965,747 | 667,570 | Python AudioPlayer on Chromebook fails to play file | <p>I have this python program:</p>
<pre><code>from gtts import gTTS
from audioplayer import AudioPlayer
speech = gTTS('Hello, world!')
speech.save('test.mp3')
AudioPlayer('test.mp3').play(block=True)
</code></pre>
<p>This runs fine on my Macbook. When I try to run it on my chromebook I get this error:</p>
<pre><code>T... | <python><chromebook> | 2022-12-30 20:57:07 | 0 | 1,005 | Sol |
74,965,734 | 3,614,036 | Building opencv-python from source with videoio off results in file not found error | <p>The error:</p>
<pre><code> /opencv-python/opencv/modules/gapi/include/opencv2/gapi/streaming/cap.hpp:26:10: fatal error: opencv2/videoio.hpp: No such file or directory
#include <opencv2/videoio.hpp>
</code></pre>
<p>The docker image command that fails:</p>
<pre><code>RUN pip wheel . --verbose
</code></pre... | <python><docker><opencv> | 2022-12-30 20:54:45 | 1 | 415 | Joey Grisafe |
74,965,731 | 17,301,834 | Default arguments in __init__ of class inheriting from int | <p>I feel like I'm losing my mind. I was working on a simple project involving a subclass of <code>int</code>, which may not be the best idea, but I need to inherit many of <code>int</code>'s magic methods for integer operations.</p>
<p>I added a default argument <code>wraps=True</code> to the class' <code>__init__</co... | <python><python-3.x><inheritance><immutability> | 2022-12-30 20:54:18 | 0 | 459 | user17301834 |
74,965,720 | 866,082 | How to make my protobuf objects pickle-able? | <p>I have this protobuf file called <code>HistogramBins.proto</code> like this:</p>
<pre class="lang-protobuf prettyprint-override"><code>syntax = "proto3";
message HistogramBins {
string field_name = 1;
repeated float bins = 2;
}
</code></pre>
<p>which I compile it this way:</p>
<pre><code>protoc --pyth... | <python><protocol-buffers><apache-beam> | 2022-12-30 20:52:47 | 0 | 17,161 | Mehran |
74,965,715 | 11,923,747 | Split dataframe according to common consecutive sequences | <p>Let's consider this DataFrame :</p>
<pre><code>import pandas as pd
df = pd.DataFrame({"type" : ["dog", "cat", "whale", "cat", "cat", "lion", "dog"],
"status" : [False, True, True, False, False, True, True],
... | <python><pandas><dataframe><split><sequence> | 2022-12-30 20:52:16 | 1 | 321 | floupinette |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.