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,779,065 | 12,735,064 | OR-Tools CP-Sat: Efficiently optimize toward an average value | <p>I'm new to OR-Tools and CP-Sat I'm looking for guidance on how to most efficiently optimize sums of variables toward a common average value. Here's a very simplified example to help explain:</p>
<pre class="lang-py prettyprint-override"><code>from ortools.sat.python import cp_model
from random import randint
model ... | <python><or-tools><cp-sat> | 2022-12-13 01:27:41 | 0 | 1,047 | schwartz721 |
74,778,994 | 315,168 | Pandas open/close resample and rolling over values from the previous day | <p>I have transaction data that I hope to resample in a fashion similar to OHLC stock market prices.</p>
<ul>
<li>The goal is to display a meaningful price summary for each day</li>
</ul>
<p>However, my challenge is that the transactional data is sparse.</p>
<ul>
<li><p>There are days without transactions</p>
</li>
<li... | <python><pandas> | 2022-12-13 01:13:46 | 1 | 84,872 | Mikko Ohtamaa |
74,778,959 | 15,542,245 | Dynamic array not behaving as expected | <p>Replacing words/phrases in larger project. I can do it first time around. But when attempting to build on the changed line I have an issue with the dynamic array <code>listings[]</code>
Summarizing the issue. Here is some basic Python:</p>
<pre><code># concurrentTest.py
import re
subString = [' string1',' string2'... | <python><iteration><dynamic-arrays> | 2022-12-13 01:04:01 | 0 | 903 | Dave |
74,778,901 | 15,412,256 | Are pandas DataFrame methods picklable? | <p>I am developing an algorithm to process a pool of datasets in parallel. I would like to examine wherther the DataFrame methods are pickable.</p>
<p>I wrote the code as the following:</p>
<pre><code>import pickle
import pandas as pd
# Define a custom function that we will use with the apply method
def my_custom_func... | <python><multithreading><parallel-processing><multiprocessing><pickle> | 2022-12-13 00:54:43 | 0 | 649 | Kevin Li |
74,778,842 | 18,308,393 | Create a unique id from each id in a list of dictionaries | <p>I have a list of dictionaries with the key named <code>id</code>, however, some of these are duplicates. This is a sample of my dataset, my actual dicts have multiple keys but I'm filtering my <code>id</code>. Essentially, I do not want to remove the ids, instead I want to create a new id value by incrementing a num... | <python> | 2022-12-13 00:43:57 | 1 | 367 | Dollar Tune-bill |
74,778,827 | 7,389,168 | Adding error bar to scatter plot, existing examples don't work | <p>Hello I am trying to add an error bar to the following scatter plot:</p>
<pre class="lang-py prettyprint-override"><code>(x, y) = self.rig_parameters["image_size"]
disparity_image = np.array(image)
locations = np.where(disparity_image > error_bound)
values = disparity_image[locations]
... | <python><matplotlib><scatter-plot> | 2022-12-13 00:41:53 | 1 | 601 | FourierFlux |
74,778,825 | 833,960 | How can I have code coverage gutters in Visual Studio Code, but also have working breakpoints? | <p>I have code coverage working for my Python code in VSCode. However, I can't set or remove breakpoints if the gutters are displayed. This is apparently a <a href="https://github.com/ryanluker/vscode-coverage-gutters#tips-and-tricks" rel="nofollow noreferrer">known issue</a>:</p>
<blockquote>
<p>to both use the extens... | <python><unit-testing><pytest><code-coverage> | 2022-12-13 00:41:49 | 0 | 6,525 | MattG |
74,778,812 | 12,361,700 | Use Keras optimizer on TF tensor | <p>I mean, I get that he needs an ID to keep track of what he needs, like the last gradient for that variable and so on, but can't we just have an optimizer for a specific tensor?</p>
<pre><code>a = tf.convert_to_tensor([1.])
with tf.GradientTape() as tape:
tape.watch(a)
loss = a**2
grad = tape.gradient(loss, ... | <python><tensorflow><keras> | 2022-12-13 00:39:14 | 1 | 13,109 | Alberto |
74,778,755 | 7,903,749 | Django ORM, how to "rebase" a QuerySet to a related model | <p>With a database model described in the simplified toy example below, we are trying to get a list of EAV attributes used for a specific <code>Product</code>.</p>
<p>The sample source code in the <strong>Actions</strong> section below serves the purpose; however, we feel the statement is overly verbose: We only need c... | <python><django> | 2022-12-13 00:28:05 | 2 | 2,243 | James |
74,778,742 | 2,975,438 | Convert function with for/while loop into Pandas dataframe.apply(lambda ...: ...) method if there is a change in each iteration | <p>I am looking for a way to convert structure:</p>
<pre><code>for ... in dataframe:
while ...:
if ...:
do smth
if ...:
do smth
</code></pre>
<p>to</p>
<pre><code>dataframe.apply(lambda ...: ...)
</code></pre>
<p>Here is example of function with for/while loop:</p>
<pre><code>d_test = {
'... | <python><pandas><dataframe><vectorization> | 2022-12-13 00:25:44 | 0 | 1,298 | illuminato |
74,778,698 | 1,896,222 | AttributeError: 'DefaultAzureCredential' object has no attribute 'signed_session' | <p>I'm using python sdk to query application insights using <code>azure-applicationinsights==0.1.1</code>.
Here is my code:</p>
<pre class="lang-py prettyprint-override"><code>from azure.identity import DefaultAzureCredential
from azure.applicationinsights import ApplicationInsightsDataClient
from azure.applicationinsi... | <python><azure><sdk> | 2022-12-13 00:15:48 | 1 | 10,564 | max |
74,778,611 | 13,176,896 | why not called function (forward) is called in pytorch class? | <p>I have the following simple example code for linear regression as follows.import torch</p>
<pre><code>import numpy as np
from torch.autograd import Variable
class linearRegression(torch.nn.Module):
def __init__(self, inputSize, outputSize):
super(linearRegression, self).__init__()
self.linear = t... | <python><class><pytorch> | 2022-12-13 00:00:10 | 1 | 2,642 | Gilseung Ahn |
74,778,347 | 554,521 | pytest+celery: Test hangs | <p>I have a super simple celery task. During development, my broker for celery and pytest is sharing the same AWS SQS, and DynamoDB for results. My task was successful via CLI.</p>
<p>However, when running within pytest, my test would hang forever. When I force stop the test, it tells me it was stuck on the 'wait_for' ... | <python><pytest><celery> | 2022-12-12 23:17:52 | 0 | 651 | Ken |
74,778,324 | 10,181,236 | count how many times a record appears in a pandas dataframe and create a new feature with this counter | <p>I have this two dataframes dt_t and dt_u. I want to be able to count how many times a record in the text feature appears and I want to create a new feature in df_u where I associate to each id the counter. So id_u = 1 and id_u = 2 both will have counter = 3 since hello appears 3 times in df_t and both published a po... | <python><pandas> | 2022-12-12 23:15:10 | 1 | 512 | JayJona |
74,778,254 | 2,262,424 | Logging to the very same mlflow run across multiple scripts | <p>I have separate preprocessing and training Python scripts. I would like to track my experiments using <a href="https://www.mlflow.org/docs/latest/python_api/mlflow.html" rel="nofollow noreferrer">mlflow</a>.<br />
Because my scripts are separate, I am using a Powershell script (think of it as a shell script, but on ... | <python><mlflow> | 2022-12-12 23:02:45 | 0 | 766 | gevra |
74,778,173 | 6,630,397 | Finding the best plane which includes a maximum number of points in a given set of 3D points | <p>I have a set of N 3D points (these are the vertices of a closed line). Most of them are part of the same plane, whereas a few are lightly shifted. I need to figure out the plane which naturally already includes the maximum number of points, and to project the remaining points (i.e. the shifted ones) onto it.</p>
<p>... | <python><numpy><precision><mathematical-optimization><plane> | 2022-12-12 22:48:42 | 1 | 8,371 | swiss_knight |
74,778,014 | 6,651,938 | Hard to understand return_value for Python Mock Class in the following example | <p>I had a hard time understanding the choice of using <code>return_value</code>. See the following example</p>
<pre><code># my_module.py
def query(connection):
cursor = connection.cursor()
cursor.execute("SELECT name FROM users WHERE id = 1")
return cursor.fetchone()[0]
</code></pre>
<pre><code>... | <python><python-3.x><unit-testing><mocking> | 2022-12-12 22:26:13 | 1 | 1,146 | Bratt Swan |
74,778,010 | 15,724,084 | cannot convert my code to oop style in python | <p>I have done leetcode question in procedural way. I do not if it is proper ask the same question from this platform. But I am looking for OOP podcasts, and needed some practice. Occasionally, leetcode gave me opportunity- I can solve question by top to down procedural way writing code, but leetcode needs OOP version... | <python><oop> | 2022-12-12 22:25:26 | 1 | 741 | xlmaster |
74,778,003 | 1,761,521 | Flask-smorest returning an empty json string | <p>The JSON response of my endpoint returns <code>{}</code> even though I am logging the correct data.</p>
<pre><code>from flask_smorest import Blueprint
bp = Blueprint("auth", __name__, url_prefix="/api/v1/auth/")
@bp.route("/login", methods=["POST"])
@bp.arguments(LoginReque... | <python><flask><marshmallow><flask-marshmallow><flask-smorest> | 2022-12-12 22:24:01 | 1 | 3,145 | spitfiredd |
74,778,002 | 12,671,140 | Hold reference to Numpy array inside C++ object | <p>I want to create C++ wrapper for Numpy array. For that purpose I need to hold reference to Numpy array (for returning it to Python later) and reference to raw data of that array.</p>
<p>For that I've wrote the code:</p>
<p><strong>C++</strong></p>
<pre class="lang-cpp prettyprint-override"><code>// mynumpy.h
#inclu... | <python><boost-python> | 2022-12-12 22:23:57 | 0 | 565 | kacpo1 |
74,777,945 | 13,881,506 | `eval('bar')` causes a `NameError`, but `print(bar); eval('bar')` doesn't | <p>The following code</p>
<pre><code>1 def foo():
2 def bar():
3 return 'blah'
4 def baz():
5 eval('bar')
6 baz()
7 foo()
</code></pre>
<p>causes a <code>NameError</code> -- the entire error message is</p>
<pre><code>Traceback (most recent call last):
File "main.py", line 7, in &... | <python><scope><local-variables><nameerror> | 2022-12-12 22:17:18 | 1 | 1,013 | joseville |
74,777,831 | 5,942,100 | Tricky conversion based on specific conditions within Pandas | <p>I have a dataframe when where the date matches the date of a specific column, I wish to convert all 0's to blanks per area category for specific columns.</p>
<h2>Data</h2>
<pre><code>date start end area stat1 stat2 stat3 final
10/1/2021 11/1/2021 12/1/2021 NY 5 0 ... | <python><pandas><numpy> | 2022-12-12 22:01:40 | 1 | 4,428 | Lynn |
74,777,830 | 3,755,036 | how can I import all python classes in a folder? | <p>This is the current structure of my project.</p>
<pre><code> cities
newyork.py
london.py
berlin.py
main.py
requirements.txt
</code></pre>
<p>Each of the city files contains a class. For instance <code>Class Newyork:</code> is defined in <code>newyork.py</code></p>
<p>In my <code>main.py<... | <python><python-3.x><pip> | 2022-12-12 22:01:34 | 1 | 818 | chickenman |
74,777,822 | 10,959,670 | Pandas rolling averages for dates after group by | <pre class="lang-py prettyprint-override"><code>df = pd.DataFrame(
{"date": [pd.Timestamp("2022-01-01"), pd.Timestamp("2022-01-01"), pd.Timestamp("2022-01-01"), pd.Timestamp("2022-01-03"), pd.Timestamp("2022-01-03"), pd.Timestamp("2022-01-03"), p... | <python><pandas><group-by> | 2022-12-12 22:00:58 | 2 | 331 | Ben Muller |
74,777,772 | 7,267,480 | Generating a new, more dense grids using existing and scale | <p>I use Python for fitting various experimental data.</p>
<p>The data I have is stored in NumPy arrays, e.g.</p>
<pre><code>x = np.array([53.821593, 53.85265044, 53.88373501, 53.91484627, 53.94598466, 53.97714997, 54.00834218, 54.03956172, 54.07080797, 54.10208155, 54.13338225, 54.16471028,
54.19606522, 54.2274477])... | <python><numpy><grid> | 2022-12-12 21:56:34 | 0 | 496 | twistfire |
74,777,697 | 2,011,779 | Connecting to websocket with async inside async function | <p>I'm connecting to a websocket in an async function, to update a local mysql db</p>
<p>[edit: although only the coinbase websocket is shown here, it was later identified to be the gemini websocket that had the issue, by hitting the v1 instead of v2 websocket]</p>
<pre><code>async def write_websocket_to_sql(exchange, ... | <python><websocket> | 2022-12-12 21:47:14 | 2 | 2,384 | hedgedandlevered |
74,777,664 | 2,418,347 | regex: getting all matches for group | <p>in python, i'm trying to extract all time-ranges (of the form HHmmss-HHmmss) from a string. i'm using this python code.</p>
<pre><code>text = "random text 0700-1300 random text 1830-2230 random 1231 text"
regex = "(.*(\d{4,10}-\d{4,10}))*.*"
match = re.search(regex, text)
</code></pre>
<p>this on... | <python><regex> | 2022-12-12 21:43:25 | 2 | 335 | 4mla1fn |
74,777,613 | 3,102,471 | Python CSV module returning non string iterator when passed the STDOUT stream containing CSV data | <p>The following program calls <code>subprocess.run()</code> to invoke a program (<code>ffprobe</code>, but that's not important) and return a CSV result in STDOUT. I am getting an error enumerating the CSV result.</p>
<pre><code>import os
import subprocess
import csv
for file in os.listdir("/Temp/Video"):
... | <python><csv> | 2022-12-12 21:37:43 | 1 | 1,150 | mbmast |
74,777,476 | 6,283,073 | how can segmentation fault error be fixed OpenCV python | <p>I am trying to run a simple objection detection on webcam using Yolov5 but I keep getting the error below.</p>
<blockquote>
<blockquote>
<p>zsh: segmentation fault</p>
</blockquote>
</blockquote>
<p>The camera appears to open then shut off immediately and the code exit with the above error.
Here is my code</p>
<pre>... | <python><opencv><pytorch><yolov5> | 2022-12-12 21:23:26 | 2 | 1,679 | e.iluf |
74,777,424 | 405,396 | NotImplementedError when running dbt version check on installing dbt-bigquery | <p>I am trying to install dbt bigquery in my Windows system by running the following pip commands -</p>
<pre><code>pip install dbt-bigquery
</code></pre>
<p>Installation has finished successfully but when I run the dbt --version command here is the error I am getting</p>
<blockquote>
<p>Traceback (most recent call last... | <python><python-3.x><google-bigquery><dbt> | 2022-12-12 21:17:55 | 1 | 1,439 | VKarthik |
74,777,304 | 17,163,556 | Get maximum value of y value within a specified range of x value | <p>I am using Python 3 in jupyter notebook and I data that looks like this:</p>
<pre><code>x = [5100. 5100.05 5100.1 ... 5399.85 5399.9 5399.95] Angstrom
y = [1.83400998 1.26499399 0.85423358 ... 0.78314406 0.76861344 0.77460277]
</code></pre>
<p>Is there a way in Python 3 to grab the maximum y value for x between ... | <python> | 2022-12-12 21:05:08 | 0 | 689 | Dila |
74,777,277 | 5,150,335 | Yielding inside coroutine | <p>I have the following code.</p>
<pre class="lang-py prettyprint-override"><code>def gen():
while True: # line 2
d = yield # line 3
yield d # line 4
x = gen()
next(x)
for i in (3, 4, 5):
print(x.send(i)) # line 10
</code></pre>
<p>When I run this, I get:</p>
<pre><code>3
... | <python><python-3.x><generator> | 2022-12-12 21:03:01 | 1 | 2,157 | mlz7 |
74,777,165 | 1,473,517 | How to only keep the earliest record in a pandas marge | <p>I have two dataframes. Dataframe X has columns:</p>
<pre><code>Index(['studentid', 'Year', 'MCR_NAME', 'QUAL_DETAILS'])
</code></pre>
<p>Dataframe Y has columns:</p>
<pre><code>Index(['studentid', 'total'])
</code></pre>
<p>I want to merge X and Y on 'studentid' using:</p>
<pre><code>Z = X.merge(Y, on="studenti... | <python><pandas> | 2022-12-12 20:51:17 | 1 | 21,513 | Simd |
74,777,128 | 10,620,003 | Build array with size (n*k, m) with n matrix of size (k,m) with an efficient way | <p>I have three array (A,B,C) with size (<code>2,4</code>) and I want to build an array (X) with size (<code>2*3</code>, 4) with them.
I want to build the first row of X from A, the second from B, and the third from C. Then, fourth row from A, 5 from B, 6 from C.</p>
<pre><code>import numpy as np
A = np.array([[0, 2, ... | <python><numpy> | 2022-12-12 20:47:28 | 3 | 730 | Sadcow |
74,776,904 | 9,915,864 | Python tkinter passing object between callbacks | <p>I'm trying to update a label based on a button press that does some calculations first, but I'm getting an error I don't understand.</p>
<p>Background: This method was working fine in previous iterations. I have not changed the code. But I did make some changes to the class by adding a controller to the initial inst... | <python><python-3.x><tkinter> | 2022-12-12 20:23:53 | 1 | 341 | Meghan M. |
74,776,898 | 1,715,544 | Tell PIP to install only the dependencies which can be satisfied | <p>I'm installing a local module that relies on a bunch of local modules written by others. This means that sometimes everyone's versioning is out-of-sync, so running <code>pip -e [package]</code> results in a bunch of errors when it comes to installing the dependencies that are other local modules. For example:</p>
<b... | <python><pip> | 2022-12-12 20:23:05 | 0 | 1,410 | AmagicalFishy |
74,776,886 | 12,468,387 | How to convert pine script stdev to Python code? | <p>I'm trying to convert pine script <a href="https://www.tradingview.com/pine-script-reference/v4/#fun_stdev" rel="nofollow noreferrer">stdev</a> to Python code but it seems I'm doing it wrong.</p>
<p>Pine script:</p>
<pre class="lang-none prettyprint-override"><code>//the same on pine
isZero(val, eps) => abs(val) ... | <python><pine-script><ta-lib> | 2022-12-12 20:22:05 | 2 | 449 | Denzel |
74,776,834 | 15,006,497 | Conditional Statements in Python | <p>having a weird issue with Python that i'm hoping someone can help me out with (syntax related).</p>
<p>I have a selenium web scraper to scrape linked in posts. It has a for loop as follows:</p>
<pre><code>for card in elements:
profileDiv = card.find_element(By.XPATH, ".//div[contains(@class, 'update-compone... | <python><selenium> | 2022-12-12 20:16:55 | 1 | 524 | sylargaf |
74,776,709 | 7,168,098 | Adding a multindex to the columns of a pandas df based on several dictionaries | <p>Assuming I have a DF like:</p>
<pre><code>person_names = ['mike','manu','ana','analia','anomalia','fer']
df = pd.DataFrame(np.random.randn(5, 6), columns = person_names)
df
</code></pre>
<p>I also have two dictionaries, for easy purposes assuming only two:</p>
<pre><code># giving a couple of dictionaries like:
d = {... | <python><pandas><multi-index> | 2022-12-12 20:03:56 | 2 | 3,553 | JFerro |
74,776,533 | 3,963,430 | Amazon SNS service SMS only with requests package | <p>I need to send SMS with Amazon SNS service but I can only use the requests package not boto3.</p>
<p>Here is as far as I came.</p>
<pre><code>import json
import requests
url = "https://sns.eu-central-1.amazonaws.com"
params = {
"Action": "Publish",
"Version": "2... | <python><amazon-sns> | 2022-12-12 19:44:31 | 1 | 838 | Gurkenkönig |
74,776,500 | 12,760,550 | Confirm if duplicated employees are in sequence in pandas dataframe | <p>Imagine I have the following dataframe with repetitive people by firstname and lastname:</p>
<pre><code>ID FirstName LastName Country
1 Paulo Cortez Brasil
2 Paulo Cortez Brasil
3 Paulo Cortez Espanha
1 Maria Lurdes Espanha
1 Maria Lurdes Espanha... | <python><pandas><search><filter><duplicates> | 2022-12-12 19:41:14 | 1 | 619 | Paulo Cortez |
74,776,482 | 5,065,952 | Explode column of objects python pandas dataframe | <p>I am trying to explode a column to create new rows within pandas data frame. What would be the best approach to this?</p>
<p>Input:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>SKU</th>
<th>Quantity</th>
<th>Name</th>
</tr>
</thead>
<tbody>
<tr>
<td>YY-123-671</td>
<td>5</td>
<td>draw... | <python><pandas><dataframe><etl><pandas-explode> | 2022-12-12 19:39:26 | 1 | 827 | Defcon |
74,776,348 | 14,167,846 | Subtracking into from Dates | <p>I have some data that will looks like this:</p>
<pre><code> Dates Delta
0 2022-10-01 10
1 2022-10-01 21
2 2022-10-01 34
</code></pre>
<p>I am trying to add a new column, where I can subtract the number in the <code>Delta</code> column from the date in the <code>Dates</code> column. Ideally, the o... | <python><pandas><datetime> | 2022-12-12 19:27:34 | 3 | 545 | pkpto39 |
74,776,238 | 18,972,785 | Python does not open default web browser to show visualization results in pyvis? | <p>In one part of my code, I need to visualize the generate graph using pyvis library. When i was using python 3.10 everything was ok and the graph was visualized in the default browser, but now due to some reasons i need to use python 3.6.4. In this situation when i generate graph and i want to open it in default brow... | <python><pyvis> | 2022-12-12 19:16:51 | 2 | 505 | Orca |
74,776,202 | 12,760,550 | Identify duplicated rows with different value in another column pandas dataframe | <p>Suppose I have a dataframe of names and countries:</p>
<pre><code>ID FirstName LastName Country
1 Paulo Cortez Brasil
2 Paulo Cortez Brasil
3 Paulo Cortez Espanha
4 Maria Lurdes Espanha
5 Maria Lurdes Espanha
6 John Page USA
7 F... | <python><pandas><duplicates><drop><lines-of-code> | 2022-12-12 19:14:08 | 3 | 619 | Paulo Cortez |
74,776,174 | 12,574,341 | Expressing semantic content of tuple values in type annotations | <p>I'm modeling a financial exchange</p>
<pre class="lang-py prettyprint-override"><code>class Exchange(ABC):
@abstractproperty
def balances(self) -> Dict[str, Tuple[float, float]]:
...
</code></pre>
<p>The semantic content of <code>.balances</code> return type is a <code>dict</code> that is <code>{a... | <python><python-typing><pyright> | 2022-12-12 19:11:01 | 1 | 1,459 | Michael Moreno |
74,775,969 | 984,003 | Left-align image using Python ReportLab with Platypus flowable? | <p>How do I left align an image that I've added to a PDF using reportlab platypus? By default, the image gets centered.</p>
<pre><code>from reportlab.lib.units import cm, inch
from reportlab.lib.pagesizes import LETTER
from reportlab.platypus import SimpleDocTemplate, Paragraph, Image
from reportlab.lib.styles import g... | <python><reportlab><platypus> | 2022-12-12 18:52:30 | 1 | 29,851 | user984003 |
74,775,959 | 7,746,166 | Pycharm Docker remote unittest debugging with invalid volume specification | <p>I have the following problem. I have a project which I want to debug via PyCharm and a docker image via ssh remote connection to some server. For standard debugging it is no problem. It works!</p>
<p>Docker Desktop is installed on windows. PyCharm 2021.3.3 is set up. Windows Linux path conversion is setup in the env... | <python><linux><windows><docker><pycharm> | 2022-12-12 18:51:30 | 1 | 1,491 | Varlor |
74,775,817 | 4,710,409 | Django-is it possible to use template filters inside "with"? | <p>I have a template filter called "get_data_id" that returns a value; I want to use that value as an argument for another filter called "get_data":</p>
<pre><code>{% with variable_v= "x|get_data_id" %}
<p> {{ variable_v|get_data }} </p>
{% endwith %}
</code></pre>
<p>But ... | <python><django><database><django-templates> | 2022-12-12 18:38:14 | 1 | 575 | Mohammed Baashar |
74,775,797 | 14,403,266 | Convert a column of dates of a pandas dataframe to the last date of the respective year | <p>I have a pandas dataframe, lets call it <code>df</code>, looking like this:</p>
<pre><code> Acount Type Id Date Value Per
0 Exp P IQ 2016-03-31 -23421.170324 3M
1 Exp P IQ 2017-03-31 -44803.... | <python><pandas><dataframe><date> | 2022-12-12 18:35:41 | 2 | 337 | Valeria Arango |
74,775,767 | 11,653,374 | Reading a users file within module A from a function within module B in Python | <p>I have the following directory:</p>
<pre><code>└── myproject
├── moduleA
│ ├── __init__.py
│ ├── users.py
├── moduleB
│ ├── __init__.py
│ ├── test_in_B.py
├── test.py
</code></pre>
<p>I can easily run <code>test.py</code> whose content is the following:</p>
<pre><c... | <python><module> | 2022-12-12 18:32:49 | 1 | 728 | Saeed |
74,775,684 | 7,782,597 | ShopifyQL raise error "Field 'shopifyqlQuery' doesn't exist on type 'QueryRoot'" | <p>I am trying to run a ShopifyQL query through Python, but I get the error "Field 'shopifyqlQuery' doesn't exist on type 'QueryRoot'".</p>
<p>The reference used to build the query is found in: <a href="https://shopify.dev/api/shopifyql" rel="nofollow noreferrer">https://shopify.dev/api/shopifyql</a></p>
<p>F... | <python><graphql><shopify> | 2022-12-12 18:25:10 | 1 | 338 | Danilo Steckelberg |
74,775,659 | 2,886,575 | numpy argmin not returning ints on pandas objects | <p>I am trying to take the <a href="https://numpy.org/doc/stable/reference/generated/numpy.argmin.html" rel="nofollow noreferrer"><code>numpy.argmin</code></a> of a <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.html" rel="nofollow noreferrer"><code>pandas Series</code></a>. The nump... | <python><pandas><numpy> | 2022-12-12 18:23:25 | 1 | 5,605 | Him |
74,775,585 | 11,710,304 | How can I get a value based on two other columns when one column value is ambigous in Python? | <p>I want to assign a variable depending on two column values. The input table <code>df_input</code> looks like this:</p>
<pre><code>import pandas as pd
df_input = pd.DataFrame(
{
"entity": [
"Table_A",
"Table_A",
"Table_A",
... | <python><pandas><for-loop><if-statement><reference> | 2022-12-12 18:16:23 | 1 | 437 | Horseman |
74,775,562 | 1,914,781 | plot error bar with plotly express not work | <p>I try to plot error bar with plotly express but it report error:
input element is 3 but it says error_y size is 6:</p>
<pre><code>ValueError: All arguments should have the same length. The length of argument `error_y` is 6, whereas the length of previously-processed arguments ['x', 'y'] is 3
</code></pre>
<p>Code:<... | <python><plotly> | 2022-12-12 18:14:50 | 1 | 9,011 | lucky1928 |
74,775,404 | 2,146,381 | interpolate, derivate and integrate a function -- some math fun | <p>I have a problem. I have three lists. The list_umf are the x values and list list_kf are the y values, while list_kfm are y values, too. kfm is the integral of kf. The values are the output of my code.</p>
<p>To show that kfm is the integral of kf, I want to calculate the derivative of kfm, which shuold be the same... | <python><numpy><scipy> | 2022-12-12 18:00:10 | 1 | 322 | tux007 |
74,775,249 | 11,347,405 | How to plot a histogram of a list of dates? | <p>I have a list of times</p>
<pre><code>times = ['2022-12-09T16:06:34.000000000', '2022-12-09T16:06:34.000000000',
'2022-12-09T16:09:47.000000000', ... , '2022-12-09T17:46:10.000000000',
'2022-12-09T17:46:10.000000000', '2022-12-09T17:46:10.000000000',
'2022-12-09T17:49:10.000000000', '2022-12-09T... | <python><pandas><matplotlib><datetime><time-series> | 2022-12-12 17:47:58 | 1 | 550 | naraghi |
74,775,166 | 1,050,619 | mock a function inside python pyramid view | <p>I have a python pyramid view and want to write a unittest.</p>
<pre><code>def home(request):
state = request.params.get('redirect', None)
cookie = request.headers.get('Cookie')
user = identify_session_user(cookie , request.registry.settings)
response = HTTPFound(location=state)
resp... | <python><pytest><python-unittest><pyramid> | 2022-12-12 17:40:35 | 1 | 20,966 | user1050619 |
74,774,994 | 10,620,003 | Build an array with size (1,n) from an array with size (m, k) with a smarter way | <p>I have a very large array with size (5, n), I want to build an array with size (1,20) from it in each iteration. I have to use a very basic approach to build my new array.
Here is an example:</p>
<pre><code>A = np.array(
[[4, 2, 1, 4, 0, 1, 3, 2, 4, 4],
[4, 2, 0, 3, 1, 1, 4, 2, 2, 1],
[3, 2, 3, 2, 0, 3, 4, 1... | <python><arrays><numpy> | 2022-12-12 17:27:35 | 1 | 730 | Sadcow |
74,774,973 | 16,414,611 | GraphQL API with Scrapy | <p>I'm trying to get data from <a href="https://www.ouedkniss.com/boutiques/immobilier" rel="nofollow noreferrer">https://www.ouedkniss.com/boutiques/immobilier</a> . I found that ouedkniss.com is using GraphQL API. I tried to use this API but failed to pull data and also to paginate. An error is showing. <code>Attribu... | <python><web-scraping><graphql><scrapy> | 2022-12-12 17:25:56 | 2 | 329 | Raisul Islam |
74,774,962 | 6,361,813 | Geometric series: calculate quotient and number of elements from sum and first & last element | <p>Creating evenly spaced numbers on a log scale (a geometric progression) can easily be done for a given base and number of elements if the starting and final values of the sequence are known, e.g., with <code>numpy.logspace</code> and <code>numpy.geomspace</code>. Now assume I want to define the geometric progression... | <python><arrays><algorithm><numpy><math> | 2022-12-12 17:25:21 | 3 | 407 | Pontis |
74,774,627 | 19,079,397 | How to break a current loop and go to the next loop when a condition is meet in python? | <p>I have a data frame like below. Now I want to iterate through unique values of column Name and get the values of column Age when the Age is 10 and when the condition is meet the loop has to break and continue with the next loop. I tried to break it using while loop but it is not working. What is the best way to loop... | <python><pandas><dataframe><for-loop><while-loop> | 2022-12-12 16:57:42 | 2 | 615 | data en |
74,774,599 | 2,829,961 | How to read HDF5 files in R without the memory error? | <h2>Goal</h2>
<p>Read the <code>data</code> component of a hdf5 file in R.</p>
<h2>Problem</h2>
<p>I am using <code>rhdf5</code> to read hdf5 files in R. Out of 75 files, it successfully read 61 files. But it throws an error about memory for the rest of the files. Although, some of these files are shorter than already ... | <python><r><h5py><rhdf5> | 2022-12-12 16:55:53 | 1 | 6,319 | umair durrani |
74,774,369 | 607,407 | Is it possible to wait until multiprocessing.Value changes? | <p>I have a simple bool value to tell subprocess to clean up and gracefully exit:</p>
<pre><code>self.mem_manager = multiprocessing.Manager()
self.exiting = self..mem_manager.Value(ctypes.c_byte, False)
</code></pre>
<p>Now I have a bunch of threads doing the actual work, so right now at the end of my <code>run()</code... | <python><python-3.x><python-multiprocessing><python-multithreading> | 2022-12-12 16:39:11 | 0 | 53,877 | Tomáš Zato |
74,774,282 | 17,176,270 | FastAPI SQLAlchemy delete Many-to-Many relation causes StaleDataError | <p>I have an error upon deleting a ManyToMany relation from table. I found that the problem caused by same items in <code>bills_dishes</code> table, but I need to add same items.</p>
<p>So, the code below works fine for items without duplicates like:</p>
<pre><code>bill_id | dish_id
1 | 1
1 | 2
</code></pre... | <python><postgresql><sqlalchemy><many-to-many><fastapi> | 2022-12-12 16:31:07 | 1 | 780 | Vitalii Mytenko |
74,774,275 | 1,350,082 | Finding concurrent occurences of values above/below a threshold in a Pandas DataFrame/Series | <p>I need to repeatedly scan columns in a Pandas DataFrame (I will refer to this as a Series) to determine the number of times a threshold is breached. What is making this more complicated is the following:</p>
<ul>
<li>The series is only considered to have breached the threshold if it is beyond the threshold for five ... | <python><pandas><dataframe> | 2022-12-12 16:30:44 | 0 | 317 | speeder1987 |
74,774,269 | 5,110,870 | Correct way of updating __repr__ in Python using dataclasses and inheritance | <p>I have the following code:</p>
<pre class="lang-py prettyprint-override"><code>from dataclasses import MISSING, asdict, dataclass
from typing import Any
from datetime import datetime
@dataclass()
class BookMetadata():
'''Parent class.'''
isbn: str
title: str
author: str
publisher: str
... | <python><oop><inheritance><python-dataclasses><repr> | 2022-12-12 16:30:11 | 2 | 7,979 | FaCoffee |
74,774,254 | 5,508,978 | How can I retrieve the hyper-parameters that were used to train this xgboost booster type model? | <p>I have an xgboost model that is trained already. It was trained by the xgboost original API. I am trying to find the hyper-parameters upon which the trained model was trained. Most specifically, I want to retrieve the objective of the trained model.</p>
<pre><code>xgb.__versions__ # returns '1.7.2'
type(model) # ret... | <python><xgboost> | 2022-12-12 16:29:12 | 1 | 370 | mansanto |
74,774,193 | 13,454,049 | Why is rb+ slower than r+? Python | <p>While is was writing another answer on StackOverflow, I encountered this very strange behaviour: rb+ seems to be slower than r+:</p>
<pre class="lang-py prettyprint-override"><code>LINE_NUMBER = 1001
NEW_LINE_2 = ""
NEW_LINE_3 = "".encode()
def test2():
with open("temp.txt", "w... | <python><python-3.x> | 2022-12-12 16:24:03 | 1 | 1,205 | Nice Zombies |
74,774,072 | 7,437,143 | Transparant, and coloured, networkx nodes with a node colour dictionary? | <p>Whilst drawing a networkx graph, with differently coloured nodes, I'm trying to make some of them transparent. Based on the last <a href="https://groups.google.com/g/networkx-discuss/c/Q9SHbJ4Af6A" rel="nofollow noreferrer">answer in this post</a>, that seems to be possible. However, I am experiencing some difficult... | <python><matplotlib><networkx><draw><transparency> | 2022-12-12 16:14:34 | 2 | 2,887 | a.t. |
74,773,925 | 6,119,375 | adding a vertical line to a time series plot in python | <p>i am plotting time series data, which will be split to a training and test data set. Now, i would like to draw a verticcal line in the plot, that indicated where the training/test data split happens.</p>
<pre><code>split_point indicates where the data should be plotted.
df = pd.read_csv('https://raw.githubusercont... | <python><matplotlib><time-series> | 2022-12-12 16:03:33 | 1 | 1,890 | Nneka |
74,773,824 | 14,403,266 | Sum the rows of a pandas dataframe grouping by the dates with the same year | <p>I have the following dataframe. lets call it <code>df</code>:</p>
<pre><code>|Account |Type |Date | Per | Value|
-----------------------------------------------
|A |FC |31/03/2019 |3M |a |
|A |FC |30/06/2019 |3M |b |
|A |FC |30/09/2019 |3M |c |
... | <python><pandas><dataframe> | 2022-12-12 15:57:29 | 0 | 337 | Valeria Arango |
74,773,746 | 2,394,694 | poetry install fail build with private dependency | <p>I have a module that depends on another module (<code>module_a</code>) stored in my private repository (nexus) that reuqest another module (<code>module_b</code>) at build time, even stored in the private repository.</p>
<p>I add repository source on <code>poetry.toml</code> in order to add my private repo.</p>
<pre... | <python><python-poetry> | 2022-12-12 15:51:42 | 0 | 1,549 | theShadow89 |
74,773,700 | 607,407 | Is there a way to sync a serializable structure with python multiprocessing? | <p>If you create a new Process in python, it will serialize and copy the entire available scope, as far as I understand it. If you use <code>multiprocessing.Pipe()</code> it also allows sending various things, not just raw bytes.</p>
<p>However, instead of sending, I simply want to update a variable that contains a sim... | <python><python-3.x><python-multiprocessing> | 2022-12-12 15:47:50 | 1 | 53,877 | Tomáš Zato |
74,773,594 | 12,692,182 | Wildly inconsistent and incorrect lighting in opengl | <p>I followed a tutorial to add simple diffuse lighting, but the lighting is very much broken:</p>
<p><a href="https://i.sstatic.net/v2KVQ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/v2KVQ.png" alt="Sample object" /></a></p>
<p>On top of being inconsistent, all the diffuse component completely disapp... | <python><numpy><opengl><pyopengl><lighting> | 2022-12-12 15:39:50 | 2 | 1,011 | User 12692182 |
74,773,458 | 8,388,057 | Cannot import name error in Django split models | <p>I have split the Django models into multiple model files following the follow file tree structure,</p>
<pre><code>+-api(app)-+
+-__init__.py
+-models -+
|
+-__init__.py
+-model1.py
+-model2.py
... | <python><django><django-models><python-module><django-serializer> | 2022-12-12 15:29:24 | 1 | 1,215 | Avishka Dambawinna |
74,773,394 | 214,296 | How to add OPTION to Click class implementation? | <p>Trying to add an "option" to a class implementation of click. Admittedly, Python is not my area of expertise, but it needs to be done. There area already a bunch of "arguments" implemented using this class approach. Anyone know how to get options to work here?</p>
<p><strong>test.py</strong></... | <python><runtime-error><python-click> | 2022-12-12 15:24:29 | 1 | 14,392 | Jim Fell |
74,773,240 | 1,232,660 | Caveats of printing unicode characters in Python | <p>The following code:</p>
<pre class="lang-py prettyprint-override"><code>print('\N{WAVING BLACK FLAG}')
</code></pre>
<p>is as simple as it can be. Yet on some machines it prints the character as expected, on other it raises a <code>UnicodeEncodeError</code> with a message <code>'ascii' codec can't encode character '... | <python><unicode> | 2022-12-12 15:12:09 | 1 | 3,558 | Jeyekomon |
74,773,066 | 9,182,743 | Retain pandas dtype 'category' when using parquet file | <p>I am using parquet to store pandas dataframes, and would like to keep the dtype of columns.
However It sometimes ins't working:
here is the example code:</p>
<pre class="lang-py prettyprint-override"><code>import pandas as pd
import numpy as np
df = pd.DataFrame({
'a': [pd.NA, 'a', 'b', 'c'],
'b': [1,2,3,... | <python><pandas><parquet> | 2022-12-12 15:00:52 | 0 | 1,168 | Leo |
74,773,052 | 12,242,085 | How to drop duplicates in one column based on values in 2 other columns in DataFrame in Python Pandas? | <p>I have DataFrame in Python Pandas like below:</p>
<p>data types:</p>
<ul>
<li><p>ID - int</p>
</li>
<li><p>TYPE - object</p>
</li>
<li><p>TG_A - int</p>
</li>
<li><p>TG_B - int</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>ID</th>
<th>TYPE</th>
<th>TG_A</th>
<th>TG_B</th>
</tr>
</thead... | <python><pandas><duplicates><drop-duplicates> | 2022-12-12 14:59:45 | 2 | 2,350 | dingaro |
74,772,998 | 13,115,582 | How to mix / intersperse two .npy files? | <p>I have two <code>.npy</code> files that both contain a ndarray with shape <code>(1_000_000, 833)</code> (1M inputs for a neural network with 833 input neurons), however the exact shape should not matter except that it is the same among the two files.</p>
<p>I want to create two new <code>.npy</code> files that are t... | <python><numpy><numpy-ndarray> | 2022-12-12 14:56:33 | 1 | 687 | leo848 |
74,772,980 | 3,979,919 | Multiprocessing: Instantiate Processes individually | <p>I have an embarrassingly parallel problem in a Reinforcement-Learning context. I would like to let the neural network generate data in parallel. To achieve that each process needs its own model.</p>
<p>I have tried to use Pool to achieve this, but now I am not sure if this is the correct method.</p>
<pre class="lang... | <python><multiprocessing> | 2022-12-12 14:55:25 | 1 | 1,671 | Nima Mousavi |
74,772,951 | 607,846 | Running the same test on different model objects | <p>I have three scenarios in my db that should give the same result when I call an endpoint:</p>
<pre><code>Model1.objects.create(name="a")
assert requests.delete("endpoint?pk=a").response == 204
Model2.objects.create(name="a")
assert requests.delete("endpoint?pk=a").response ==... | <python><pytest><django-testing> | 2022-12-12 14:52:22 | 1 | 13,283 | Baz |
74,772,932 | 8,324,092 | ComboBox not showing the options required after saving workorder | <p>I'm writing a GUI application and I'm having some problems. I am building this app with the help of chatgpt but I have got this error and don't know how to fix it. When I open the app and I touch the combobox I can see the options which are the cities to be choosed. When I save the workorder and want to create a new... | <python><pyqt5> | 2022-12-12 14:50:53 | 1 | 429 | Gent Bytyqi |
74,772,909 | 17,487,457 | Barplot of a dataframe by group | <p>I am having difficulty with this. I have the results from my initial model (`Unfiltered´), that I plot like so:</p>
<pre class="lang-py prettyprint-override"><code>df = pd.DataFrame(
{'class': ['foot', 'bike', 'bus', 'car', 'metro'],
'Precision': [0.7, 0.66, 0.41, 0.61, 0.11],
'Recall': [0.58, 0.35, 0.... | <python><pandas><matplotlib><seaborn><grouped-bar-chart> | 2022-12-12 14:49:35 | 2 | 305 | Amina Umar |
74,772,855 | 12,785,645 | Replace a specific line in a file without looping | <p>I have a huge file with a problematic character at line 9073245. So I want to replace/remove that character at that specific line while keeping the rest of the file intact. I found the following solution <a href="https://stackoverflow.com/a/39110/12785645">here</a>:</p>
<pre><code>from tempfile import mkstemp
from s... | <python> | 2022-12-12 14:45:31 | 2 | 463 | saQuist |
74,772,785 | 2,527,629 | what are the differences among mambaforge, mambaforge-pypy3, miniforge, miniforge-pypy3 | <p>there have been explanations about the different between <code>miniforge</code> and <code>miniconda</code></p>
<blockquote>
<p><code>miniforge</code> is the community (conda-forge) driven minimalistic conda installer. Subsequent package installations come thus from conda-forge channel.
<code>miniconda</code> is the ... | <python><pypy><mamba><mini-forge><mambaforge> | 2022-12-12 14:40:09 | 2 | 3,690 | wsdzbm |
74,772,738 | 11,251,373 | Django: get only objects with max foreignkey count | <p>The question is quite simple but possibly unsolvable with Django.</p>
<p>For example I have a model</p>
<pre class="lang-py prettyprint-override"><code>class MyModel(models.Model)
field_a = models.IntegerField()
field_b = models.CharField()
field_c = models.ForegnKey(MyOtherModel)
</code></pre>
<p>The quest... | <python><django> | 2022-12-12 14:37:13 | 1 | 2,235 | Aleksei Khatkevich |
74,772,625 | 10,413,816 | In Python (and attrs), can I export a field to yaml using a different name? | <p>I would like to modify a field name, but only when exporting to yaml. For instance:</p>
<pre><code>import attrs
import yaml
from attr import fields, field
from attrs import define
@define
class Task:
id: int
@define
class Data:
all_tasks: List[Task]
x: int = field(default=5)
if __name__ == '__main__':... | <python><yaml> | 2022-12-12 14:29:43 | 1 | 572 | Roberto Morávia |
74,772,604 | 12,131,472 | dataframe: parse a column containing list of dicts: Traceback ValueError: cannot reindex on an axis with duplicate labels | <p>I have one column(called 'data') in a dataframe which looks like this, each row has a list of dicts, starting with 2022-01-04, ended today, for example the 1st row is {'value': 18.76, 'date': '2022-01-04'}, {'value': 18.59, 'date': '2022-01-05'}, {'value': 18.99, 'date': '2022-01-06'}...</p>
<pre><code>0 [{'valu... | <python><pandas><dictionary><pandas-explode> | 2022-12-12 14:28:21 | 1 | 447 | neutralname |
74,772,561 | 5,110,870 | Python dataclass with inheritance: __init__() missing 1 required positional argument | <p>Trying my luck with inheritance with data classes (Python 3.9.13).</p>
<p>Given the following:</p>
<pre><code>from dataclasses import dataclass
from datetime import datetime
@dataclass()
class BookMetadata():
'''Parent class.'''
isbn: str
title: str
author: str
publisher: str
date_pu... | <python><oop><inheritance><python-dataclasses> | 2022-12-12 14:25:13 | 1 | 7,979 | FaCoffee |
74,772,395 | 14,882,862 | How to declare additional attributes when subclassing str? | <p>Consider the following class:</p>
<pre><code>class StrWithInt(str):
def __new__(cls, content, value: int):
ret = super().__new__(cls, content)
ret.value = value
return ret
</code></pre>
<p>This class just works fine, but when using <code>mypy</code>, the following error occurs:
<code>&quo... | <python><subclass><mypy> | 2022-12-12 14:13:31 | 1 | 866 | Henk |
74,772,390 | 17,191,838 | Freezing the value of type arguments in an inherited generic class | <pre class="lang-py prettyprint-override"><code>import typing as typ
T = typ.TypeVar("T")
X = typ.TypeVar("X")
class Base(typ.Generic[T, X]):
pass
class ChildInt(?):
pass
class InheritedInt(ChildInt[str]):
# should be equivalent to Base[int, str]
</code></pre>
<p>I'd want to inherit <... | <python><python-typing> | 2022-12-12 14:12:40 | 1 | 537 | TNTzx |
74,772,381 | 8,406,122 | Copying files from one location of a server to another using python | <p>Say I have a file that contains the different locations where some <code>'.wav'</code> files are present on a server. For example say the content of the text file <code>location.txt</code> containing the locations of the wav files is this</p>
<pre><code>/home/user/test_audio_folder_1/audio1.wav
/home/user/test_audio... | <python><server> | 2022-12-12 14:12:11 | 2 | 377 | Turing101 |
74,772,293 | 4,451,521 | Warning when adding a column to a dataframe with the same value | <p>How can I add a column to a dataframe with the same value</p>
<p>I've tried</p>
<pre><code>dataframe['size']=10
</code></pre>
<p>or</p>
<pre><code>dataframe.loc[:,'size']=10
</code></pre>
<p>but this gives</p>
<pre><code>A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,co... | <python><pandas> | 2022-12-12 14:06:28 | 0 | 10,576 | KansaiRobot |
74,772,252 | 12,304,000 | No module named 'airflow.sensors.python_sensor' | <p>I am trying to use PythonSensor in my dag but I am unable to import it.</p>
<pre><code>from airflow.sensors.python_sensor import PythonSensor
wait_for_stg_completion = PythonSensor(
task_id='wait_for_stg_completion',
python_callable=fetch_stg_qa_status
)
</code></pre>
<p>How can I import it? ... | <python><python-3.x><airflow> | 2022-12-12 14:03:00 | 2 | 3,522 | x89 |
74,772,165 | 7,959,614 | Create triangular mesh of pentagon or higher | <p>I have the coordinates of the corners of a pentagon</p>
<pre><code>import math
import numpy as np
n_angles = 5
r = 1
angles = np.linspace(0, 2 * math.pi, n_angles, endpoint=False)
x = (r * np.cos(angles))
y = (r * np.sin(angles))
corners = np.array(list(zip(x, y)))
</code></pre>
<p>From these points I want to crea... | <python><matplotlib><scipy><triangulation><delaunay> | 2022-12-12 13:55:25 | 1 | 406 | HJA24 |
74,772,104 | 7,484,371 | Numpy: Using an index array to set values in a 3D array | <p>I have an <code>indices</code> array of shape (2, 2, 3) which looks like this:</p>
<pre><code>array([[[ 0, 6, 12],
[ 0, 6, 12]],
[[ 1, 7, 13],
[ 1, 7, 13]]])
</code></pre>
<p>I want to use these as <strong>indices</strong> to set some values of a <code>np.zeros</code> matrix to 1. While th... | <python><numpy><multidimensional-array><numpy-ndarray> | 2022-12-12 13:51:02 | 1 | 4,244 | Max S. |
74,772,070 | 18,632,985 | ModuleNotFoundError: No module named X when using foreach function with PySpark | <p>I currently encounter an error when using an <strong>external Python module</strong> (orjson) inside <strong>foreach</strong> function with <strong>Pyspark</strong>. Everything was fine if I use that module outside <strong>foreach</strong> function (<strong>collect()</strong> method). Below is my simple code</p>
<pr... | <python><apache-spark><pyspark><python-module><spark-submit> | 2022-12-12 13:48:33 | 1 | 751 | Hoang Minh Quang FX15045 |
74,772,068 | 4,451,521 | How can I set the size of the markers in plotly express sacatter_mapbox? | <p>I am trying to plot some latitudes and longitudes in a map
I do</p>
<pre><code>import plotly.express as px
fig = px.scatter_mapbox(one_line, lat="lat", lon="lon",
zoom=15,
text = 'point_idx',
size='size',
... | <python><plotly-express> | 2022-12-12 13:48:24 | 0 | 10,576 | KansaiRobot |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.