QuestionId int64 74.8M 79.8M | UserId int64 56 29.4M | QuestionTitle stringlengths 15 150 | QuestionBody stringlengths 40 40.3k | Tags stringlengths 8 101 | CreationDate stringdate 2022-12-10 09:42:47 2025-11-01 19:08:18 | AnswerCount int64 0 44 | UserExpertiseLevel int64 301 888k | UserDisplayName stringlengths 3 30 β |
|---|---|---|---|---|---|---|---|---|
75,699,783 | 1,745,291 | Is there a function in python like Path.relative_to() supporting '../' if the path is not a subpath of the other? | <p><code>Path.relative_to</code> is great to suppress the common prefix of two path... But if the first path is not a subdir / subfile of the second, like :</p>
<pre><code>Path('/tmp/random/path').relative_to(Path('/tmp/random/path/etc'))
</code></pre>
<p>Then Python raises :</p>
<pre><code>ValueError: '/tmp/random/pat... | <python><path> | 2023-03-10 18:27:23 | 2 | 3,937 | hl037_ |
75,699,625 | 9,782,619 | Dataframe shift by duration but round(/ceil) to the nearest time | <p>I got a Dataframe with monotonic ts like:</p>
<pre><code>ts | value1 | value2
11 9 x
19 10 x
26 x x
29 x x
32 x x
</code></pre>
<p>for each <code>value1</code>, I want to find the <code>value2</code> at a timep... | <python><pandas><dataframe> | 2023-03-10 18:06:33 | 1 | 635 | YNX |
75,699,585 | 15,363,250 | Joining 2 dataframes and collecting only the unique values in pyspark | <p>I have 2 dataframes, the first one that is called questions_version1 and the second one called questions_version2.</p>
<pre><code>questions_version1
+-----------+----------+-----------+--------------+
| question |answer |version | total_answers
+-----------+----------+-----------+--------------+
|eye color |... | <python><dataframe><pyspark> | 2023-03-10 18:01:38 | 3 | 450 | Marcos Dias |
75,699,538 | 13,309,379 | Cupy Code Optimization: How to speed up nested for loops | <p>I would like to optimize the python code between the 2 <code>perf_counter</code> functions.
By using <code>cupy</code> I already obtained substantial improvement compared to <code>numpy</code>.
I was asking myself if there is some reordering or vectorization that I am missing.
The main constraint is that I should no... | <python><multidimensional-array><cupy><numpy-einsum> | 2023-03-10 17:57:37 | 1 | 712 | Indiano |
75,699,462 | 14,697,000 | Is there a better way of displaying a csv file that was made from a Multi-index dataframe? | <p>I was working on a project for calculating the different speeds of different algorithms with different datas and I wanted to save this data in a csv format and eventually view it in Excel.</p>
<p>I did this in the following lines of code:</p>
<pre><code>df=DataFrame(dictionary_container,index=indexer)
df=df.transpos... | <python><pandas><dataframe><format><multi-index> | 2023-03-10 17:49:50 | 1 | 460 | How why e |
75,699,176 | 5,394,072 | Google OR-Tools, accessing value of the variables that the solver tries. Dynamic coefficients for variables | <p>I am using google or tools, to find the spend allocation for maximum revenue. In below example, (say) <code>mon</code>, <code>tues</code> are variables for spend allocation for monday tuesday out of total alloaction.</p>
<p>To be short, can I try dynamic coefficient for the variable values instead of static coeffic... | <python><optimization><linear-programming><or-tools><constraint-programming> | 2023-03-10 17:19:47 | 0 | 738 | tjt |
75,698,797 | 1,473,517 | How do I set simple linear constraints with dual_annealing? | <p>I can set simple bounds to use with dual_annealing: E.g.</p>
<pre><code>upper_bound = 20
num_points = 30
bounds = [(0, upper_bound) for i in range(num_points)]
res = dual_annealing(fun, bounds, maxiter=1000)
</code></pre>
<p>But I would also like to constrain the variables so that <code>x_i >= x_{i-1}+0.5</code> ... | <python><scipy><mathematical-optimization> | 2023-03-10 16:41:11 | 2 | 21,513 | Simd |
75,698,611 | 5,109,125 | Question with reading csv using encoding - ISO-8859-1 | <p>I am reading in a csv file that is being sent by another team weekly.</p>
<p>Previously, my python script had no issue with reading that file (using pandas). But with this week's data I got an error "UnicodeDecodeError: 'ascii' codec can't decode byte 0xa0 in position 208426: ordinal not in range(128)"</... | <python><pandas> | 2023-03-10 16:24:42 | 1 | 597 | punsoca |
75,698,404 | 4,450,090 | polars concat columns of list type into columns of string type | <p>I would like to concat dataframe list[String] column into String column using polars only native functions. Is it possible?</p>
<pre class="lang-py prettyprint-override"><code>df = pl.DataFrame({
'col1': [["1.0", "1.0"], ["2.0", "3.0"]],
'col2': ["a", "a... | <python><python-polars> | 2023-03-10 16:05:52 | 1 | 2,728 | Dariusz Krynicki |
75,698,369 | 10,962,766 | How many reviews does "app store scraper" for Python scrape by default, and is there a fixed date range? | <p>I am confused about how many reviews the <a href="https://pypi.org/project/app-store-scraper/" rel="nofollow noreferrer">app store scraper</a> for Python scrapes by default and if there is any fixed date range ("past n months"). The documentation says that the maximum number of reviews fetched per request ... | <python><web-scraping> | 2023-03-10 16:02:08 | 1 | 498 | OnceUponATime |
75,698,254 | 536,262 | How to make requests in parallel using FastAPI | <p>In FastAPI, I have this route:</p>
<pre class="lang-py prettyprint-override"><code>for id in ids: #get projects from list of ids
p = await gitlab.project(id)
if p and 'error' not in p:
projects[int(id)] = p
</code></pre>
<p>But it takes around 2sec per request sequentially, so I wait more than a minute.</p... | <python><fastapi><httpx> | 2023-03-10 15:51:51 | 1 | 3,731 | MortenB |
75,698,238 | 1,102,514 | Django model unique constraint based on existing model data? | <p>Is it possible to make reference to existing model data, as part of a Django unique constraint check?</p>
<p>For example,</p>
<pre class="lang-py prettyprint-override"><code>class MyModel(models.Model):
....
my_field = models.IntField(...)
class Meta:
constraints = [
models.CheckCon... | <python><django><django-models><constraints> | 2023-03-10 15:51:07 | 1 | 1,401 | Scratcha |
75,698,214 | 5,111,234 | Optional setup.py dependencies that require the Extension module | <p>I have a main package (say package A) that I want to have an optional dependency. I know that I can use <code>extras_require</code> to define optional package dependencies, however I want this optional dependency to use the <code>Extension</code> module to build using f2py with additional data files. Is there a way ... | <python><numpy><setuptools><setup.py><f2py> | 2023-03-10 15:49:01 | 0 | 679 | Jehan Dastoor |
75,698,114 | 3,116,231 | How to skip JSON levels when creating data classes | <p>I'd like a nested JSON into flat data classes:</p>
<pre><code>from typing import List
from dataclasses import dataclass
@dataclass
class MyDataClass:
key_0: str
key_2: str
key_3: str
key_4_1: str
key_5: str
@dataclass
class MyDataClassList:
classes: List[MyDataClass]
data = [
{
... | <python><python-dataclasses> | 2023-03-10 15:40:12 | 0 | 1,704 | Zin Yosrim |
75,698,060 | 3,684,314 | Replacing Overlapping Regex Patterns in Python | <p>I am dealing with trying to make a <code>.ttl</code> file I was handed digestible. One of the issues is that the <code>rdfs:seeAlso</code> values are not sanitized and it breaks down downstream programs. What I mean by this is that there are links of the form:</p>
<pre><code>rdfs:seeAlso prefix:value_(discipline)
</... | <python><regex><replace><ttl> | 2023-03-10 15:34:25 | 3 | 793 | user3684314 |
75,697,886 | 8,382,028 | Confusion with Pytest optimization to speed up testing | <p>This is not going to be a coding specific question, I honestly just have been attempting to speed up testing for my project the last week or so using <code>pytest</code>, <code>pytest-xdist</code> and <code>pytest-django</code> and I feel like I am running into a wall with optimization now.</p>
<p>I have 3047 tests ... | <python><pytest><pytest-django> | 2023-03-10 15:16:23 | 0 | 3,060 | ViaTech |
75,697,761 | 16,363,897 | Element-wise weighted average of multiple dataframes | <p>Let's say we have 3 dataframes (df1, df2, df3). I know I can get an element-wise average of the three dataframes with</p>
<pre><code>list_of_dfs = [df1, df2, df3]
sum(list_of_dfs)/len(list_of_dfs)
</code></pre>
<p>But I need to get a weighted average of the three dataframes, with weights defined in an array "W&... | <python><pandas><dataframe> | 2023-03-10 15:03:47 | 1 | 842 | younggotti |
75,697,707 | 14,269,252 | Unable to use sidebar with st.column | <p>I am building a stream lit app, I defined st.column and sidebar in my code. when I first click on button 1, then I check on sidebar, my click on button 1 would disappear, is there a way that I can keep them both?</p>
<pre class="lang-py prettyprint-override"><code>col1, col2, col3 = st.columns([.4,.5,1])
m = st.mar... | <python><streamlit> | 2023-03-10 14:58:30 | 1 | 450 | user14269252 |
75,697,579 | 11,951,910 | After recursive search of my json object how to determine data type for looping data | <p>I have a recursive function that examines a json object. It captures the data when I try to loop the data, it works for one but not the other. I need help determining what type of data the returned data is show I can loop the data.</p>
<pre><code>targetType = 'equal'
def find_data(lookup_key, jsonData, search_resul... | <python><json> | 2023-03-10 14:48:06 | 0 | 718 | newdeveloper |
75,697,107 | 4,907,339 | Efficiently filtering out the last row of a duplicate column | <p>I need to filter out the last row where <code>col2 = 3</code> but preserve the rest of the dataframe.</p>
<p>I can do that like so, while maintaining the order relative to the index:</p>
<pre class="lang-py prettyprint-override"><code>import pandas
d = {
'col1': [0, 1, 2, 3, 3, 3, 3, 4, 5, 6],
'col2': [0... | <python><pandas> | 2023-03-10 14:05:27 | 7 | 492 | Jason |
75,697,081 | 4,543,743 | How to configure rotating proxy with scrapy playwright? | <p>I am trying to add rotating proxy Scrapy Playwright. <a href="https://github.com/rejoiceinhope/scrapy-proxy-pool" rel="nofollow noreferrer">scrapy-proxy-pool</a> does not work well with Scrapy Playwright. So I hacked <a href="https://github.com/rejoiceinhope/scrapy-proxy-pool" rel="nofollow noreferrer">https://githu... | <python><scrapy><playwright><playwright-python><scrapy-playwright> | 2023-03-10 14:02:46 | 1 | 421 | saprative |
75,696,793 | 1,432,980 | apply a function on the columns from the list | <p>I have a list of columns, whose values in the dataframe I want to convert to Decimal</p>
<pre><code>column_list = ['Parameter 1', 'Parameter 2' ... 'Parameter N']
</code></pre>
<p>The data in a dataframe looks like this</p>
<pre><code>Name | Parameter 1 | Parameter 2 | Surname | ... | Parameter N | ...
</code></pre>... | <python><pandas><dataframe> | 2023-03-10 13:34:21 | 1 | 13,485 | lapots |
75,696,743 | 755,371 | Python multiprocessing Queue broken after worker kill | <p>I made a program to simulate heavy mail management by using python multiprocessing Pool and Queue :</p>
<pre><code>from multiprocessing import Pool, Queue
import time
import uuid
import os
NB_WORKERS = 3
NB_MAILS_PER_5_SECONDS = 2
MAIL_MANAGEMENT_DURATION_SECONDS = 1
def list_new_mails_id():
for i in range(N... | <python><multiprocessing> | 2023-03-10 13:28:39 | 3 | 5,139 | Eric |
75,696,676 | 743,188 | pydantic: how to type hint to mypy that a function accepts any model subclass | <p>Best asked through code:</p>
<pre><code>from pydantic import BaseModel
class Role(BaseModel):
class Config:
extra = Extra.forbid
someprop: sometype = somedefault
class Administrator(Role):
someprop = foo
class Teacher(Role):
someprop = bar
...
def some_func_that_accepts_any_role(role:... | <python><mypy><pydantic> | 2023-03-10 13:21:57 | 0 | 13,802 | Tommy |
75,696,639 | 14,033,436 | What is the correct way to define a vectorized (jax.vmap) function in a class? | <p>I want to add a function, which is vectorized by <code>jax.vmap</code>, as a class method. However, I am not sure where to define this function within the class. My main goal is to avoid, that the function is being redefined each time I call the class method.</p>
<p>Here is a minimal example for a class that counts ... | <python><vector><parallel-processing><vectorization><jax> | 2023-03-10 13:18:37 | 1 | 790 | yuki |
75,696,580 | 12,965,658 | Boolean null values in pandas | <p>I have a column with datatype string. I want to convert it to boolean using pandas.</p>
<p>The dataframe column has values such as:</p>
<pre><code>'True'
'False'
'None'
</code></pre>
<p>I am using pandas to convert it to bool.</p>
<pre><code>df[column] = df[column].astype(bool)
print(df.dtypes)
print(df) ... | <python><python-3.x><pandas><dataframe><snowflake-cloud-data-platform> | 2023-03-10 13:13:21 | 2 | 909 | Avenger |
75,696,578 | 18,050,861 | How to open a ".pyc" file with Pycharm? | <p>I was programming some code in pycharm and I don't know how it came out and saved like this: <code>Eq_FD.cpython-39.pyc</code>. Whereas before it was just <code>Eq_FD</code>. When I tried to open it again in pycharm it was full of characters so that I can't understand what is written. Looks to me like it's in binary... | <python><file><pycharm> | 2023-03-10 13:13:15 | 1 | 375 | User8563 |
75,696,569 | 5,091,467 | How do I extract meaningful simple rules from this classification problem? | <p>I have a problem of this type: A customer creates an order by hand, which might be erroneous. Submitting a wrong order is costly, which is why we try to reduce the error rate.</p>
<p>I need to detect what factors cause an error, so that a new rule can be created, such as Product "A" and type "B" ... | <python><scikit-learn><classification><rules><interaction> | 2023-03-10 13:11:34 | 1 | 714 | Dudelstein |
75,696,356 | 8,849,755 | Set only lower axis range in plotly | <p>I want to set the lower value for the range of an axis and let the higher value to be automatic. Is this possible? I tried this:</p>
<pre class="lang-py prettyprint-override"><code>import plotly.graph_objects as go
import numpy
x = numpy.linspace(0,1,99)
fig = go.Figure()
fig.add_trace(
go.Scatter(
x =... | <python><plotly><range> | 2023-03-10 12:49:39 | 1 | 3,245 | user171780 |
75,696,248 | 17,630,139 | Flake8: ValueError: 'choice' is not callable | <p>After upgrading to flake8 v6.0.0, I tried running the command <code>flake8</code> at the project level. However, I receive this error in the console:</p>
<pre class="lang-bash prettyprint-override"><code>Traceback (most recent call last):
File "env/bin/flake8", line 8, in <module>
sys.exit(main... | <python><python-3.x><flake8> | 2023-03-10 12:38:04 | 1 | 331 | Khalil |
75,696,234 | 3,360,848 | Efficient Filtering of Lists in a Dictionary of Lists | <p>I'm working with some reasonably large datasets (500,000 datapoints with 30 variables each) and would like to find the most efficient methods for filtering them.</p>
<p>For compatibility with existing code the data is structured as a dictionary of lists but can't be converted (e.g. to pandas DataFrame) and has to be... | <python><list><dictionary><list-comprehension> | 2023-03-10 12:36:07 | 2 | 417 | awenborn |
75,696,084 | 14,125,436 | How to make heat equation dimensionless for neural network in pytorch | <p>I am trying to use PyTorch for making a Physics Informed Neural Network for the heat equation in 1D:</p>
<p><a href="https://i.sstatic.net/1nAMS.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/1nAMS.png" alt="enter image description here" /></a></p>
<p>I tried the following code to make a loss functio... | <python><pytorch><neural-network> | 2023-03-10 12:20:49 | 1 | 1,081 | Link_tester |
75,696,056 | 13,798,993 | Pythons inspect.getsource throws error if used in a decorator | <p>I have the following function</p>
<pre><code>def foo():
for _ in range(1):
print("hello")
</code></pre>
<p>Now I want to add another print statement to print "Loop iterated" after every loop iteration. For this I define a new function that transforms foo into an ast tree, inserts the ... | <python><abstract-syntax-tree> | 2023-03-10 12:18:39 | 1 | 689 | Quasi |
75,696,017 | 3,046,211 | Sorting of categorical variables using np.unique | <p>I'm trying to get the unique values of categorical variables in sorted fashion using the below code but without success.</p>
<pre><code>import numpy as np
unique_values, unique_value_counts = np.unique(['Small', 'Medium', 'Large', 'Medium', 'Small', 'Large', 'Small', 'Medium'], return_counts = True)
print(unique_v... | <python><numpy> | 2023-03-10 12:14:44 | 4 | 716 | user3046211 |
75,695,955 | 14,269,252 | Assign different part of codes to st.button in streamlit app | <p>I am building an streamlit app, I defined 3 buttons.
I have a large set of codes that does different things. If a user choose button1, it does something, if a user choose button2 it should perform other part of code and does something else.</p>
<p>There is two issue I am dealing with:</p>
<p>1- when I select button2... | <python><streamlit> | 2023-03-10 12:10:07 | 1 | 450 | user14269252 |
75,695,717 | 12,193,952 | How to cleanup RAM between program iterations using Python | <h2>Problem</h2>
<p>I have a Python application inside Docker container. The application receives "jobs" from some queue service (<code>RabbitMQ</code>), does some computing tasks and uploads results into database (<code>MySQL</code> and <code>Redis</code>).</p>
<p>The issue I face is - <strong>the RAM is not... | <python><pandas><docker><memory> | 2023-03-10 11:43:11 | 1 | 873 | FN_ |
75,695,487 | 3,017,749 | matplotlib multicolored line from pandas DataFrame with colors from value in dataframe | <p>I am trying to plot a DataFrame containing 3 columns, first 2 will be the coordinates of each point and the third would determine the color of the plot at that point:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>X</th>
<th>Y</th>
<th>C</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>2... | <python><pandas><numpy><matplotlib> | 2023-03-10 11:17:33 | 1 | 462 | roign |
75,695,414 | 13,158,157 | Read parquet folder from blob storage | <p>I am usually writing and reading parquet files saved from pandas (pyarrow engine) to blob storage in a way described <a href="https://stackoverflow.com/questions/63351478/how-to-read-parquet-files-from-azure-blobs-into-pandas-dataframe">in this question</a>.
Generally my read function looks like this:</p>
<pre><code... | <python><pandas><azure-blob-storage><parquet> | 2023-03-10 11:11:45 | 1 | 525 | euh |
75,695,324 | 19,770,795 | Overloaded signature supposedly incompatible with supertype, despite not strengthening preconditions | <p>Imagine being given the following base class that you have no control over:</p>
<pre class="lang-py prettyprint-override"><code>from typing import Optional
class A:
def foo(self, x: Optional[bool] = None) -> None:
pass
</code></pre>
<p>Now you want to write a subclass that merely distinguishes two di... | <python><overloading><mypy><python-typing><liskov-substitution-principle> | 2023-03-10 11:03:05 | 0 | 19,997 | Daniel Fainberg |
75,695,171 | 4,815,580 | Does loop.sock_recv(sock, nbytes) in python asyncio raise any exception? | <p>I am working on python socket programming using asyncio, where I have below code:</p>
<pre><code>buff = b""
try:
while len(buff) < 100):
buff += await loop.sock_recv(srv_sock, 4096)
except Exception as exp:
raise exp
</code></pre>
<p>But I am not sure if loop.sock_recv raise any ... | <python><python-asyncio> | 2023-03-10 10:49:52 | 1 | 512 | NPE |
75,695,118 | 1,961,574 | How to avoid reading half-written arrays spanning multiple chunks using zarr? | <p>In a multiprocess situation, I want to avoid reading arrays from a zarr group that haven't fully finished writing by the other process yet. This functionality does not seem to come out of the box with zarr.</p>
<p>While chunk writing is atomic in zarr, array writing seems not to be (i.e. while you can never have a h... | <python><multiprocessing><zarr> | 2023-03-10 10:44:34 | 1 | 2,712 | bluppfisk |
75,695,028 | 17,082,611 | Applying gaussian noise gives white on colored regions of my image | <p>I want to apply gaussian noise to this image:</p>
<p><a href="https://i.sstatic.net/OUyt6.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/OUyt6.png" alt="original image" /></a></p>
<p>through this function:</p>
<pre><code>def add_noise(image):
(x, y, channels) = image.shape
mean = 0
var = ... | <python><numpy><matplotlib> | 2023-03-10 10:36:31 | 2 | 481 | tail |
75,694,838 | 12,965,658 | Pandas string with none to int conversion | <p>I have a column with datatype string. I want to convert it to int using pandas.</p>
<p>The dataframe column has values such as:</p>
<pre><code>1
2
None
</code></pre>
<p>I am using pandas to convert it to int.</p>
<pre><code>df['column'] = pd.to_numeric(df[column],errors='coerce').fillna(0)
print(df.dtypes)
print(df)... | <python><python-3.x><pandas><dataframe> | 2023-03-10 10:17:12 | 3 | 909 | Avenger |
75,694,809 | 9,479,925 | How to reshape pandas dataframe? | <p>I have a dataframe as:</p>
<pre><code>pd.DataFrame({'a':['name','number','dob'],'b':['myamulla','1234','1999-01-01']})
</code></pre>
<p><a href="https://i.sstatic.net/nJryx.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/nJryx.png" alt="enter image description here" /></a></p>
<p>I would like to have ... | <python><pandas> | 2023-03-10 10:14:15 | 2 | 1,518 | myamulla_ciencia |
75,694,674 | 222,189 | Is there a Python linter to check for a missing `raise` keyword? | <p>I have seen the following pattern several times:</p>
<pre><code>if value > MAX_VALUE:
ApplicationError("value is too large")
# value is in range now
use_value(value)
</code></pre>
<p>There is an obvious but relatively easy-to-miss bug here: the <code>raise</code> keyword is missing from <code>Appli... | <python><static-analysis><pylint> | 2023-03-10 10:01:08 | 1 | 2,122 | matejcik |
75,694,548 | 8,176,763 | airflow return a stringIO buffer | <p>I have a dag in airflow as such:</p>
<pre><code>from datetime import timedelta
import pendulum
from airflow.decorators import dag
from stage import stage_data
from table_async_pg import run_async
from read_mem_view import get_view_buffer
@dag(
dag_id = "data-sync",
schedule_interval = '*/30 * * * *',
start... | <python><airflow> | 2023-03-10 09:49:09 | 0 | 2,459 | moth |
75,694,541 | 12,281,404 | Fastapi async.sleep() get time spent | <pre class="lang-py prettyprint-override"><code>async def work():
asyncio.sleep(3)
@router.get('')
async def test():
time1 = monotonic()
... # need to call work
time2 = monotonic()
return TestResponse(time=time2-time1)
</code></pre>
<p><code>work</code> function should be called only once at the ... | <python><python-3.x><python-asyncio><fastapi> | 2023-03-10 09:48:20 | 2 | 487 | Hahan't |
75,694,454 | 5,625,534 | Windows locale: set number of digits | <p>I am looking for an example of how to set (and get) the number of digits (LOCALE_IDIGITS).</p>
<p>Background: I am using COM automation (client: Python, server: ACCESS, package:pywin32). When using TransferText it always prints 2 decimals. (See e.g. <a href="https://social.msdn.microsoft.com/Forums/office/en-US/5bba... | <python><winapi><pywin32> | 2023-03-10 09:40:52 | 1 | 16,927 | Erwin Kalvelagen |
75,694,367 | 13,049,379 | Understanding Pytorch Tensor Slicing | <p>Let <code>a</code> and <code>b</code> be two PyTorch tensors with <code>a.shape=[A,3]</code> and <code>b.shape=[B,3]</code>. Further <code>b</code> is of type <code>long</code>.</p>
<p>Then I know there are several ways slicing <code>a</code>. For example,</p>
<pre><code>c = a[N1:N2:jump,[0,2]] # N1<N2<A
</cod... | <python><pytorch><slice><tensor> | 2023-03-10 09:32:47 | 1 | 1,433 | Mohit Lamba |
75,694,356 | 1,736,294 | Python OSError: Failure with SFTP | <p>I'm testing SFTP communication on a Windows 11 laptop with SFTP server running at localhost:3373. An <code>sftp.get</code> request generates an <em>"OSError: Failure"</em> error with this code:</p>
<pre><code>import pysftp
remotepath = "C:/Users/Profile/sftpdata/remote/gimme.txt"
localpath = &qu... | <python><sftp><paramiko><pysftp> | 2023-03-10 09:31:25 | 1 | 4,617 | Henry Thornton |
75,694,218 | 19,546,216 | Python: How to get index from an Array of JSON? | <p>So, I was able to answer my question before on how to get the value of a JSON from an array of JSON. But now I'm trying to convert it in Python(for selenium).</p>
<p>Here is the Array of JSON:</p>
<pre><code>[
{
"id": 3328367679,
"inbox_id": 35584,
"subject":... | <python><json><for-loop><selenium-webdriver><python-requests> | 2023-03-10 09:17:57 | 2 | 321 | Faith Berroya |
75,694,005 | 3,573,626 | Transform laltitude and longitude in python pandas using pyproj | <p>I have a dataframe as below:</p>
<pre><code>df = pd.DataFrame(
{
'epsg': [4326, 4326, 4326, 4203, 7844],
'latitude': [-34.58, -22.78, -33.45, -33.60, -30.48],
'longitude': [122.31, 120.2, 118.55, 140.77, 115.88]})
</code></pre>
<p>Here is the function to transform the lat/long if it is not based o... | <python><pandas><latitude-longitude><pyproj><epsg> | 2023-03-10 08:58:13 | 2 | 1,043 | kitchenprinzessin |
75,693,988 | 1,826,066 | Handle empty columns in polars when concatenating dataframes | <p>I want to be able to concatenate dataframes in <code>polars</code> where the dataframes have the same columns, but some of the dataframes have no data for a subset of the columns.</p>
<p>More precisely, I am looking for the <code>polars</code> equivalent of this <code>pandas</code> minimal working example:</p>
<pre ... | <python><dataframe><python-polars> | 2023-03-10 08:56:04 | 1 | 1,351 | Thomas |
75,693,958 | 2,119,941 | Error in calling TaskGroup operator wrapped in function - AirflowException: TaskGroup can only be used inside a dag | <p>Using Airflow v2.5.1</p>
<p>I'm omitting all the functions operators are calling since this is not a problem.</p>
<p>I have a following basic DAG:</p>
<pre><code>with DAG('00_s3_file_processing_to_redshift', default_args=default_args, schedule_interval=None) as dag:
start_task = DummyOperator(
task_id='sta... | <python><airflow> | 2023-03-10 08:53:03 | 0 | 15,380 | Hrvoje |
75,693,943 | 12,396,154 | How to create nested and complex dictionary from an existing one? | <p>I'd like to create a new dictionary from this dictionary:</p>
<pre><code>inp = {'tagA':
{'2023-03-09 00:00:00': 'X',
'2023-03-09 01:00:00': 'X',
'2023-03-09 02:00:00': 'Y',
'2023-03-09 03:00:00': 'Z',
'2023-03-09 04:00:00': 'X'},
'tagB':
{'2023-03-09 00:00:00': 'Y',
... | <python><list><dictionary> | 2023-03-10 08:51:53 | 3 | 353 | Nili |
75,693,927 | 12,783,363 | Pygame: How to iterate through numbers and check for key presses on each number using pygame.key.get_pressed? | <p>Currently I have the below set-up. Doing so for 9 more numbers is a bit messy. Is there a way to have a code resembling the "Target" below?</p>
<p>Current:</p>
<pre><code>keys = pygame.key.get_pressed()
if keys[pygame.K_1]:
print("1")
# more if statements
</code></pre>
<p>Target:</p>
<pre><co... | <python><pygame> | 2023-03-10 08:50:15 | 1 | 916 | Jobo Fernandez |
75,693,905 | 8,461,786 | Type hint for an argument that is an attribute of a class | <p>I work on a legacy codebase where some constants are encapsulated in a class:</p>
<pre><code>class Fields:
FIELD_1 = 'field 1 name'
</code></pre>
<p>This class is often use like:</p>
<pre><code>some_dict[Fields.FIELD_1]
</code></pre>
<p>Now I would like to type hint a function operating on this class:</p>
<pre><... | <python><python-typing> | 2023-03-10 08:47:37 | 1 | 3,843 | barciewicz |
75,693,876 | 6,224,975 | scipy.sparse vstack or hstack when two matrices have different numbers of rows and columns | <p>I have multiple sparse matrices I want to merge into one.</p>
<p>Each matrice is made up of the following:</p>
<pre class="lang-py prettyprint-override"><code>import pandas as pd
from sklearn.feature_extraction.text import CountVectorizer
from local_utils import get_data
def _count_words_within_userid(x):
... | <python><matrix><scipy> | 2023-03-10 08:44:06 | 2 | 5,544 | CutePoison |
75,693,850 | 1,310,540 | Post array of dictionary using multipart/form-data in python | <p>I am having an issue while posting my array to some url. The requested url only supports <code>content-type=multipart/form-data</code>.</p>
<p>The <a href="https://intrasheets.com/docs/api/value" rel="nofollow noreferrer">documentation sample</a> is in <strong>node.js</strong>, and it works fine. But I need to achie... | <python><multipartform-data> | 2023-03-10 08:41:03 | 2 | 931 | Mehmood |
75,693,197 | 3,553,814 | Pydash: how to find using a object: py_.collections.find(DATA, OBJECT) | <p>In lodash I can use the syntax:
<code>find(ARRAY_OF_OBJECTS, OBJECT)</code>
This will return an object from the array if it meets the criteria of the passed object. In this case <code>OBJECT</code> would be e.g. <code>{ active: true, dimension: 'target' }</code>. The objects in the array would contain e.g. <code>act... | <python><lodash><pydash> | 2023-03-10 07:14:54 | 1 | 549 | Edgar Koster |
75,693,136 | 1,525,238 | Configure isort to not touch already existing sections but only sort within sections | <p>I want to configure <code>isort</code> such that it doesn't touch my sections but only sorts within sections alphabetically or according to some other parameter. Namely I want it to turn:</p>
<pre><code>import z
import a
from my.package.b import thing
from my.package.a import other
</code></pre>
<p>into:</p>
<pre><... | <python><isort> | 2023-03-10 07:05:48 | 1 | 5,334 | Ayberk ΓzgΓΌr |
75,693,121 | 15,181,384 | Python: create interactive ssh-session with parameters host and user | <p>I am trying to build a small tui-program that allows me to choose hostname and username for a ssh-session from a list.</p>
<p>My question is how to create an interactive ssh-session with these parameters.</p>
<p>I tried the subprocess.popen:</p>
<pre><code>subprocess.Popen(["ssh", "username@host"... | <python><ssh><subprocess> | 2023-03-10 07:04:21 | 0 | 361 | JadBlackstone |
75,693,094 | 5,783,373 | Excel sheets processing in python | <p>I want to iterate over each sheet in excel file to apply some function on top of the data in each sheet and then get the output in a separate excel with all the processed sheets of the original excel file (i.e. not an inplace operation).</p>
<p>Example :</p>
<p>Input file "Myfile.xlsx" contains 3 sheets (n... | <python><python-3.x><excel><dataframe> | 2023-03-10 06:59:56 | 1 | 345 | Sri2110 |
75,693,033 | 10,313,194 | Can I get F1 score each time from GridSearchCV? | <p>I want to show F1 score from gridsearch each loop of change parameter. I use <code>f1_micro</code> in the GridSearchCV like this.</p>
<pre><code>params = {
'max_depth': [None, 2, 4, 6, 8, 10],
'max_features': [None, 'sqrt', 'log2', 0.2, 0.4, 0.6, 0.8],
}
clf = GridSearchCV(
estimator=DecisionTreeClass... | <python><scikit-learn><grid-search><gridsearchcv> | 2023-03-10 06:52:18 | 1 | 639 | user58519 |
75,692,831 | 17,696,880 | How to write this new file completing with information inside a string in the correct positions? | <p>If I have this string, it contains several lines separated by newlines.</p>
<pre class="lang-py prettyprint-override"><code>data_string = """
te gustan los animales?
puede que algunos me gusten pero no se mucho de eso
animales
puede que algunos me gusten pero no se mucho de eso
te gustan las plantas... | <python><python-3.x><string><file><file-writing> | 2023-03-10 06:21:51 | 1 | 875 | Matt095 |
75,692,797 | 800,735 | When using Apache Beam Python with GCP Dataflow, does it matter if you materialize the results of GroupByKey? | <p>When using Apache Beam Python with GCP Dataflow, is there a downside to materializing the results of GroupByKey, say, to count the number of elements. For example:</p>
<pre><code>def consume_group_by_key(element):
season, fruits = element
for fruit in fruits:
yield f"{fruit} grows in {season}&q... | <python><out-of-memory><generator><google-cloud-dataflow><apache-beam> | 2023-03-10 06:14:52 | 1 | 965 | cozos |
75,692,576 | 14,700,182 | Why is median blur not working? - OpenCV - Python | <p>I have a function to add gaussian noise to an image read by OpenCV with <code>imread</code> that returns an image (matrix).</p>
<p>I am trying to use median blur on that image but terminal returns this error:</p>
<pre><code>median = cv2.medianBlur(image, 5)
^^^^^^^^^^^^^^^^^^^^^^^^
cv2.error: OpenCV(4.7... | <python><opencv><image-processing><types> | 2023-03-10 05:34:56 | 1 | 334 | Benevos |
75,692,571 | 6,245,473 | Look up column in csv file and enter value in corresponding column? | <p>The following code works well, but it does not look up anything from a csv file. Symbols must be entered manually ('MSFT','AAPL','GOOG') in order for values to be retrieved (asOfDate & PbRatio). There are about 300,000 symbols.</p>
<pre><code>import pandas as pd
from yahooquery import Ticker
symbols = ['MSFT'... | <python><pandas><dataframe><csv><yfinance> | 2023-03-10 05:34:17 | 2 | 311 | HTMLHelpMe |
75,692,262 | 45,843 | PyCharm not finding conda pytorch | <p>I'm trying to use PyCharm to edit a program that uses PyTorch, but the IDE is not finding the library.</p>
<p>The program runs from the command line, as the conda environment does have PyTorch installed:</p>
<pre><code>(torch2) C:\>conda list
# packages in environment at C:\Users\russe\Anaconda3\envs\torch2:
#
# ... | <python><pycharm><anaconda><conda> | 2023-03-10 04:27:18 | 1 | 34,049 | rwallace |
75,692,123 | 9,008,162 | Is it more efficient to loop though (a bunch of csv lines) or (list contains dictionary)? | <p>I can download the data as <code>csv</code> or <code>json</code>. If the data is in csv, I use <code>response.text</code> to convert it to text before inserting it into the dictionary. The data sample looks like this:</p>
<pre><code>Date,Open,High,Low,Close,Adjusted_close,Volume
1966-07-05,10.9176,11.0872,10.836,10.... | <python><json><list><csv><dictionary> | 2023-03-10 03:49:13 | 1 | 775 | saga |
75,692,036 | 3,789,481 | Plotly shows wrong data of Gantt chart when using subplot | <p>I have the Gantt chart which is plotted by px.timeline is working well like below image. As it would be overlapping each other and could be easier to review with transparent color as well.</p>
<p><a href="https://i.sstatic.net/QONeO.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/QONeO.png" alt="enter... | <python><pandas><plotly> | 2023-03-10 03:28:31 | 1 | 2,086 | Alfred Luu |
75,691,952 | 6,137,682 | How to apply a method to all values in Enum class? | <p>I have some <code>Enum</code>s which may or may not have clashing names but are in different modules, so I want to apply some sort of prefix / suffix lambda to make them unique without having to manually specify it for each value. How can I alter my <code>Enum</code> class definitions to do something like the follow... | <python><enums> | 2023-03-10 03:09:08 | 1 | 685 | David Owens |
75,691,822 | 1,628,347 | python type alias, pydantic constranined list, and mypy | <p>Related to <a href="https://github.com/pydantic/pydantic/issues/975" rel="nofollow noreferrer">https://github.com/pydantic/pydantic/issues/975</a>.</p>
<p>I basically have:</p>
<pre><code>Class A(BaseModel):
x: int
Class B(BaseModel):
as: # List of A, size >=1
Class C(BaseModel):
as: # List of A, ... | <python><pydantic> | 2023-03-10 02:41:55 | 0 | 1,225 | allstar |
75,691,795 | 7,788,402 | Expecting property name enclosed in double quotes: line 2 column 1 (char 2) | <p>I have simple Python code to read a JSON file, but I keep getting the error <code>Expecting property name enclosed in double quotes: line 2 column 1 (char 2)</code> when I use <code>json.load()</code> function.</p>
<pre><code>import json
f = open(json_path)
for line in f:
print(line)
print(json.loads(line)... | <python><json><file> | 2023-03-10 02:34:46 | 1 | 2,301 | PCG |
75,691,599 | 2,480,947 | Multi-part values as hash key/set entries in Ruby | <p>In Python I can use tuples (or any hashable object) as dictionary keys or set members. It's useful for deduping:</p>
<pre class="lang-py prettyprint-override"><code>cool_podcast_guests = set([
('Emma', 'Suter'),
('Dave', 'Warner'),
('Evie', 'Wilde'),
('Emma', 'Suter'),
])
for forename, surname in c... | <python><ruby><dictionary><duplicates> | 2023-03-10 01:44:50 | 2 | 1,734 | Kim |
75,691,516 | 19,425,874 | Printing to a label printer via Python but nothing is happening | <p>Driving myself crazy, desperate need of a Python pro. I have been trying to figure this out for days on days -- at first I wasn't able to figure out setting up the connection. That error is gone now thankfully, but now my code is simply not doing anything. There is no error, but it's also not printing the tab like... | <python><winapi><printing><pywin32> | 2023-03-10 01:29:03 | 0 | 393 | Anthony Madle |
75,691,374 | 13,609,298 | How to get the colors of a bar plot | <p>There are a number of similar questions out there, but I am struggling to tailor it to my specific case (which is in fact easier). I have the following data:</p>
<pre><code>data = {'CCM1': {'Exact': 15.32, '1 Notch': 36.29, '2 Notches': 45.97},
'CCM2': {'Exact': 24.19, '1 Notch': 42.74, '2 Notches': 54.03},
... | <python><matplotlib><bar-chart> | 2023-03-10 00:57:40 | 0 | 311 | Carl |
75,691,196 | 11,080,806 | Does pyproject.toml need to exist in the target directory when using poetry to install a local package? | <p>I have a local package, "mypackage", inside a venv environment. I successfully ran <code>poetry install</code> and I'm able to import it into Python sessions started inside of the same virtual env. Now I want to use mypackage in other projects and environments on my machine, specifically a pipenv environme... | <python><pipenv><python-poetry> | 2023-03-10 00:16:22 | 1 | 568 | Jonathan Biemond |
75,691,072 | 13,138,364 | Plot regression confidence interval using seaborn.objects | <p>How can I use the <code>objects</code> API to plot a regression line with confidence limits (like <a href="https://seaborn.pydata.org/generated/seaborn.regplot.html" rel="nofollow noreferrer"><code>sns.regplot</code></a> / <a href="https://seaborn.pydata.org/generated/seaborn.lmplot.html" rel="nofollow noreferrer"><... | <python><pandas><seaborn><scatter-plot><seaborn-objects> | 2023-03-09 23:51:30 | 1 | 42,007 | tdy |
75,690,891 | 2,320,476 | How to read the content of a file sent as application/octet-stream | <p>I am using an API that returns application/octet-stream. I want to be able to get the content.</p>
<p>Here is what I see in the data section while debugging</p>
<pre><code> HTTPHeaderDict({'Cache-Control': 'no-cache', 'Pragma': 'no-cache', 'Content-Length': '20738',
'Content-Type': 'application/octet-stream'... | <python> | 2023-03-09 23:11:51 | 0 | 2,247 | Baba |
75,690,641 | 5,394,072 | pandas group by one column, aggregate another column, filter on a different column | <p>says this is my data.</p>
<pre><code>pd.DataFrame({'num_legs': [4,4,5,6,7,4,2,3,4, 2,4,4,5,6,7,4,2,3,3,5,5,6], 'num_wings': [2,7,21,0,21,13,23,43, 2,7,21,13,23,43,23,23,23,11,26,32,75,13], 'new_col':np.arange(22)})
</code></pre>
<p>I would like to do the following.</p>
<ol>
<li>Group by 'num_legs', and compute rolli... | <python><pandas> | 2023-03-09 22:31:10 | 2 | 738 | tjt |
75,690,506 | 6,245,473 | Convert txt python dictionary file to csv data file? | <p>I have a text file with 300,000 records. A sample is below:</p>
<pre><code>{'AIG': 'American International Group', 'AA': 'Alcoa Corporation', 'EA': 'Electronic Arts Inc.'}
</code></pre>
<p>I would like to export the records into a csv file like this:</p>
<p><a href="https://i.sstatic.net/JyVDl.png" rel="nofollow no... | <python><pandas><dataframe><csv><txt> | 2023-03-09 22:09:24 | 1 | 311 | HTMLHelpMe |
75,690,483 | 2,359,203 | How to use Python ldap3 Kerberos authentication on Linux without editing any config files? | <p>How can I log into an LDAP server with a Kerberos username and password without making any changes to the configuration of the computer that the Python script is running on? <a href="https://ldap3.readthedocs.io/en/latest/bind.html#kerberos" rel="nofollow noreferrer">The ldap3 documentation</a> assumes that Kerberos... | <python><linux><ldap><kerberos><ldap3> | 2023-03-09 22:04:52 | 2 | 887 | Alex Henrie |
75,690,455 | 66,580 | Quick and dirty replacement for asciinema server | <p>On a slow and low resource dev box I need to save terminal sessions using asciinema. I cannot afford to install the official asciinema-server. I tried to find out what is being sent to the server and save it with a small PHP script. So I created a <code>~/.config/asciinema/config</code> config file and set the api u... | <python><asciinema> | 2023-03-09 22:00:16 | 0 | 30,410 | Majid Fouladpour |
75,690,421 | 2,525,940 | How many QTimers can I have in a pyqt app? | <p>I'm working on a pyqt 5 app that controls a piece of industrial plant.
We have a lot of:<br />
Do a for x seconds then do b for y minutes</p>
<p>Each of these is implemented with (mostly) single-shot QTimers. There are currently about 110 of these.
Most of these won't be running at the same time and timing accuracy ... | <python><pyqt><pyqt5> | 2023-03-09 21:55:58 | 2 | 499 | elfnor |
75,690,418 | 5,969,893 | Airflow SSHOperator Command Timed Out when executing Python script | <p>I created a DAG that successfully uses SSHOperator to execute a simple Python script from a server(note I have set <code>cmd_timeout = None</code></p>
<p>When I change the simple Python script to a more complex script, I get an error for "SSH command timed out"</p>
<p>Additionally, if i log into the serve... | <python><ssh><airflow> | 2023-03-09 21:55:37 | 2 | 667 | AlmostThere |
75,690,403 | 12,415,855 | Selenium / Accept cookie-window? | <p>i would like to automate the following site:
<a href="https://atlas.immobilienscout24.de/" rel="nofollow noreferrer">https://atlas.immobilienscout24.de/</a></p>
<p>using this code:</p>
<pre><code>from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.servi... | <python><selenium-webdriver> | 2023-03-09 21:53:33 | 2 | 1,515 | Rapid1898 |
75,690,331 | 1,023,753 | IronPython3 Host throws "TypeErrorException: metaclass conflict" when inheriting from a .net class | <p>I have the following C# type:</p>
<pre><code>[PythonType]
public class ScriptBase
{
public virtual int TestMe()
{
return 11;
}
}
</code></pre>
<p>Then, I'm trying to create a class that inherits from <code>ScriptBase</code> in python:</p>
<pre><code>from Base import ScriptBase
class TestClass (S... | <python><c#><.net><ironpython> | 2023-03-09 21:43:51 | 1 | 3,065 | noisy cat |
75,690,295 | 9,329,400 | Python import from package file inside same directory | <p>I'm trying to create my first <a href="https://github.com/josh-bone/sportsrefscraper" rel="nofollow noreferrer">python package</a>, and I have a dicrectory structured like this:</p>
<pre><code>.
βββ LICENSE
βββ README.md
βββ requirements.txt
βββ setup.py
βββ test_scrape.py
βββ sportsrefscraper
β βββ __init__.py
β ... | <python><import><package> | 2023-03-09 21:39:04 | 1 | 610 | JTB |
75,690,171 | 7,517,192 | How can I make poetry install the Python version required in pyproject.toml? | <p>One thing about poetry seems really odd to me:</p>
<p>When you install poetry, it installs the latest Python version and uses this as a default for all poetry projects. If a different Python version is required as per a per the project's pyproject.toml, the poetry documentation states that you must point poetry to a... | <python><python-3.x><python-poetry> | 2023-03-09 21:23:27 | 2 | 3,626 | Alex |
75,690,154 | 6,296,919 | mark duplicate as 0 in new column based on condition | <p>I have dataframe as below</p>
<pre><code>data =[['a',96.21623993,1],
['a',99.88211060,1],
['b',99.90232849,1],
['b',99.91232849,1],
['b',99.91928864,1],
['c',99.89162445,1],
['d',99.95264435,1],
['a',99.82862091,2],
['a',99.84466553,2],
['b',99.89685059,2],
['c',78.10614777,2],
['c',97.73305511,2],
['d',95.42383575,... | <python><python-3.x><dataframe><group-by> | 2023-03-09 21:20:35 | 2 | 847 | tt0206 |
75,690,113 | 9,983,652 | regular expression with group to a string including ( ) and dash | <p>I am trying to use regular expression to find number. But I never succeed. Can anyone help me with it?</p>
<pre><code>import re
item='800-850(0.2)'
find_list=re.findall(r'(\d+)\-(\d+)\((\d+)\)$',item)
print(find_list)
[]
</code></pre>
<p>The above return empty [], what I wanted is [800,850,0.2]. I am using () to cap... | <python> | 2023-03-09 21:15:39 | 1 | 4,338 | roudan |
75,689,975 | 7,613,669 | Python Pulp: Optimise while limiting element frequency between groups | <p>I am trying to optimise a problem with several constraints, where elements (e.g. person) are duplicated between groups and I need to select the correct elements such that the total <strong>groups scores</strong> are maximised.</p>
<ol>
<li>I can only select an element (e.g person) <strong>1 time</strong>.</li>
<li>A... | <python><optimization><pulp> | 2023-03-09 20:58:12 | 0 | 348 | Sharma |
75,689,924 | 99,717 | python sqlite3 table disappearing for no apparent reason | <p>I have a python sqlite3 db with a single table that for no obvious reason 'disappears' -- I guess it's getting dropped. The database file is still there, and does not seem to be 'corrupted': I can connect to it via CLI and execute basic operations on it:</p>
<pre><code>sqlite> SELECT name FROM sqlite_schema WHERE... | <python><sqlite> | 2023-03-09 20:51:54 | 1 | 8,851 | Hawkeye Parker |
75,689,914 | 6,552,666 | How to tell python to use same directory for file | <p>I need this python project to be useable for multiple users after downloading it from git, but I'm having a problem generalizing paths. I have it set to use absolute paths in my version, but that will break for others, and if I'm using a file in the same directory as the module, python can't find it if I use the rel... | <python> | 2023-03-09 20:51:20 | 1 | 673 | Frank Harris |
75,689,889 | 10,387,506 | Python API call pagination issue | <p>I am stuck on the following issue: I have the code below for an API call. In and of itself, the API call is fine, no server issues, I have checked it in Postman:</p>
<pre><code>{
"@odata.context": "https://api.channeladvisor.com/v1/$metadata#Orders",
"value": [
{....}
... | <python><json> | 2023-03-09 20:48:37 | 1 | 333 | Dolunaykiz |
75,689,761 | 1,185,242 | How do you detect the largest set of parallel lines in an image? | <p>I have images with multiple line in them and I'm looking to detect the largest set of lines which are (approximately) parallel using Python and OpenCV. For example give:</p>
<p><a href="https://i.sstatic.net/UI5Mr.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/UI5Mr.png" alt="enter image description ... | <python><algorithm><geometry> | 2023-03-09 20:33:49 | 1 | 26,004 | nickponline |
75,689,738 | 10,045,805 | How can I dynamically populate a table in Google Doc using their API? | <p>In Python, I have a list of dicts with all the data I want to display inside a table in a Google Doc:</p>
<pre class="lang-py prettyprint-override"><code>fruits = [
{"name": "apple", "description":"juicy", "stuff": "why not?"},
{"name": &q... | <python><google-docs><google-docs-api> | 2023-03-09 20:31:48 | 1 | 380 | cuzureau |
75,689,436 | 4,036,532 | How to open a pretrained PyTorch model that isn't in the Torch library? | <p>I am trying to load some of the models from <a href="https://github.com/facebookresearch/fairseq/tree/0338cdc3094ca7d29ff4d36d64791f7b4e4b5e6e/examples/data2vec" rel="nofollow noreferrer">data2vec2</a> so that I can execute predictions. I have, on that page, downloaded 2 models: <code>base_imagenet.pt</code> (which ... | <python><pytorch> | 2023-03-09 19:55:56 | 1 | 2,202 | Katya Willard |
75,689,185 | 7,794,924 | How to QUICKLY batch scan video files to check for integrity (corrupt / valid) | <p>This question has been asked several times on this forum, with the accepted answer using ffmpeg to assess the integrity of the file with these example commands:</p>
<pre><code># scan a single file
ffmpeg.exe -v error -i C:\to\path\file.avi -f null - >error.log 2>&1
# batch scan
find C:\to\path\ -name &quo... | <python><bash><macos><ffmpeg><mp4> | 2023-03-09 19:25:41 | 2 | 812 | nhershy |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.