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,824,288 | 9,372,996 | Another Python not working in cron question | <p>Directory: <code>path/to/test</code></p>
<p><code>tree</code>:</p>
<pre><code>.
βββ Pipfile
βββ test.py
βββ test.sh
βββ test.txt
</code></pre>
<p><code>test.py</code>:</p>
<pre class="lang-py prettyprint-override"><code>#!/usr/bin/env python3
import datetime
with open("/path/to/test/test.txt", "a&qu... | <python><linux><shell><cron><zsh> | 2022-12-16 12:11:18 | 0 | 741 | AK91 |
74,824,268 | 514,149 | How to log from multiple processes with different context (spawn/fork)? | <p>I have a Python application that spawns multiple daemon processes. I need to create these processes <a href="https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods" rel="nofollow noreferrer">via the <code>spawn</code> start method</a>. Since I want to log into a single file, I follow the <... | <python><logging><multiprocessing><queue><python-logging> | 2022-12-16 12:09:17 | 1 | 10,479 | Matthias |
74,824,239 | 9,597,871 | How to initialize dataclass field with a copy of a list? | <p>I'm parsing text files which have the following line structure:</p>
<blockquote>
<p>name_id, width, [others]</p>
</blockquote>
<p>After parsing an input, I'm feeding each parsed line into the <code>dataclass</code>:</p>
<pre class="lang-py prettyprint-override"><code>@dataclass(frozen=True, eq=True)
class Node():
... | <python><python-dataclasses> | 2022-12-16 12:06:12 | 1 | 348 | Kezif Garbian |
74,824,179 | 1,134,241 | How to incorporate a piece-wise release of a contaminant and solve the diffusion equation over space and time | <p>I have a contamination source that releases for 10 minutes at the centre of a room and then turns off. The 1D diffusion equation with decay over time and space seems reasonable:</p>
<p>$dC/dt = D * d^2C/dx^2 - k * C$</p>
<p>It's easy to solve if the initial and boundary condition <code>C(50)=1</code> (and looks like... | <python> | 2022-12-16 12:00:06 | 0 | 2,263 | HCAI |
74,824,071 | 2,054,399 | Parallelize and separate computation from storage in python | <p>I am trying to parallelize the computation and storage of intermediate results. The task can be described as follows:</p>
<p>Given a large set of tasks to compute, take a chunk of tasks and parallelize some kind of computation across the available CPU/GPU. The output is relatively large so that it doesn't fit in mem... | <python><parallel-processing><storage><python-multiprocessing> | 2022-12-16 11:51:13 | 1 | 1,166 | Kam Sen |
74,823,988 | 13,285,583 | How to run selenium in Docker with Flask? | <p>My goal is to run Selenium with Flask. The problem is that it throws an error.</p>
<pre><code>[2022-12-16 11:30:05 +0000] [1] [INFO] Starting gunicorn 20.1.0
[2022-12-16 11:30:05 +0000] [1] [INFO] Listening at: http://0.0.0.0:8080 (1)
[2022-12-16 11:30:05 +0000] [1] [INFO] Using worker: sync
[2022-12-16 11:30:05 +00... | <python><django><docker><selenium><selenium-webdriver> | 2022-12-16 11:42:55 | 0 | 2,173 | Jason Rich Darmawan |
74,823,970 | 9,308,542 | Selenium - How to send file path to dynamically generated input element (not present in dom) | <p>here is an example</p>
<p>html</p>
<pre><code><button id="visible-btn">visible button</button>
<p>selected file is: <span id="selected-file"></span></p>
</code></pre>
<p>javascript (usually hidden deep inside)</p>
<pre><code>document.getElementById('visible-btn... | <javascript><python><html><reactjs><selenium> | 2022-12-16 11:41:08 | 1 | 335 | Gayan Jeewantha |
74,823,966 | 5,510,540 | Two colour heat map in python | <p>I have the following data:</p>
<pre><code>my_array = array([[0, 0, 1, 0, 0],
[0, 1, 1, 1, 0],
[0, 0, 0, 1, 1],
[0, 0, 1, 1, 1],
[0, 1, 1, 0, 0],
[1, 1, 1, 1, 0],
[0, 1, 1, 1, 1],
[0, 0, 0, 0, 1],
[0, 1, 0, 1, 0]])
</code></pre>
<p>and</p>
<pre><code>df.values =... | <python><heatmap> | 2022-12-16 11:40:41 | 1 | 1,642 | Economist_Ayahuasca |
74,823,788 | 11,274,362 | How to change position of endpoints in drf-yasg Django | <p>I'm trying to customize <code>drf</code> api documentation with <code>drf-yasg</code>.
<strong>I want to change order of display endpoints.</strong> For example to change:</p>
<pre><code>GET /endpoint/number1/
GET /endpoint/number2/
</code></pre>
<p>to</p>
<pre><code>GET /endpoint/number2/
GET /endpoint/number1/
</... | <python><django><django-rest-framework><swagger><drf-yasg> | 2022-12-16 11:25:21 | 1 | 977 | rahnama7m |
74,823,783 | 6,372,859 | Building Pipelines | <p>I've been recently trying to set up a Pipeline to produce a Machine Learning model. I have built my own data preprocessing classes and a new class with an optimized sklearn algorithm: Regresor_Model; however when I declare the pipeline steps, for example:</p>
<pre><code>from source.preprocessing_functions import Cha... | <python><machine-learning><scikit-learn><scikit-learn-pipeline> | 2022-12-16 11:25:10 | 0 | 583 | Ernesto Lopez Fune |
74,823,596 | 298,847 | Type a function that takes a tuple and returns a tuple of the same length with each element optional? | <p>I want to write a function that takes a tuple and returns a tuple of the same size but with each element wrapped in optional. Pseudo code:</p>
<pre class="lang-py prettyprint-override"><code>from typing import TypeVar
T = TypeVar("T", bound=tuple[dict[str, str], ...])
def f(tup: T) -> Map[Optional, T]... | <python><python-typing> | 2022-12-16 11:08:20 | 2 | 9,059 | tibbe |
74,823,525 | 5,618,856 | Match case against data type makes "remaining patterns unreachable" | <p>Why is</p>
<pre><code>match type('a'):
case list:
print('a list')
case str:
print('a string')
</code></pre>
<p>wrong with giving an error "SyntaxError: name capture 'list' makes remaining patterns unreachable"</p>
<p>while <code>type('a')==str</code> is <code>true</code>?</p>
| <python><python-3.x> | 2022-12-16 11:02:03 | 0 | 603 | Fred |
74,823,224 | 12,858,691 | Pandas scale column(s) in groupby | <p>I want to scale the column "amount" between <code>[0,1]</code> grouped by the two key columns. Consider the following example:</p>
<pre><code> key1 key2 amount
0 a 1 10
1 a 1 20
2 a 1 30
3 a 2 10
4 a 2 40
5 a 2 100
6 b 1 30
7 b 1 150
8 b 1 ... | <python><pandas><scikit-learn> | 2022-12-16 10:36:12 | 1 | 611 | Viktor |
74,823,091 | 10,574,250 | python script read in from subscript not finding file in directory even though the os.listdir sees it and subscript works fine on its own | <p>I am reading a python subscript into a python script. The subscript uses an excel file in it's working directory. The structure looks like this</p>
<pre><code>main_folder ->
main.py
subfolder ->
data.xlsx
submain.py
</code></pre>
<p>My main script calls the subscript as such:</p>
<pre><code>from subf... | <python><pandas><operating-system> | 2022-12-16 10:23:23 | 1 | 1,555 | geds133 |
74,823,031 | 7,334,203 | Merge and manipulate xslt file using python lxml | <p>im a newbie in python and i have a difficult task to cope. Suppose we have two xslt files, the first one is like this:</p>
<pre><code><xsl:stylesheet version="1.0">
<xsl:function name="grp:MapToCD538A_var107">
<xsl:param name="var106_cur" as="node()"... | <python><xml><xslt><lxml> | 2022-12-16 10:17:34 | 2 | 7,486 | RamAlx |
74,822,950 | 10,097,229 | Save graph to blob in Azure Function | <p>I have a Python code that plots a graph in the end. The issue is when I am calling this code with Azure Function, it is not able to plot the graph. So, instead I tried saving the graph on Azure blob storage. But there's no option to upload the graph on blob without saving it loxally on VS Code. And Azure Function do... | <python><azure><azure-functions> | 2022-12-16 10:09:07 | 1 | 1,137 | PeakyBlinder |
74,822,700 | 6,053,274 | How to optimize the performance of a `pandas` `DataFrame` using `numexpr` and `Dask`? | <p>I'm working with a large <code>pandas</code> <code>DataFrame</code> and I'm trying to optimize its performance using the <code>numexpr</code> and <code>Dask</code> libraries. I've tried using the <code>numexpr.evaluate()</code> function to perform element-wise operations on the DataFrame, but it's still taking a lon... | <python><pandas><dask-dataframe><numexpr> | 2022-12-16 09:46:44 | 0 | 495 | Gil |
74,822,689 | 80,353 | How do I enforce a project to always wrap certain tags with {% raw %} and {% endraw %}? | <p>I am creating template starters that will work with cookiecutter, a python library.</p>
<p>So inside some of the subfolders of a project, for files of a particular type, usually <code>.html</code>, I need any tags that look like this</p>
<p><code>{% if blah blah %}</code></p>
<p>to be wrapped like this</p>
<p><code>... | <python><templating><cookiecutter> | 2022-12-16 09:45:18 | 1 | 10,902 | Kim Stacks |
74,822,568 | 80,353 | How to programatically create a svg with different colors in python/django? | <p>In telegram, when you have yet to upload your picture, they will programatically generate a logo based on your initials like the following</p>
<p><a href="https://i.sstatic.net/2jSIM.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/2jSIM.png" alt="enter image description here" /></a></p>
<p>I want some... | <python><django><svg><tailwind-css> | 2022-12-16 09:33:18 | 0 | 10,902 | Kim Stacks |
74,822,543 | 7,339,624 | Colab: libtorch_cuda_cu.so: cannot open shared object file: No such file or directory warn(f"Failed to load image Python extension: {e}") | <p>I'm trying to use the python package <code>aitextgen</code> in google Colab so I can fine-tune GPT.</p>
<p>First, when I installed the last version of this package I had this error when importing it.</p>
<pre><code>Unable to import name '_TPU_AVAILABLE' from 'pytorch_lightning.utilities'
</code></pre>
<p>Though with... | <python><import><google-colaboratory><huggingface-transformers><gpt-2> | 2022-12-16 09:31:33 | 1 | 4,337 | Peyman |
74,822,504 | 8,462,250 | Is there a way to do parrallelization in an Airflow task? | <p>My problem: I am trying to retrieve data from Google Ads. Sometimes the API call hangs indefinitely.</p>
<p>My idea: Create a separate process that monitors if the process doing the API call has returned data or has reached the timeout limit.</p>
<p>What I have tried:</p>
<ul>
<li>I looked into doing Threading. This... | <python><airflow> | 2022-12-16 09:27:06 | 1 | 452 | CristianCapsuna |
74,822,499 | 10,357,604 | Import Error when importing requests in Python 3 | <p>I'm trying to run a python program where I run</p>
<pre><code>from pycocotools.coco import COCO
import requests
</code></pre>
<p>I use Python 3.11.1. It throws ImportError</p>
<pre><code>C:\path>python utils.py --img_out obj/ --label_out obj/
Traceback (most recent call last):
File "C:\path\utils.... | <python><python-3.x><python-requests><importerror><urllib3> | 2022-12-16 09:26:54 | 1 | 1,355 | thestruggleisreal |
74,822,475 | 4,537,160 | Iterate through nested dict, check bool values to get indexes of array | <p>I have a nested dict with boolean values, like:</p>
<pre><code>assignments_dict = {"first": {'0': True,
'1': True},
"second": {'0': True,
'1': False},
}
</code></pre>
<p>and an array, with a numbe... | <python><dictionary> | 2022-12-16 09:24:39 | 2 | 1,630 | Carlo |
74,822,402 | 6,119,375 | NonConcreteBooleanIndexError fix with jax.numpy.where() in Python | <p>I am running a simple <a href="https://github.com/google/lightweight_mmm/blob/main/examples/simple_end_to_end_demo.ipynb" rel="nofollow noreferrer">demo example</a> of the lightweightMMM. I have used the lambda function for scaling, as follows:</p>
<pre><code>media_data_train_a = media_data[:split_point, :]
lambda_o... | <python><numpy><where-clause><jax> | 2022-12-16 09:19:07 | 1 | 1,890 | Nneka |
74,822,219 | 9,510,800 | Cross join within a dataframe given a time range pandas | <p>I am having a dataframe as below:</p>
<pre><code>ID GROUP DATE_MIN DATE_MAX
1 L1 02/12/2022 6:30AM 02/12/2022 6:35AM
2 L1 02/12/2022 6:33AM 02/12/2022 6:40AM
3 L1 02/12/2022 6:37AM 02/12/2022 6:40AM
4 L2 02/12/2022 7:30AM 02/12/2022 7:35AM
5 ... | <python><pandas><numpy> | 2022-12-16 09:01:40 | 2 | 874 | python_interest |
74,822,216 | 16,981,638 | remove outliers from a dataframe by while looping | <p>i've a dataframe and need to extract the outliers from it, then after that recheck the new dataframe again, if i found another outliers, then remove them also and so on...
The problem here is that i can remove the first outlier only and for the other outliers, i can't combine them with the previous outliers in one d... | <python><python-3.x><pandas><pyspark> | 2022-12-16 09:01:13 | 1 | 303 | Mahmoud Badr |
74,822,137 | 6,296,447 | Unable to install ddtrace using poetry on M1 Max | <p>I have a new M1 Max machine (Monterey) and when I run poetry install I get the error <code>Installing ddtrace (1.4.5): Failed</code>.</p>
<p>There's a long stack trace you can find <a href="https://gist.github.com/NRKirby/7ae65d4d92ce828455d03726a7c03367" rel="nofollow noreferrer">here</a></p>
<p>the first error app... | <python><datadog><python-poetry> | 2022-12-16 08:53:59 | 0 | 2,537 | Vinyl Warmth |
74,822,126 | 4,091,365 | Why does importing numpy prints 2313 to the screen? | <p>I'm seeing this really strange behavior where my script outputs the number 2313 when I import numpy. It annoys me, but I don't know why it happens and what I can do about it. I'm using python 3.11.0 and numpy version 1.23.4.</p>
<p>When my script is empty and I run it, nothing happens. However, when I write:</p>
<p>... | <python><numpy> | 2022-12-16 08:52:05 | 1 | 413 | SPK.z |
74,822,097 | 11,070,463 | Purpose of stop gradient in `jax.nn.softmax`? | <p><code>jax.nn.softmax</code> is defined as:</p>
<pre class="lang-py prettyprint-override"><code>def softmax(x: Array,
axis: Optional[Union[int, Tuple[int, ...]]] = -1,
where: Optional[Array] = None,
initial: Optional[Array] = None) -> Array:
x_max = jnp.max(x, axis, where=wher... | <python><machine-learning><deep-learning><autograd><jax> | 2022-12-16 08:49:48 | 2 | 4,113 | Jay Mody |
74,822,071 | 9,729,724 | queue.close() "raises" BrokenPipeError | <p>Using python 3.7 on Unix, the following code:</p>
<pre class="lang-py prettyprint-override"><code>import multiprocessing
queue = multiprocessing.Queue()
queue.put(1)
# time.sleep(0.01) Adding this prevents the error
queue.close()
</code></pre>
<p>"raises" (in the background) a BrokenPipeError:</p>
<pre><... | <python><multiprocessing><pipe> | 2022-12-16 08:47:47 | 1 | 303 | agemO |
74,822,063 | 1,056,563 | How to include instances of a given class in its constructor in python? | <p>How do we include instances of a given class in its constructor?</p>
<pre><code>class Node:
# Results in "Unresolved reference 'Node'"
def __init__(self, val: int, left: Node, right: Node):
self.val = val
self.left = left
self.right = right
</code></pre>
<p>Note: I hav... | <python> | 2022-12-16 08:46:59 | 0 | 63,891 | WestCoastProjects |
74,821,927 | 7,717,176 | Splitting list of strings in a column of vaex dataframe | <p>There is a vaex dataframe with a column such as:</p>
<pre><code>df['col']
['aa', ' NO']
['aa', ' NO']
['aa', ' NO']
['aa', ' NO']
['aa', ' NO']
</code></pre>
<p>I want to convert this one column to two columns as follow:</p>
<pre><code>df['col1', 'col2']
['aa'], [' NO']
['aa'], [' NO']
['aa'], [' NO']
['aa'], [' N... | <python><pandas><vaex> | 2022-12-16 08:35:32 | 1 | 391 | HMadadi |
74,821,825 | 4,451,521 | How to set a specific column of the last row of a dataframe | <p>I have a dataframe where the last row has a Nan</p>
<p>something like</p>
<pre><code> A,B,C
94,35.8621497534,139.8811398413,23.075931722607212
95,35.8621915301,139.8811617064,23.013675634522304
96,35.8622333249,139.8811835151,22.93392191824463
97,35.8622751476,139.881205254,22.98818503390619
98,35.8623169559,139.8... | <python><pandas> | 2022-12-16 08:23:13 | 0 | 10,576 | KansaiRobot |
74,821,758 | 9,205,369 | Python coverage used in Django takes too long to execute even though it is run with --source flag option | <p>I am using the Python package in combination with the Django testing framework and sometimes want to test only one app/directory/package stated in the coverage --source option.</p>
<pre><code>coverage run --source='custom_auth' manage.py test custom_auth.tests.TestAuth.test_authentication --keepdb
</code></pre>
<p>I... | <python><django><coverage.py><django-tests> | 2022-12-16 08:14:04 | 1 | 679 | Matija Lukic |
74,821,540 | 10,829,044 | Concat excel cols and combine rows into one using python pandas | <p>I have a data in excel sheet like as below</p>
<pre><code>Name Segment revenue Product_id Status Order_count days_ago
Dummy High value 1000 P_ABC Yes 2 30 days ago
Dummy High value 1000 P_CDE No 1 20 days ago
Dummy High value ... | <python><pandas> | 2022-12-16 07:51:00 | 1 | 7,793 | The Great |
74,821,480 | 13,588,525 | Tensorflow eye function | <p>I am trying to use the <code>tf.linalg.eye</code> function in TensorFlow to create a identity matrix, but I am having trouble understanding how to use the num_rows and num_columns arguments. Can someone explain how these arguments are used to determine the size of the identity matrix, and provide an example of how t... | <python><tensorflow2.0> | 2022-12-16 07:43:22 | 0 | 1,736 | Kaddu Livingstone |
74,821,261 | 19,303,365 | fetching the required info using regex within string | <p>i do have a below text which was extracted using <code>pdfminer</code> .</p>
<p><em><strong>Output from pdfminer</strong></em> :</p>
<blockquote>
<p><strong>Work Experience</strong> -Job Role/Establishment -Sales Assistant @ DFSDuration -June 2021 - PresentCurrently at DFS I work as a sales assistant, My role enta... | <python><regex> | 2022-12-16 07:17:14 | 2 | 365 | Roshankumar |
74,821,227 | 11,930,479 | Transformation function to be applied on every row in data frame | <p>I load a JSON file into a dataframe and want to apply one function on every single row. I will use the existing column "item_name" and do some logical checks and add a new column in the dataframe. But this doesn't work actually and throwing some error.</p>
<pre><code> def load_data(data_file):
with ope... | <python><json><python-3.x><pandas> | 2022-12-16 07:14:27 | 0 | 1,006 | Lilly |
74,820,793 | 14,617,547 | adding global variable in colab cause indent error | <p>I'm trying to add a global variable to quicksort algorithm in colab. It works fine without the global variable 'r' but when I introduce it, I receive nonsense error of indention. but indention is correct. pls help.</p>
<pre><code> # Quicksort Sort
r=0
def partition(array, low, high):
global r
pivot = array[hi... | <python><global-variables><google-colaboratory> | 2022-12-16 06:12:33 | 1 | 410 | Beryl Amend |
74,820,711 | 1,895,649 | Getting "PerformanceWarning: DataFrame is highly fragmented" when adding new columns to dataframe | <p>I have a pivot table which contains n number of columns with a format of YYYY-WW, since not all year-week combinations are present, I need to calculate the price difference and percentage of a weeks price vs the previous week.</p>
<p>I got it figured out, and it's working, but I get the following error:</p>
<pre cla... | <python><pandas><dataframe> | 2022-12-16 06:01:07 | 1 | 615 | joseagaleanoc |
74,820,698 | 11,332,693 | Python Groupby on String values | <p>Below is the input data</p>
<pre><code>A B C D
R1 J1 D1 S1,S2
R1 J1 D1 S3,S4,S5
R1 J1 D2 S5,S6,S2
R1 J1 D2 S7,S8
P1 J2 E1 T1,T2
P1 J2 E1 T3,T4,T5
P1 J2 E2 T5,T6,T2
P1 J2 E3 T7,T8,T5
</code></pr... | <python><pandas><string><group-by> | 2022-12-16 05:57:00 | 2 | 417 | AB14 |
74,820,634 | 11,502,399 | findHomography producing inaccurate transformation matrix | <p>I have the coordinates of the four corners of a table in my image frame as well as the actual dimensions of that table. What I want to do is find the transformation matrix from the table in the frame (first image) to the actual table (second image). The goal is to be able to map points in the raw frame (location of ... | <python><opencv><matrix><homography> | 2022-12-16 05:43:57 | 1 | 1,511 | Ken |
74,820,559 | 275,002 | Python: No of rows are always 9 and does not return affected rows count after UPDATE query | <p>This is not something complicated but not sure why is it not working</p>
<pre><code>import mysql.connector
def get_connection(host, user, password, db_name):
connection = None
try:
connection = mysql.connector.connect(
host=host,
user=user,
use_unicode=True,
... | <python><mysql><mysql-connector> | 2022-12-16 05:30:29 | 1 | 15,089 | Volatil3 |
74,820,512 | 10,192,022 | paramiko module is not catching the output | <p>I'm trying to get Kafka lags using paramiko module to catch sum of the kafka lag but the output always giving zero using python paramiko ssh module, while manually same command giving the correct result.</p>
<pre><code> # check list of consumers
stdin, stdout, stderr = ssh.exec_command("/home/prduser... | <python><python-3.x> | 2022-12-16 05:23:19 | 1 | 381 | Ashok Developer |
74,820,202 | 2,525,940 | Need PyQt QGroupBox to resize to match contained QTreeWidget | <p>I have a QTreeWidget inside a QGroupBox. If the branches on the tree expand or collapse the QGroupBox should resize rather than show scrollbars.
The QGroupBox is in a window with no layout manager as in the full application the user has the ability to drag and resize the GroupBox around the window.</p>
<p>The code ... | <python><pyqt5> | 2022-12-16 04:29:50 | 1 | 499 | elfnor |
74,820,040 | 11,229,812 | How to show webcam within tkinter canvas? | <p>I have Tkinter GUI with a canvas that currently shows the image by default and there is a switch that will print Cam On and Cam off when switched back and forth.
What I'm trying to do is to get my webcam to stream instead of that image when I flit the switch on.</p>
<p>Here is the code I have for my GUI:</p>
<pre><c... | <python><python-3.x><tkinter> | 2022-12-16 04:00:38 | 1 | 767 | Slavisha84 |
74,819,657 | 504,717 | Upgrade python3.8 to 3.10 in Ubuntu Docker image | <p>I am using playwright base image</p>
<pre><code>FROM mcr.microsoft.com/playwright
</code></pre>
<p>Unfortunately, this comes with python3.8. I could either use python3.10 image and install playright on it, but it came with other complexities, so i chose to upgrade python on playright image to 3.10.</p>
<p>So far, my... | <python><docker><python-3.8><ubuntu-20.04><python-3.10> | 2022-12-16 02:43:19 | 3 | 8,834 | Em Ae |
74,819,610 | 943,222 | linear programing: find max number of shares of stock to purchase given a budget | <p>The problem I am working on is this: say i have 10k, and I want to buy 3 stocks: AMZN, CBOE, CDW. and my goal is the calculate the max number of shares I can purchase and stay within 10k.</p>
<p><code>X*amzn_price+Y*cboe_price+Z*cdw_price <= 10000</code></p>
<p>I did the below code based on this <a href="https://... | <python><linear-programming> | 2022-12-16 02:33:07 | 1 | 816 | D.Zou |
74,819,469 | 1,608,765 | Sunpy old version? module 'sunpy.net.vso.attrs' has no attribute 'Time' | <p>I'm trying to run a code to download SDO data with the following script, but it get an attribute error. I am not sure why and can't find this error discussed online.</p>
<p><code>AttributeError: module 'sunpy.net.vso.attrs' has no attribute 'Time'</code></p>
<p>code</p>
<pre><code>from sunpy.net import vso
client = ... | <python> | 2022-12-16 02:01:35 | 1 | 2,723 | Coolcrab |
74,819,062 | 652,779 | Databricks: run python coverage inside databricks jobs | <p>I am using Azure Databricks, running a python script instead of using Notebooks.</p>
<p>Given the way Databricks is implemented, it's hard to test the code in my local machine, so I wanted to create another job which could run coverage for it.</p>
<p>The <a href="https://coverage.readthedocs.io/en/6.5.0/" rel="nofol... | <python><azure-databricks><environment><coverage.py> | 2022-12-16 00:39:14 | 1 | 1,251 | Lomefin |
74,819,034 | 11,897,477 | Why is IndexError thrown when I try to index a numpy ndarray with another array? | <p>I have a 5 dimensional ndarray called <code>self.q_table</code>. I've got a regular array, the length of which is 4. When I try to find out the maximum value in that row like this...</p>
<pre><code>max = np.max(self.q_table[regular_array])
</code></pre>
<p>...I get an IndexError, even though the elements of <code>re... | <python><arrays><numpy><multidimensional-array><numpy-ndarray> | 2022-12-16 00:33:00 | 1 | 562 | OlivΓ©r Raisz |
74,819,005 | 3,831,854 | Using pytest for Hardware in Loop Testing | <p>I would like to use pytest for Hardware in Loop Testing.</p>
<p>Basically, with Python and Pytest hardware functionalities are going to be asserted.</p>
<p>My problem is with the structural implementation of the tests:
I would like every tests to be separate (so they can be tested individually), but also that they c... | <python><testing><automated-tests><pytest><python-asyncio> | 2022-12-16 00:26:28 | 0 | 1,058 | AKJ |
74,818,933 | 10,720,618 | PowerShell setting environment variable to subexpression discards newline | <p>I have a python script:</p>
<pre class="lang-py prettyprint-override"><code># temp.py
print("foo\nbar")
</code></pre>
<p>I can run this in powershell:</p>
<pre><code>> python .\temp.py
foo
bar
</code></pre>
<p>I want to set the environment variable <code>FOO</code> to the output of this python script. H... | <python><windows><powershell><terminal> | 2022-12-16 00:12:42 | 1 | 1,263 | kym |
74,818,864 | 856,804 | Does mypy require __init__ to have -> None annotation | <p>Seeing kind of contradictory results:</p>
<pre class="lang-py prettyprint-override"><code>class A:
def __init__(self, a: int):
pass
</code></pre>
<p>The snippet above passes a <code>mypy</code> test, but the one below doesn't.</p>
<pre class="lang-py prettyprint-override"><code>class A:
def __init__(... | <python><mypy><python-typing> | 2022-12-16 00:01:29 | 1 | 9,110 | zyxue |
74,818,863 | 4,062,526 | Deeper Explanation to `Cannot initialize multiple indices of a constraint with a single expression` in Python's Pyomo | <p>Running into a <code>Cannot initialize multiple indices of a constraint with a single expression</code> error when trying to create the below constraint in Pyomo, I have read other tangential answers but unsure of how to translate the learnings here. I believe the issue is that some of the variables are indexed by t... | <python><optimization><pyomo> | 2022-12-16 00:00:41 | 2 | 363 | Adam |
74,818,858 | 7,317,408 | Python: how to randomise drop_duplicates using datetime? | <p>Excuse my lack of understanding - I am very new to Python programming.</p>
<p>Imagine I have the following code:</p>
<pre><code>df_filtered.drop_duplicates(subset=['date'], keep='first', inplace=True)
</code></pre>
<p>How can I randomise the dropping of the duplicates, instead of choosing always the first? Something... | <python><pandas><numpy> | 2022-12-15 23:59:49 | 2 | 3,436 | a7dc |
74,818,834 | 7,084,115 | How to install azure-cli on python docker image | <p>I am trying to install <code>azure-cli</code> in a <code>python</code> docker container but I get the following error:</p>
<blockquote>
<p>[5/5] RUN pip3 install azure-cli:<br />
#9 1.754 Collecting azure-cli<br />
#9 1.956 Downloading azure_cli-2.43.0-py3-none-any.whl (4.3 MB)<br />
#9 7.885 ββββββββββββββββ... | <python><azure><docker><azure-cli> | 2022-12-15 23:56:00 | 2 | 4,101 | Jananath Banuka |
74,818,831 | 10,470,463 | pdfplumber extract table data works when the table has borders, doesn't work when the table has no borders | <p>Using reportlab I made 2 1 page pdfs with 1 table:</p>
<p>The data in the table is this:</p>
<pre><code>data1 = [['00', '', '02', '', '04'],
['', '11', '', '13', ''],
['20', '', '22', '23', '24'],
['30', '31', '32', '', '34']]
</code></pre>
<p>The point is, to get the rows including the empty cells. If the t... | <python><pdfplumber> | 2022-12-15 23:55:02 | 1 | 511 | Pedroski |
74,818,677 | 8,047,904 | problem to install pyproject.toml dependencies with pip | <p>I have an old project created with poetry. The <strong>pyproject.toml</strong> create by poetry is the following:</p>
<pre><code>[tool.poetry]
name = "Dota2Learning"
version = "0.3.0"
description = "Statistics and Machine Learning for your Dota2 Games."
license = "MIT"
readme ... | <python><pip><python-packaging><python-poetry><pyproject.toml> | 2022-12-15 23:29:24 | 1 | 331 | drigols |
74,818,647 | 3,431,407 | Python Google Drive API not creating csv with list of all files within sub-folders | <p>I am trying to get a list of files with names, dates, etc into a <code>csv</code> file from files on my Google Drive folder which has around 15k sub-folders (one level below) within the main folder that have about 1-10 files each that amount to around 65k files in total.</p>
<p>I used the following code in Python to... | <python><google-drive-api> | 2022-12-15 23:24:47 | 0 | 661 | Funkeh-Monkeh |
74,818,563 | 3,507,584 | Django and pgAdmin not aligned | <p>I was trying to change the order of the table columns in a postgreSQL table. As I am just starting, it seemed easier to <code>manage.py flush</code> and create a new DB with new name and apply migrations.</p>
<p>I can see the new DB in pgAdmin received all the Django models migrations except my app model/table. I de... | <python><django><postgresql><django-migrations> | 2022-12-15 23:12:28 | 2 | 3,689 | User981636 |
74,818,410 | 7,914,054 | How to inverse transform a 3rd order difference? | <p>I'm trying to create a function that will do the inverse difference for 3rd order difference of a forecasted result. Currently, I have a function that will provide the inverse transform of the 2nd difference. Is there a way for me to edit this function to do the 3rd order difference?</p>
<pre><code>def invert_transf... | <python><time-series> | 2022-12-15 22:50:00 | 0 | 789 | QMan5 |
74,818,335 | 3,723,031 | Unstack dataframe column | <p>I have this dataframe:</p>
<pre><code>df = pd.DataFrame()
df["A"] = [2,2,4,4,4,8,9]
df["B"] = [2,2,4,4,4,7,9]
df["C"] = list("axcdxef")
print(df.to_string(index=False))
A B C
2 2 a
2 2 x
4 4 c
4 4 d
4 4 x
8 7 e
9 9 f
</code></pre>
<p>I want to convert ... | <python><pandas> | 2022-12-15 22:40:45 | 1 | 1,322 | Steve |
74,818,327 | 5,599,108 | Match files starting with a number and underscore using glob | <p>Initially I tried</p>
<pre><code>folder_path.glob('[0-9]_*.json')
</code></pre>
<p>Where folder_path is a pathlib.Path object. But it only works for files that start with a single digit.</p>
<p>after failing to find a proper match pattern, I used an additional condition to verify that what precedes the underscore is... | <python><pathlib> | 2022-12-15 22:39:23 | 2 | 415 | Cristian |
74,818,311 | 9,394,364 | Parsing text and JSON from a log file and keeping them together | <p>I have a .log file containing both text strings and json. For example:</p>
<pre><code>A whole bunch of irrelevant text
2022-12-15 12:45:06, run: 1, user: james json:
[{"value": "30", "error": "8"}]
2022-12-15 12:47:36, run: 2, user: kelly json:
[{"value": "15&qu... | <python><json> | 2022-12-15 22:36:58 | 3 | 1,651 | DJC |
74,818,221 | 8,537,770 | API gateway LambdaRestApi custom domain gets ECONNREFUSED Error upon requests | <p>I've looked at some other posts, but <a href="https://stackoverflow.com/questions/48306053/api-gateway-regional-custom-domain-is-not-working">this one</a> is the closest question I could find that might be close to what I'm experiencing. I'm just not that clear on it from what was stated in the answer.</p>
<p>I'm cr... | <python><certificate><aws-cdk><amazon-route53><api-gateway> | 2022-12-15 22:24:23 | 1 | 663 | A Simple Programmer |
74,818,180 | 1,569,221 | Module not found when trying to run `black` in a Jupyter notebook | <p>I've created a Jupyter notebook inside of a virtual environment.</p>
<p>These packages are installed:</p>
<pre><code>black==22.12.0
jupyter~= 1.0.0
jupyter-black==0.3.3
jupyter-contrib-nbextensions~=0.5.1
</code></pre>
<p>In my notebook, there's a button with a little gavel to run <code>black</code> code formatting.... | <python><jupyter-notebook><code-formatting><black-code-formatter> | 2022-12-15 22:19:14 | 1 | 2,393 | canary_in_the_data_mine |
74,818,054 | 5,750,741 | ModuleNotFoundError: No module named 'google' | <p>I am new to PyCharm (coming from RStudio world). I am just trying to setup a PyCharm project. My first line of code is <code>google</code> library import (Later I intend to write codes for pulling data from BigQuery).</p>
<p>But I am getting an error saying <code>ModuleNotFoundError: No module named 'google'</code> ... | <python><pycharm><ide> | 2022-12-15 22:01:49 | 1 | 1,459 | Piyush |
74,818,047 | 5,212,614 | Is there a best practice for dropping dupes from a dataframe with many, many columns? | <p>I am merging two dataframes with quite a few columns and the IDs are repeating in one dataframe, so I'm getting a lot of dupes in the merged dataframe. I'm wondering if there is a best way to figure out which columns are actual dupes and leverage that logic to drop dupes.</p>
<p>I'm doing this...</p>
<pre><code>df_f... | <python><python-3.x><pandas> | 2022-12-15 22:00:32 | 0 | 20,492 | ASH |
74,817,976 | 1,594,557 | Alternative for scipy.stats.norm.ppf? | <p>Does anyone know of an alternative Python implementation for scipy.stats.norm.ppf()? I am building an EXE and I would like to avoid adding scipy for this one function.</p>
<p>There is a great alternative for scipy.stats.norm.pdf() here: <a href="https://stackoverflow.com/questions/8669235/alternative-for-scipy-stats... | <python><scipy> | 2022-12-15 21:51:47 | 1 | 1,464 | leenremm |
74,817,975 | 7,267,480 | How to save a list in a dataframe cell? | <p>I need to store a list in a dataframe cell.</p>
<p>How can I save the list into one column? and how can it be read and parsed from this cell?</p>
<p>I have tried this code to generate temporary dataframe in cycle:</p>
<pre><code>newlist = [1267, 1296, 1311, 1320, 1413, 1450]
temp = pd.DataFrame(
{
'wi... | <python><list><dataframe> | 2022-12-15 21:51:45 | 2 | 496 | twistfire |
74,817,922 | 1,551,027 | Is there a way to create a new branch on a Google Cloud Source Repositories repo using the Python SDK? | <p>I am using Google Cloud Source Repositories to store code for my CI/CD pipeline. What I'm building has two repos: <code>core</code> and <code>clients</code>. The <code>core</code> code will be built and deployed to monitor changes to a cloud storage bucket. When it detects a new customer config in the bucket, it wil... | <python><google-cloud-platform> | 2022-12-15 21:46:18 | 1 | 3,373 | Dshiz |
74,817,641 | 8,305,252 | OpenAI Whisper Cannot Import Numpy | <p>I am trying to run the OpenAI Whisper model but running into the following error when trying to run my script:</p>
<blockquote>
<p>ValueError: Unable to compare versions for numpy>=1.17: need=1.17 found=None. This is unusual. Consider reinstalling numpy.</p>
</blockquote>
<p>I have, as the error suggests, tried r... | <python><numpy><openai-whisper> | 2022-12-15 21:14:18 | 2 | 686 | Digglit |
74,817,441 | 3,247,006 | How to remove a useless "UPDATE" query when overriding "response_change()" in Django Admin? | <p>In <code>FruitAdmin():</code>, I overrode <a href="https://docs.djangoproject.com/en/4.1/ref/contrib/admin/#django.contrib.admin.ModelAdmin.response_change" rel="nofollow noreferrer"><strong>response_change()</strong></a> with the code to capitalize the name which a user inputs on <strong>Change fruit</strong> as sh... | <python><python-3.x><django><sql-update><django-admin> | 2022-12-15 20:53:19 | 1 | 42,516 | Super Kai - Kazuya Ito |
74,817,250 | 1,014,747 | How can I dynamically refer to a child class from the super class in Python? | <p>Consider this situation:</p>
<pre class="lang-py prettyprint-override"><code>class Foo(ABC):
@abstractmethod
def some_method(self):
return
class Bar(Foo):
def some_method(self, param):
# do stuff
return
class Baz(Foo):
def some_method(self, param):
# do stuff differe... | <python><inheritance><abstract-class><pylance> | 2022-12-15 20:33:35 | 0 | 603 | b0neval |
74,817,203 | 7,158,458 | Case insensitive filtering multiple columns in pandas using .loc | <p>I would like to search for values ignoring differences in cases. So for example if I type in 'fred' I would still be able to filter for all values containing Fred, even if the F is capitalized.</p>
<p>This is what I currently have:</p>
<pre><code>def find(**kwargs):
result = data.loc[data.rename(columns={"F... | <python><pandas> | 2022-12-15 20:28:33 | 3 | 2,515 | Emm |
74,817,183 | 10,924,836 | Implement specific function in Python | <p>I am trying to implement my own function. Below you can see my code and data</p>
<pre><code>import pandas as pd
import numpy as np
data = {'type_sale':[100,0,24,0,0,20,0,0,0,0],
'salary':[0,0,24,80,20,20,60,20,20,20],
}
df1 = pd.DataFrame(data, columns = ['type_sale',
... | <python><pandas> | 2022-12-15 20:25:58 | 2 | 2,538 | silent_hunter |
74,817,155 | 163,567 | Why is the argument getting passed in to this python method treated this way? | <p>version: Python 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0]</p>
<p>Setup:</p>
<pre><code>class _Mixin:
def vars_to_dct(self, results=[]):
dct = self.to_dict()
for k in dct.keys():
results.append(k)
return results
@dataclass
class ClassA(_Mixin):
a: str = "&quo... | <python> | 2022-12-15 20:23:33 | 0 | 4,347 | Williams |
74,817,147 | 17,277,677 | read pyspark json files and concat | <p>I have 999 gz files located in s3 bucket. I wanted to read them all and convert pyspark dataframe into pandas dataframe, it was impossible due to large files. I am trying to take a different approach - reading each single /gz file THEN convert it to pandas df - reduce number of columns and then concatenate it into o... | <python><pandas><dataframe><pyspark> | 2022-12-15 20:22:42 | 2 | 313 | Kas |
74,817,120 | 2,119,878 | Convert object to int (Pandas Dataframe) | <p>I have seen this question asked several times, but I haven't found an answer that solves my problem yet. I have a CSV file that reads in the values as objects and I haven't found a way to convert a column to an int (column may contain None values). This is what I have tried:</p>
<pre><code>df = pd.read_csv("w... | <python><pandas><dataframe> | 2022-12-15 20:19:52 | 1 | 591 | cicit |
74,816,826 | 7,158,458 | Conditionally filter on multiple columns or else return entire dataframe | <p>I have a csv with a few people. I would like to build a function that will either filter based on all parameters given or return the entire dataframe as it is if no arguments are passed.</p>
<p>So given this as the csv:</p>
<pre><code>FirstName LastName City
Matt Fred Austin
Jim Jack ... | <python><pandas> | 2022-12-15 19:50:23 | 2 | 2,515 | Emm |
74,816,808 | 18,948,596 | Row-based or column-based convention for storing data in multi-arrays? | <p>Suppose we have <code>m</code> vectors in <code>R^n</code> (or <code>R^(n,1)</code>) with <code>m >> n</code>.</p>
<p>We want to transform these by a linear transformation (applying a Matrix <code>A^(k, n)</code>) and by a translation given by a vector <code>b</code> in <code>R^n</code>. This is obviously fast... | <python><numpy><multidimensional-array> | 2022-12-15 19:47:53 | 0 | 413 | Racid |
74,816,667 | 9,274,940 | pythonic way to drop columns where length of list in column is x | <p>I would like drop the rows where a certain column has a list of length X. What is the most pythonic or efficient way? Instead of looping...</p>
<p>Code example:</p>
<pre><code>import pandas as pd
data = {'column_1': ['1', '2', '3'] ,
'column_2': [['A','B'], ['A','B','C'], ['A']],
"column_3": ['a'... | <python><pandas> | 2022-12-15 19:33:57 | 2 | 551 | Tonino Fernandez |
74,816,653 | 1,424,739 | How Explicit Wait is implemented under selenium? | <p><a href="https://www.testim.io/blog/how-to-wait-for-a-page-to-load-in-selenium/" rel="nofollow noreferrer">https://www.testim.io/blog/how-to-wait-for-a-page-to-load-in-selenium/</a></p>
<p>I want to understand how "Explicit Wait" is implemented under selenium. Can you show some example python code to demon... | <python><selenium><selenium-webdriver> | 2022-12-15 19:32:47 | 1 | 14,083 | user1424739 |
74,816,570 | 5,446,972 | Are class variables accessed via self used as loop variables good practice/pythonic? | <p>Is it appropriate to use a class variable accessed with <code>self</code> as a loop variable (aka <a href="https://en.wikipedia.org/wiki/For_loop" rel="nofollow noreferrer">loop counter</a>, <a href="https://docs.python.org/3/reference/compound_stmts.html#the-for-statement" rel="nofollow noreferrer">target_list</a>,... | <python><loops><self><python-class> | 2022-12-15 19:25:01 | 0 | 490 | WesH |
74,816,532 | 3,107,858 | Recursively copy a child directory to the parent in Google Cloud Storage | <p>I need to recursively move the contents of a sub-folder to a parent folder in google cloud storage. This code works for moving a single file from sub-folder to the parent.</p>
<pre><code>client = storage.Client()
bucket = client.get_bucket(BUCKET_NAME)
source_path = Path(parent_dir, sub_folder, filename).as_posix(... | <python><gsutil><google-cloud-storage> | 2022-12-15 19:20:58 | 1 | 3,230 | DanGoodrick |
74,816,407 | 1,045,755 | Plotly graph object laggy when plotting many additional add_trace | <p>I am trying to create a map, where I need to draw a line between several nodes/points. There is approximately 2000 node pairs that need a line drawn between them.</p>
<p>I have a data frame containing the longitude/latitude coords for each node pair (i.e. <code>col1</code> and <code>col2</code>), and then I plot it ... | <python><plotly> | 2022-12-15 19:07:47 | 1 | 2,615 | Denver Dang |
74,816,379 | 2,893,712 | xlsxwriter Conditional Format based on Formula not working | <p>I want to format an entire row if the value in column A starts with specific words.</p>
<p>This code checks if cell A# equals 'Totals' and formats the entire row:</p>
<pre><code>testformat = wb.add_format({'bg_color': '#D9D9D9', 'font_color': 'red'})
worksheet.conditional_format(0,0,10, 10, {"type": "... | <python><conditional-formatting><xlsxwriter> | 2022-12-15 19:03:58 | 1 | 8,806 | Bijan |
74,816,261 | 11,885,361 | How can I recreate Ruby's sort_by {rand} in python? | <p>I have a line of code where can sort an array into random order:</p>
<p><code>someArray.sort_by {rand}</code></p>
<p>so in python, how can I convert to it to python code?</p>
| <python> | 2022-12-15 18:53:55 | 2 | 630 | hanan |
74,816,248 | 10,791,217 | Regex Replace Not Replacing String on Dataframe | <p>I have the following line of code to update the contents of certain cells:</p>
<pre><code>cmb['Skill'] = cmb['Skill'].replace(({'Application Programming Interface (API)': 'APIs'}), regex=True)
</code></pre>
<p>I have no idea why this won't work.... I've tried the following as well with no luck:</p>
<pre><code>cmb['S... | <python><python-3.x><pandas> | 2022-12-15 18:52:32 | 1 | 720 | RCarmody |
74,816,181 | 11,850,322 | Panel Data - dealing with missing year when creating lead and lag variables | <p>I work with panel data. Typically my panel data is not balanced, i.e., there are some missing years. The general look of panel data is as follows:</p>
<pre><code>df = pd.DataFrame({'name': ['a']*4+['b']*3+['c']*4,
'year':[2001,2002,2004,2005]+[2000,2002,2003]+[2001,2002,2003,2005],
... | <python><python-3.x><pandas><dataframe><group-by> | 2022-12-15 18:46:35 | 2 | 1,093 | PTQuoc |
74,815,957 | 8,829,403 | Get list of files in directory return encode error for persian files name | <p>When I want to execute simple line of code to get a list of files in one drive i have encountered with encoding error
I have a list of files with persian name. when it comes to list these files name raised an encoding error!</p>
<pre><code>import os
print(os.listdir('D:'))
Traceback (most recent call last):
Fil... | <python><codec><listdir><cp1252><charmap> | 2022-12-15 18:23:48 | 3 | 373 | Spring98 |
74,815,871 | 5,431,283 | Tkinter - How do I populate a combo box with a list? | <p>I'm actually using Custom Tkinter but I think it should be the same.</p>
<p>I would like to populate a ComboBox after clicking on a button. My button calls a function, which returns a list. I would like to populate the Combobox with each item in that list but I can't seem to get the hang of it.</p>
<p>Here is a snip... | <python><tkinter> | 2022-12-15 18:15:19 | 1 | 673 | Daniel |
74,815,812 | 6,524,326 | Incorrect results of modulo operation between large numbers in R | <p>To solve a puzzle from <a href="https://www.hackerrank.com/challenges/summing-the-n-series/problem?isFullScreen=true" rel="nofollow noreferrer">hackerrank</a>, I'm trying to apply modulo operations between large numbers in R (v4.2.2). However, I get incorrect results when at least one of the operands is very large. ... | <python><r><python-3.x> | 2022-12-15 18:08:32 | 1 | 828 | Wasim Aftab |
74,815,728 | 6,346,514 | Pandas, read Length only of all pickle files in directory | <p>I read a bunch of pickle files with the below code, I want to loop through and get each of these, identify the length of each file. Ie how many records.</p>
<p>Two issues:</p>
<ol>
<li>Concat will combine all my dfs into one, which takes a long time. Anyone to just read the len?</li>
<li>If Concat is the way to go, ... | <python><pandas> | 2022-12-15 17:59:50 | 2 | 577 | Jonnyboi |
74,815,705 | 10,544,599 | How to decode text with special symbols using base64 in python3? | <p>I am trying to decode some list of texts using base64 module. Though I'm able to decode some, but probably the ones which have special symbols included in it I am unable to decode that.</p>
<pre><code>import base64
# List of string which we are trying to decode
encoded_text_list = ['MTA0MDI0','MTA0MDYw','MTA0MDgz',... | <python><python-3.x><encryption><encoding><base64> | 2022-12-15 17:57:31 | 3 | 379 | David |
74,815,632 | 4,321,462 | Do not convert tabs to spaces when printing in CPython console | <h4>Problem</h4>
<p>The statement</p>
<pre class="lang-py prettyprint-override"><code>print(".\t.")
</code></pre>
<p>returns the string <code>. .</code> in the CPython console (the tab is replaced by 7 spaces). How can I preserve the tab character?</p>
<p>Copying all output from the console to notepad+... | <python><powershell><printing><tabs><console> | 2022-12-15 17:49:58 | 1 | 2,740 | Samufi |
74,815,510 | 5,120,817 | Calling OneHotEncoding results into Java Heap Space Error | <p>When running <code>xGboost</code> Package in <code>H2o</code> throws Java heap space error. But when the memory is cleared manually it works fine.</p>
<p>I often use
del df
del something
import gc
gc.collect()</p>
<p>in order to clear memory. Any ideas are appreciated.</p>
<pre><code>import h2o
from h2o.tree import ... | <python><java><xgboost><h2o> | 2022-12-15 17:38:05 | 1 | 975 | lpt |
74,815,359 | 2,011,779 | use a variable multiple times in a sql statement with pymysql | <p>[edit: removed the where statement]</p>
<p>I'm trying to update a table when duplicate keys are passed in
I have a list like</p>
<pre><code>examplelist = [[key1, value1], [key2, value2], [key3, value3]]
</code></pre>
<p>and a table with, for example, <code>key1</code> and <code>key3</code> already in the table with ... | <python><mysql><sql><pymysql> | 2022-12-15 17:24:45 | 1 | 2,384 | hedgedandlevered |
74,815,356 | 1,595,350 | What is the correct way of creating a list of 2-pairs and search for on element of it? | <p>Lets assume that we have a list of elements which looks like this</p>
<pre><code>identifier, url
cars, /cars/1234
motorcycles, /motorcycles/jd723
yachts, /yachts/324lkaj
trucks, /trucks/djfhe
</code></pre>
<p>The idea behind this, that i have a static list of items, which will nearly not change. I could put them int... | <python> | 2022-12-15 17:24:24 | 1 | 4,326 | STORM |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.