QuestionId int64 74.8M 79.8M | UserId int64 56 29.4M | QuestionTitle stringlengths 15 150 | QuestionBody stringlengths 40 40.3k | Tags stringlengths 8 101 | CreationDate stringdate 2022-12-10 09:42:47 2025-11-01 19:08:18 | AnswerCount int64 0 44 | UserExpertiseLevel int64 301 888k | UserDisplayName stringlengths 3 30 ⌀ |
|---|---|---|---|---|---|---|---|---|
75,071,603 | 19,303,365 | dropping unnecessary text from list of string | <p>Existing Df :</p>
<pre><code>Id dates
01 ['ATIVE 04/2018 to 03/2020',' XYZ mar 2020 – Jul 2022','June 2021 - 2023 XYZ']
</code></pre>
<p>Expected Df :</p>
<pre><code>Id dates
01 ['04/2018 to 03/2020','mar 2020 – Jul... | <python><regex><dataframe> | 2023-01-10 14:42:09 | 1 | 365 | Roshankumar |
75,071,174 | 7,123,933 | How to calculate month by month change in value per user in pandas? | <p>I was looking for similar topics, but I found only change by month. My problem is that I would like to have a month change in value e.g. UPL but per user like in the below example.</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th style="text-align: right;">user_id</th>
<th style="text-ali... | <python><pandas> | 2023-01-10 14:08:16 | 1 | 359 | Lukasz |
75,071,155 | 8,610,286 | How to convert a requests GET request in Python to asyncio with payloads? | <p>I am trying to parallelize requests to the Wikidata API using Python's asyncio module.</p>
<p>My current synchronous script does the following:</p>
<pre><code>import requests
base_url = "https://www.wikidata.org/w/api.php&"
payload = {
"action": "query",
"list&... | <python><python-requests><python-asyncio><wikidata-api> | 2023-01-10 14:07:02 | 1 | 349 | Tiago Lubiana |
75,071,048 | 6,694,814 | Leaflet on-click circle doesn't work in Python folium | <p>I would like to make the Leaflet circle an on-click feature in my Python folium map.</p>
<p>Unfortunately, the code returns nothing despite no information from the console.</p>
<pre><code>class Circle(MacroElement):
"""
https://leafletjs.com/reference.html#circle
"""
_template = Te... | <javascript><python><leaflet><folium> | 2023-01-10 13:59:09 | 0 | 1,556 | Geographos |
75,070,946 | 360,829 | How to override a class __init__ method while keeping the types | <p>What's the proper way to extend a class <code>__init__</code> method while keeping the type annotations intact?</p>
<p>Take this example class:</p>
<pre class="lang-py prettyprint-override"><code>class Base:
def __init__(self, *, a: str):
pass
</code></pre>
<p>I would like to subclass <code>Base</code> a... | <python><mypy><python-typing> | 2023-01-10 13:50:55 | 3 | 20,443 | Cesar Canassa |
75,070,928 | 3,875,720 | Unable to understand the looping logic | <p>I am trying to solve a problem using Python.
The problem: Given a string like 'a b c d', replace the space with '_' for all combinations.
So here, the expected output would be:
'a_b c d',
'a_b_c d',
'a_b_c_d',
'a b_c d',
'a b_c_d',
'a b c_d'</p>
<p>I am using a sliding window approach for this, here's my code:</p>
<... | <python><python-3.x><list> | 2023-01-10 13:49:28 | 4 | 323 | FenderBender |
75,070,918 | 12,349,101 | How to bind ONLY ASCII keys in tkinter? | <p>I want to bind only ASCII keys using tkinter.
I know how to bind it selectively (per key) or even by binding it to all keyboard keys (by using <code><Key></code> or <code><KeyPress></code>), but problem is, I don't know how to do the same for every ASCII keys.</p>
<p>Here is what I tried so far:</p>
<ol>... | <python><tkinter><tk-toolkit><key-bindings> | 2023-01-10 13:48:19 | 1 | 553 | secemp9 |
75,070,784 | 7,951,365 | Print exact variable values with percentage symbols on pie chart | <p><a href="https://i.sstatic.net/0OB42.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/0OB42.png" alt="enter image description here" /></a></p>
<p>I would like to represent on a pie chart, the exact same values of the column "Percentage Answers" with a percentage symbol (100 % instead of 100.0... | <python><matplotlib><pie-chart> | 2023-01-10 13:36:56 | 1 | 490 | Kathia |
75,070,619 | 2,406,499 | How to fix an .csv file with wrong/different/inconsistent column numbers due to commas within a field | <p>I have 60 .xlsx files with 300K-500k rows that I was hoping to read into a df to do some analysis
the problem I'm facing is that when I read the files into a df I get extra columns due to commas within a fields, looking into one of those excel files I encounter the following situation example right into the excel fi... | <python><pandas><dataframe> | 2023-01-10 13:22:34 | 1 | 1,268 | Francisco Cortes |
75,070,552 | 4,869,005 | How to apply label to strip based on symbol present in two parallel array | <p>I have data strips of length 3600. This data strip has two values.</p>
<ol>
<li>symbols</li>
<li>aux_note
it looks like this - <a href="https://extendsclass.com/csv-editor.html#031e1f1" rel="nofollow noreferrer">https://extendsclass.com/csv-editor.html#031e1f1</a></li>
</ol>
<p>If the aux note is empty, it means con... | <python><for-loop><if-statement> | 2023-01-10 13:15:51 | 0 | 2,257 | user2129623 |
75,070,547 | 6,875,304 | how to put all the templates in a single file and access them in jinja2 from python code | <p>I have 30 to 40 SQL queries and I want to use jinja2 template files for storing the queries so that the python code and SQL queries are stored separately</p>
<p>for each SQL query, I am creating a separate template file and loading that template using the python code given below</p>
<pre><code>from jinja2 import Env... | <python><python-3.x><python-2.7><templates><jinja2> | 2023-01-10 13:14:55 | 1 | 401 | Akhil |
75,070,527 | 433,267 | Correct way to add dynamic form fields to WagtailModelAdminForm | <p>I have a use case where I need to add dynamic form fields to a <code>WagtailModelAdminForm</code>. With standard django I would normally just create a custom subclass and add the fields in the <code>__init__</code> method of the form. In Wagtail, because the forms are built up with the edit_handlers, this becomes a ... | <python><django><wagtail><wagtail-admin> | 2023-01-10 13:13:04 | 1 | 1,322 | Andre |
75,070,442 | 11,724,014 | scipy.optimize.minimize stop after n iterations without being better | <p>I am looking to stop the <a href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.minimize.html" rel="nofollow noreferrer">minimization of scipy</a> when there are <strong>no improvment in score after n iterations</strong>.</p>
<p>Like a <strong>counter that reset</strong> when the scipy minimiza... | <python><scipy><minimization> | 2023-01-10 13:05:12 | 0 | 1,314 | Vincent Bénet |
75,070,392 | 7,583,953 | Why does the value of this class variable persist even after resetting it? | <p>I have the following code, which is executed multiple times on different binary trees</p>
<pre><code>class Solution:
ans = []
def getLonelyNodes(self, root: Optional[TreeNode]) -> List[int]:
def helper(root):
if root.left is None and root.right:
self.ans.append(root.ri... | <python><class> | 2023-01-10 13:00:52 | 1 | 9,733 | Alec |
75,070,236 | 4,492,738 | Saving a redacted PDF file in Python to mask underneath text | <p>I read in a PDF file in Python, added a text box on top of the text that I'd like to redact, and saved the change in a new PDF file. When I searched for the text in the redacted PDF file using a PDF reader, the text can still be found.</p>
<p>Is there a way to save the PDF as a single layer file? Or is there a way... | <python><pdf><redaction> | 2023-01-10 12:48:44 | 2 | 883 | TTZ |
75,070,080 | 1,200,914 | Create different python packages from same repository | <p>I'm building a Python package from a source code repository I have, using a <code>setup.py</code> script with <code>setuptools.setup(...)</code>. In this function call I include all the Python libraries needed for the project to be installed using the <code>install_requires</code> argument.</p>
<p>However, I noticed... | <python><repository><setuptools><python-packaging> | 2023-01-10 12:36:21 | 1 | 3,052 | Learning from masters |
75,069,888 | 4,948,165 | perform numpy mean over matrix using labels as indicators | <pre><code>import numpy as np
arr = np.random.random((5, 3))
labels = [1, 1, 2, 2, 3]
arr
Out[136]:
array([[0.20349907, 0.1330621 , 0.78268978],
[0.71883378, 0.24783927, 0.35576746],
[0.17760916, 0.25003952, 0.29058267],
[0.90379712, 0.78134806, 0.49941208],
[0.08025936, 0.01712403, 0.5... | <python><numpy> | 2023-01-10 12:19:36 | 2 | 3,238 | Eran Moshe |
75,069,677 | 4,507,231 | rpy2 throws a NotImplementedError concerning Conversion rules | <p>I'm trying to implement R code inside some Python (3.10) software using rpy2 (3.5.7). I want to know whether I can get rpy2 to work before trying anything complicated. This is an "off-the-shelf" execution, using one of the earliest examples in the documentation introduction. I am running this from inside t... | <python><r><rpy2> | 2023-01-10 12:02:21 | 2 | 1,177 | Anthony Nash |
75,069,583 | 12,886,858 | Get db call inside pytest FastAPI | <p>I am trying to get the test user that I'm creating while testing to delete at the end but I get the error: <code>FAILED tests_main.py::test_delete_new_users - AttributeError: 'Depends' object has no attribute 'query' </code></p>
<p>This is my code:</p>
<pre><code>def test_delete_new_users(db: Session = Depends(datab... | <python><pytest><fastapi> | 2023-01-10 11:53:27 | 0 | 633 | Vedo |
75,069,418 | 1,422,096 | Log stderr to file, prefixed with datetime | <p>I do proper logging with the <code>logging</code> module (<code>logger.info</code>, <code>logger.debug</code>...) and this gets written to a file.</p>
<p>But in some corner cases (external modules, uncaught exceptions, etc.), I sometimes still have errors written to <code>stderr</code>.</p>
<p>I log this to a file w... | <python><windows><logging><stderr> | 2023-01-10 11:37:36 | 2 | 47,388 | Basj |
75,069,376 | 7,462,275 | How to select rows filtered with condition on the previous and the next rows in pandas and put them in a empty df? | <p>Considering the following dataframe <code>df</code> :</p>
<pre><code>df = pd.DataFrame(
{
"col1": [0,1,2,3,4,5,6,7,8,9,10],
"col2": ["A","B","C","D","E","F","G","H","I","J",&quo... | <python><pandas><dataframe> | 2023-01-10 11:34:31 | 1 | 2,515 | Stef1611 |
75,069,342 | 8,548,828 | Is there an optimized way to convert a numpy array to fortran order when using memmaps | <p>I have a memmapped numpy array:</p>
<pre><code>arr = np.load("a.npy", mmap_mode='r')
</code></pre>
<p>It is bigger than my memory. For my further computation I need it in fortran order instead of C. So I can use <code>np.asfortranarray</code> to convert it and then use <code>np.save</code> to store it in a... | <python><numpy><numpy-memmap> | 2023-01-10 11:31:41 | 0 | 3,266 | Tarick Welling |
75,069,262 | 1,862,861 | Change background colour of PyQt5 QPushButton without losing the default button style | <p>I have a basic code for a PyQt5 GUI with two buttons. In it, I want to change the the background colour of one of the buttons. I do this by setting the <code>background-color</code> style sheet attribute for the button. This works, however, under Windows it seems to remove all other style attributes for the button, ... | <python><pyqt5> | 2023-01-10 11:24:31 | 2 | 7,300 | Matt Pitkin |
75,069,247 | 340,819 | ‘OSError: [Errno 22] Invalid argument’ when attempting to open a file in the %LOCALAPPDATA%\Microsoft\WindowsApps directory | <p>Python won't let me open this file. Why not? The format of the command is correct, and it's definitely a file that exists on disk.</p>
<pre><code>Python 3.10.5 (tags/v3.10.5:f377153, Jun 6 2022, 16:14:13) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "... | <python><windows> | 2023-01-10 11:23:44 | 0 | 22,450 | Hammerite |
75,069,239 | 11,867,978 | How to convert code to write data in xlsx instead of csv using python without pandas? | <p>I have written a python code to store data in csv format but now need to store in .xlsx file.
how to convert the below code and write the output in .xlsx file.</p>
<pre><code> details_file = self.get_local_storage_path() + '/Myfile.xlsx'
csv_columns = (
'id', 'name', 'place', 'salary', 'email',
... | <python><python-3.x><csv><xlsx> | 2023-01-10 11:22:57 | 1 | 448 | Mia |
75,069,099 | 17,487,457 | Expand a multidimentional array with another array of different shape | <p>I have the following arrays:</p>
<pre class="lang-py prettyprint-override"><code>A = np.array([
[[[0, 1, 2, 3],
[3, 0, 1, 2],
[2, 3, 0, 1],
[1, 3, 2, 1],
[1, 2, 3, 0]]],
[[[9, 8, 7, 6],
[5, 4, 3, 2],
... | <python><arrays><numpy><multidimensional-array><numpy-ndarray> | 2023-01-10 11:11:25 | 1 | 305 | Amina Umar |
75,069,062 | 17,210,463 | module 'numpy' has no attribute 'object' | <p>I am getting below error when running <code>mlflow app</code></p>
<blockquote>
<p>raise AttributeError("module {!r} has no attribute " AttributeError:
module 'numpy' has no attribute 'object'</p>
</blockquote>
<p>Can someone help me with this</p>
| <python><python-3.x><numpy><kubernetes><dockerfile> | 2023-01-10 11:08:51 | 4 | 369 | Divya |
75,069,045 | 7,841,521 | OR-Tools in python how to set power of a variable | <p>here is a google OR-tool example to optimize a function:</p>
<pre><code>from ortools.linear_solver import pywraplp
def LinearProgrammingExample():
"""Linear programming sample."""
# Instantiate a Glop solver, naming it LinearExample.
solver = pywraplp.Solver.CreateSolver('... | <python><or-tools> | 2023-01-10 11:06:27 | 1 | 347 | lelorrain7 |
75,069,012 | 5,283,030 | Set initial axis limits while preserving pan/zoom in DearPyGui | <p>Using DearPyGui, the x-axis and y-axis limits of a plot can be set using the <code>dpg.set_axis_limits</code> function, i.e.</p>
<pre><code>dpg.set_axis_limits("xaxis", xmin, xmax)
dpg.set_axis_limits("yaxis", ymin, ymax)
</code></pre>
<p>This <em>does</em> set the limits of the respective axis, ... | <python><dearpygui> | 2023-01-10 11:03:51 | 1 | 1,155 | hyperdelia |
75,068,956 | 6,870,955 | How to mock inner method's default parameter in Pytest? | <p>I am having problems trying to mock/patch a default parameter for a method, that is being called inside a method that is being unit tested with Pytest. In general the code looks like so:</p>
<pre class="lang-py prettyprint-override"><code>class Repository:
DEFAULT_VERSION = "0.1.10"
...
@classmethod... | <python><unit-testing><pytest> | 2023-01-10 10:59:36 | 1 | 1,187 | Bartosz Gajda |
75,068,952 | 5,672,950 | Keras inverse scaling prediction from model causes problems with broadcasting with shapes | <p>I
have built multi classification model with Keras and after model is finished I would like to predict value for one of my test input.</p>
<p>This is the part where I scaled features:</p>
<pre><code>x = dataframe.drop("workTime", axis = 1)
x = dataframe.drop("creation", axis = 1)
from sklearn.pre... | <python><pandas><tensorflow><keras><scikit-learn> | 2023-01-10 10:59:31 | 1 | 954 | Ernesto |
75,068,739 | 1,422,096 | How to make that f"..." string formatting uses comma instead of dot as decimal separator? | <p>I tried:</p>
<pre><code>import locale
print(locale.locale_alias)
locale.setlocale(locale.LC_ALL, '')
locale.setlocale(locale.LC_NUMERIC, "french")
print(f"{3.14:.2f}")
</code></pre>
<p>but the output is <code>3.14</code> whereas I would like <code>3,14</code>.</p>
<p><strong>How to do this with f... | <python><windows><floating-point><decimal><locale> | 2023-01-10 10:38:32 | 3 | 47,388 | Basj |
75,068,551 | 9,703,418 | Pytest showing error if path to test is not specified | <p>I have a conftest.py inside my tests/ folder which contains a fixture with a spark context as follows:</p>
<pre><code>import pytest
from pyspark import SparkConf
from sedona.utils import SedonaKryoRegistrator, KryoSerializer
from sedona.register import SedonaRegistrator
from pyspark.sql import SparkSession
@pytest... | <python><pyspark><pytest><apache-sedona> | 2023-01-10 10:21:32 | 1 | 384 | Rorepio |
75,068,402 | 7,714,681 | Add values to unexisting keys in dictionary | <p>I have a directory with many pickled files, each containing a dictionary. The filename indicates the setting of the dictionary. E.g.: <code>20NewsGroup___10___Norm-False___Probs-True___euclidean.pickle</code>.</p>
<p>I want to combine these different dicts all in one large dict. To do this, I have written the follow... | <python><dictionary><pickle><keyerror> | 2023-01-10 10:09:33 | 2 | 1,752 | Emil |
75,068,385 | 12,131,472 | how to convert latest 2 dates per category in a dataframe column to strings | <p>I have this Pandas dataframe</p>
<pre><code> category date value
0 A6TCE 2023-01-06 NaN
1 A6TCE 2023-01-09 NaN
2 BDTI 2023-01-06 NaN
3 BDTI 2023-01-09 NaN
4 S2TCE 2023-01-06 NaN
5 S2TCE 2023-01-09 NaN
6 TD1 2023-01-0... | <python><pandas><dataframe><time-series> | 2023-01-10 10:08:33 | 1 | 447 | neutralname |
75,068,372 | 1,068,980 | Update dictionary keys in one line | <p>I am updating the key names of a list of dictionaries in this way:</p>
<pre><code>def update_keys(vars: list) -> None:
keys = ["A", "V", "C"]
for v in vars:
for key in keys:
if key in v:
v[key.lower()] = v.pop(key)
</code></pre>
<p>Is there... | <python><python-3.x><loops><dictionary><list-comprehension> | 2023-01-10 10:07:26 | 1 | 369 | P. Solar |
75,068,249 | 7,454,177 | Why does the python list parsing work differently inline? | <p>In our project we try to work with the output of an aggregation, which is more challenging than expected. The following code throws an <code>IndexError</code>, even though our object looks (when using the <code>print</code> command) like this <code>[{'_id': None, 'sum': 2700}]</code>.</p>
<pre class="lang-py prettyp... | <python><pymongo> | 2023-01-10 09:57:47 | 0 | 2,126 | creyD |
75,068,061 | 5,638,513 | Finding All DataFrame Matches for One Column to Get Combinations | <p>Let's say I have a DataFrame <code>base_df</code> that reads:</p>
<pre><code> 0 1 2 3
0 2 'A' 'B' NaN
1 2 'A' 'C' NaN
2 2 'A' NaN 'D'
3 2 'A' NaN 'E'
4 2 'A' NaN 'F'
</code></pre>
<p>How can I expand through the cells and columns, preferably without needing to iterate, to produce:</p>
<pre><code> 0 1 2 ... | <python><pandas><combinatorics> | 2023-01-10 09:42:09 | 2 | 357 | Joshua Harwood |
75,068,007 | 959,894 | Embed Python in Python? | <p>I wrote a "compiler" <a href="https://github.com/sloisel/pyptex" rel="nofollow noreferrer">PypTeX</a> that converts an input file <code>a.tex</code> containing <code>Hello @{3+4}</code> to an ouput file <code>a.pyptex</code> containing <code>Hello 7</code>. I evaluate arbitrary Python fragments like <code>... | <python><compiler-construction><introspection> | 2023-01-10 09:38:00 | 1 | 556 | Sébastien Loisel |
75,067,668 | 1,476,512 | Locust failed to fire events when running as lib | <p>The following code is from the <a href="https://github.com/locustio/locust/blob/master/examples/use_as_lib.py" rel="nofollow noreferrer">tutorial</a>. I just added some codes to fire the <code>test_start</code> event(not sure if I fire it in the right place ?) and listen to both <code>init</code> and <code>test_star... | <python><locust> | 2023-01-10 09:05:46 | 1 | 2,851 | mCY |
75,067,665 | 6,510,276 | How to fetch (pop) N elements from a Python list iteratively while list exhausts? | <p>I have the following Python list with a predefined N:</p>
<pre><code>l = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
N = 3
</code></pre>
<p>I would like to have a collection of N elements (a list of lists, for example) from the list (if <code>len(l) % !=0</code> then the last collection could be shorter than N). So something li... | <python><list><collections> | 2023-01-10 09:05:23 | 1 | 1,168 | Hendrik |
75,067,408 | 880,783 | How to use `pylint` on code supporting multiple Python versions? | <p>Since <code>hashlib.file_digest</code> was introduced only in Python 3.11, I use a fallback to the previous code:</p>
<pre class="lang-py prettyprint-override"><code>if sys.version_info < (3, 11):
digest = hashlib.sha256()
digest.update(file.read())
else:
digest = hashlib.file_digest(file, hashlib.sha... | <python><pylint><error-suppression> | 2023-01-10 08:41:14 | 0 | 6,279 | bers |
75,067,333 | 3,734,914 | Compare Polars DataFrames That Have a Polars Date Colums | <p>I want to test that two Polars DataFame objects are equivalent, that contain a column which represents dates.</p>
<p>If I use <code>datetime.date</code> from the standard library I don't have any problems:</p>
<pre class="lang-py prettyprint-override"><code>import datetime as dt
import polars as pl
from polars.test... | <python><date><datetime><python-polars> | 2023-01-10 08:33:47 | 2 | 9,017 | Batman |
75,067,279 | 2,998,077 | Pandas to fill empty cells in column according to another column | <p>A dataframe looks like this, and I want to fill the empty cells in the 'Date' column (when the "Area" is West or North), with content in "Year" column plus "0601".</p>
<p><a href="https://i.sstatic.net/sD726.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/sD726.png" alt="... | <python><pandas><dataframe> | 2023-01-10 08:27:07 | 1 | 9,496 | Mark K |
75,067,269 | 4,288,259 | SQLAlchemy Imperatively Mapping a Composite Entity without __composite_values__ | <p>I'd like to use SQLAlchemy to build my relational schema, but due to project constraints, the central model should not have any dependencies on any third-parties, and I'd like to avoid adding a <code>__composite_values__</code> method to any class that could be used as a composite in the database.</p>
<p>As a concre... | <python><sqlalchemy><orm> | 2023-01-10 08:25:37 | 1 | 984 | Andrew Lalis |
75,067,208 | 386,861 | How to access specific custom attribute elements with Beautifulsoup | <p>I'm still trying to understand the syntax for BeautifulSoup and hope someone can put this right.</p>
<p>I've got an article - <a href="https://www.bbc.co.uk/news/world-europe-49345912" rel="nofollow noreferrer">https://www.bbc.co.uk/news/world-europe-49345912</a></p>
<p>I want to do some NLP on the body text.</p>
<p... | <python><beautifulsoup> | 2023-01-10 08:19:57 | 1 | 7,882 | elksie5000 |
75,067,141 | 10,194,070 | pip3 + is not a supported wheel on this platform | <p>We tried to install different kind of <code>lxml-python</code> modules on <code>rhel 7.X</code> but without success as the following</p>
<pre><code>pip3 install --no-index --find-links /tmp lxml-4.9.2-cp39-cp39-musllinux_1_1_x86_64.whl
WARNING: Running pip install with root privileges is generally not a good idea. T... | <python><python-3.x><pip><rhel> | 2023-01-10 08:12:49 | 0 | 1,927 | Judy |
75,066,525 | 19,303,365 | Parsing dates in Different format from Text | <p>i have a dataframe where within the raw text column certain text with Dates in different format is given. i am looking to extract this dates in separate column</p>
<p>sample Raw Text :</p>
<blockquote>
<p>"Sales Assistant @ DFS Duration - <strong>June 2021 - 2023</strong> Currently
working in XYZ Within the rol... | <python><pandas><regex> | 2023-01-10 07:04:20 | 1 | 365 | Roshankumar |
75,066,390 | 241,515 | Pandas dataframe: change unique values in each column to NaNs | <p>I have a <code>DataFrame</code> arranged in a manner similar to this:</p>
<pre><code>ID Sample_1 Sample_2
A 0.182 0.754
B 0.182 0.754
C 0.182 0.01
D 0.182 0.2
E 0.9 0.2
</code></pre>
<p>As you can see, there are some repeated values ("true" measurements) and si... | <python><pandas><dataframe> | 2023-01-10 06:47:59 | 2 | 4,973 | Einar |
75,066,078 | 19,826,650 | Run Python from PHP code not executed problem | <p>I have php code and python code and i use visual studio code as code editor, i use xampp apache for personal server. The code is below :</p>
<p>Html run button</p>
<pre><code><form action="" method="post">
<div class="card-header py-3 mb-30 mt-20 pb-20 pt-20">
... | <python><php><shell-exec> | 2023-01-10 06:05:41 | 0 | 377 | Jessen Jie |
75,065,768 | 9,648,520 | Python - Adding quotes on a multi word phrase in a string | <p>Suppose there is a string like follow:</p>
<pre><code>'jon doe AND (james OR james david)'
</code></pre>
<p>What I want to do is to add double quotes around the multi word phrase like in jon doe and in james david as follow:</p>
<pre><code>'"jon doe" AND (james OR "james david")'
</code></pre>
<p... | <python><regex><string> | 2023-01-10 05:20:31 | 1 | 2,262 | FightWithCode |
75,065,700 | 8,391,469 | Pandas merge or update an empty dataframe with another dataframe? | <p>I have an empty dataframe <code>df1</code></p>
<pre><code>import numpy as np
import pandas as pd
df1 = pd.DataFrame(columns=['A','B','C','D','E'])
df1
A B C D E
</code></pre>
<p>I want to merge or update this dataframe with another dataframe <code>df2</code></p>
<pre><code>df2 = pd.DataFrame({ 'B': [1,2,3]... | <python><pandas><dataframe> | 2023-01-10 05:08:33 | 2 | 495 | Johnny Tam |
75,065,651 | 10,829,044 | Pandas filter using one column and replace on another column | <p>I have a dataframe like as below</p>
<pre><code>df = pd.DataFrame(
{'stud_id' : [101, 101, 101, 101,
101, 101, 101, 101],
'sub_code' : ['CSE01', 'CSE02', 'CSE03',
'CSE06', 'CSE05', 'CSE04',
'CSE07', 'CSE08'],
'marks' : ['A','B','C','D',
... | <python><pandas><list><dataframe><filter> | 2023-01-10 05:00:28 | 1 | 7,793 | The Great |
75,065,591 | 708,305 | Basic python error with importing module - getting modulenotfound error | <p>I'm doing something basic with python, and I'm getting a pretty common error, but not able to find exactly what's wrong. I'm trying to use a custom module (built by someone else). I have the folder structure like this:</p>
<p><a href="https://i.sstatic.net/KF6Hg.png" rel="nofollow noreferrer"><img src="https://i.sst... | <python> | 2023-01-10 04:50:58 | 2 | 4,857 | M.R. |
75,065,483 | 668,498 | Python 3.10.7 Import Error ModuleNotFoundError: No module named '_bz2' | <p>I am trying to create a <code>Google Cloud Workstation</code> that has all of my required tooling built-in such as PHP, MYSQL and PYTHON with BZ2 support. I understand that this involves creating a custom container image. Here is the <code>Dockerfile</code> that I used:</p>
<pre><code>FROM us-central1-docker.pkg.dev... | <python><google-cloud-platform><apt-get><google-cloud-workstations> | 2023-01-10 04:27:50 | 2 | 3,615 | DanielAttard |
75,065,363 | 11,013,499 | why the output of curve fitting is not true? | <p>I am trying to fit a curve into my data. my function is polynomial order 3 as bellow:</p>
<pre><code>def objective3(x, a, b, c,d):
return a * x + b * x**2 + c * x**3 +d
y=center_1080[itr,:]
x=[1000 ,2000, 3000, 4000, 5000, 6000, 8000, 10000, 12000]
popt, pcov,info,msg, ier= curve_fit(objective3, x, y,full_output... | <python> | 2023-01-10 04:06:30 | 1 | 1,295 | david |
75,065,299 | 17,103,465 | Pandas remove duplicates within the list of values and identifying id's that share the same values | <p>I have a pandas dataframe :</p>
<p>I used to have duplicate test_no ; so I remove the duplicates by</p>
<pre><code>df['test_no'] = df['test_no'].apply(lambda x: ','.join(set(x.split(','))))
</code></pre>
<p>but still as you can see the duplicates are still there ; I think it's due to extra spaces and I want to clean... | <python><pandas> | 2023-01-10 03:52:37 | 1 | 349 | Ash |
75,065,276 | 5,928,682 | string manipulation in python for reading json object and '' removal | <p>I am trying to construct a role in AWS where I am trying to have list of resources.</p>
<p>Below is an example</p>
<pre><code>shared ={
"mts":{
"account_id":"11111",
"workbench":"aaaaa",
"prefix":"rad600-ars-sil,rad600-srr-s... | <python><python-3.x><amazon-web-services> | 2023-01-10 03:47:53 | 2 | 677 | Sumanth Shetty |
75,065,247 | 19,321,677 | How to get Effect Size from tt_ind_solve_power? | <p>I am trying to get the Effect Size given my alpha, power, sample size, ratio. I found tt_ind_solve_power to do this but how would this work for 4 variants + 1 control?</p>
<p>This is how I have it currently</p>
<pre><code>from statsmodels.stats.power import tt_ind_solve_power
effect_size = tt_ind_solve_power(nobs1=... | <python><scipy><statsmodels><scipy.stats> | 2023-01-10 03:43:25 | 1 | 365 | titutubs |
75,065,231 | 1,128,648 | Realtime data update to streamlit from python variable | <p>New to python world. I am trying to understand how to update realtime data in streamlit app.(Reference <a href="https://blog.streamlit.io/how-to-build-a-real-time-live-dashboard-with-streamlit/" rel="nofollow noreferrer">Blog</a>).</p>
<p>I am looping through the numbers 1 to 100, display the <code>number</code> al... | <python><streamlit> | 2023-01-10 03:40:43 | 1 | 1,746 | acr |
75,064,970 | 13,543,225 | How do I use a Semaphore with asyncio.as_completed in Python? | <p><strong>SETUP:</strong> I have a large list (over 100+) of tasks (coroutines) that connect to a REST API database server. The coroutines use a client connection pool. I think that the client connection pool is cutting me off, because I am not able to get all my results. I also think that I could use a Semaphore to l... | <python><python-asyncio><semaphore> | 2023-01-10 02:50:29 | 1 | 650 | j7skov |
75,064,949 | 11,402,025 | How to fix "No module named..." error in Sphinx? | <p>I am getting the following error :</p>
<pre><code>WARNING: autodoc: failed to import module 'create_alias' from module 'src.create_alias'; the following exception was raised:
No module named 'helpers'
</code></pre>
<p>Project Structure looks like</p>
<pre><code>project-1
|
|---src
|---create_alias
|---__init__.p... | <python><python-sphinx><autodoc> | 2023-01-10 02:46:34 | 0 | 1,712 | Tanu |
75,064,934 | 1,135,144 | Convert encryption function from Javascript to Python | <p>I'm trying to convert this code from Javascript to Python3:</p>
<pre><code>import crypto from 'crypto';
const secretKey = 'NgTriSCalcUltAbLoGResOnOuSeAKeSTraLryOuR'
function verifySignature(rawBody) {
const calculatedSignature = crypto
.createHmac('sha256', secretKey)
.update(rawBody, 'utf8')
.digest... | <javascript><python><python-3.x><cryptojs> | 2023-01-10 02:43:13 | 1 | 473 | Nacho Sarmiento |
75,064,821 | 5,928,682 | Json object export to environment variable in python returning string without "" | <p>I am creating a CDK stack using python.
Here I am exporting json object in to a linux environment as it is a clodebuild step.</p>
<pre><code>f"export SHARED=\"{json.dumps(shared)}\""
</code></pre>
<p>The only reason to use <code>\"</code> is i was getting an error for spaces with in the jso... | <python><amazon-web-services><aws-cdk> | 2023-01-10 02:19:11 | 3 | 677 | Sumanth Shetty |
75,064,768 | 5,510,818 | Trying to numerically match python Log-Mel Spectrogram in Accelerate / Swift | <p><a href="https://github.com/tanmayb123/OpenAI-Whisper-CoreML/pull/2" rel="nofollow noreferrer">I am working on a native port</a> of OpenAI's Whisper for macOS and iOS via CoreML and Accelerate / AVFoundation, and in doing so noticed numerical differences in my Log Mel Spectrogram and code Whispers.</p>
<p><a href="h... | <python><audio><fft><accelerate-framework><openai-whisper> | 2023-01-10 02:09:36 | 0 | 783 | vade |
75,064,727 | 13,994,829 | How to share dictionary memory in different process? | <p>Is it possible to share a dictionary variable in Python Multiprocess (<code>pathos.multiprocess</code>)?</p>
<p>I use the following code, however it doesn't work as expected.</p>
<p>I hope the <code>skus</code> be <code>{0: 0, 1: 1, ...}</code></p>
<pre><code>from pathos.multiprocessing import Pool as ProcessPool
d... | <python><dictionary><memory><multiprocessing><python-multiprocessing> | 2023-01-10 02:02:21 | 2 | 545 | Xiang |
75,064,699 | 14,057,599 | How to fill 2D binary Numpy array without using for loop? | <p>Suppose I have a Numpy array <code>a</code> and I want to fill the inner with all 1 like array <code>b</code></p>
<pre><code>print(a)
array([[0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[0., 0., 1., 1., 1., 1., 1., 0., 0., 0.],
[0., 1., 0., 1., 1., 1., 1., 1., 0., 0.],
[0., 1., 0., 0., 1., 0., 0., ... | <python><numpy> | 2023-01-10 01:56:41 | 2 | 317 | Qimin Chen |
75,064,656 | 18,758,062 | Printing Pytorch Tensor from gpu, or move to cpu and/or detach? | <p>I'm starting Pytorch and still trying to understand the basic concepts.</p>
<p>If I have a network <code>n</code> on the GPU that produces an output tensor <code>out</code>, can it be printed to stdout directly? Or should it first be moved to the cpu, or be detached from the graph before printing?</p>
<p>Tried sever... | <python><pytorch> | 2023-01-10 01:48:16 | 1 | 1,623 | gameveloster |
75,064,572 | 7,250,111 | How to download certain columns of a table using Selenium and Python? | <p>I want to get 2 columns(Symbol, Name) of a table on this website : <a href="https://www.nasdaq.com/market-activity/quotes/nasdaq-ndx-index" rel="nofollow noreferrer">https://www.nasdaq.com/market-activity/quotes/nasdaq-ndx-index</a>
<a href="https://i.sstatic.net/jDeoS.png" rel="nofollow noreferrer"><img src="https:... | <python><selenium> | 2023-01-10 01:32:38 | 1 | 2,056 | maynull |
75,064,415 | 3,362,334 | db.create_all() not generating db | <p>I'm trying to test Flask with SQLAlchemy and I stumbeld accross this problem. First, I have to note that I read all of the related threads and none of them solves my problem. I have a problem that db.create_all() doesn't generate the table I defined. I have model class in file person.py:</p>
<pre><code>from website ... | <python><flask><sqlalchemy> | 2023-01-10 00:58:50 | 2 | 2,228 | user3362334 |
75,064,356 | 5,431,132 | Using Numba njit with np.array | <p>I have two Python functions that I am trying to speed up with <code>njit</code> as they are impacting the performance of my program. Below is a MWE that reproduces the following error when we add the <code>@njit(fastmath=True)</code> decorator to
<code>f</code>. Otherwise it works. I believe the error is because the... | <python><numpy><numba><hpc> | 2023-01-10 00:43:36 | 2 | 582 | AngusTheMan |
75,064,347 | 491,894 | In python, when loading a yaml file, is it possible to delay evaluation of a value until a specific *different* key is set? | <p>I use <code>python</code> and <code>ruamel.yaml</code> to load a configuration file. I am currently allowing a [<code>!NETRC</code>][1] entry evaluated from the user's <code>.netrc</code> file when a password or token is needed.</p>
<p>This is working ok, but it can sometimes be frustrating when some functions take ... | <python><yaml><ruamel.yaml> | 2023-01-10 00:42:32 | 1 | 1,304 | harleypig |
75,064,251 | 15,171,387 | Random selection of value in a dataframe with multiple conditions | <p>Let's say I have a dataframe like this.</p>
<pre><code>import pandas as pd
import numpy as np
np.random.seed(0)
df = pd.DataFrame(np.random.choice(list(['a', 'b', 'c', 'd']), 50), columns=list('1'))
print(df.value_counts())
1
d 18
a 12
b 12
c 8
dtype: int64
</code></pre>
<p>Now, what I am trying is to d... | <python><pandas><dataframe><random><sampling> | 2023-01-10 00:21:59 | 2 | 651 | armin |
75,064,235 | 11,295,630 | Sklearn's One-Class SVM with separable Nu Parameter | <p>The existing One-Class Classification (OCC) model implementation from Sklearn (OneClassSVM) has a parameter (Nu) that handles both the upper bound of training errors and the lower bound of support vectors. I have data that has no training error, however, I still want support vectors. Is there any known Python imple... | <python><scikit-learn><svm><data-mining> | 2023-01-10 00:19:17 | 1 | 403 | Riley K |
75,064,169 | 2,687,317 | matplotlib subplots don't honor ylim | <p>I'm trying to create 9 subplots (3x3) <em><strong>all with the same x and y ranges</strong></em>. I setup the plots using this code, and all but the last subplot use the correct y-range (ylim).</p>
<pre><code>brightM = -22 # Plot range...
limitM = -14
dataIn = np.load("testLFdata.tst.npy",allow_pickle=Tr... | <python><matplotlib> | 2023-01-10 00:07:39 | 0 | 533 | earnric |
75,064,150 | 14,278,839 | Sort a list by index with default if index doesn't exist | <p>I have a 2 dimensional list. I want to sort this list by multiple criteria in the sublist, but provide a default if one of the chosen index criteria doesn't exist.</p>
<pre><code>my_list = [[5, 4], [1], [6, 8, 1]]
my_list.sort(key=lambda x: (x[0], x[1])
</code></pre>
<p>Obviously, this will throw an out of range er... | <python><list><sorting> | 2023-01-10 00:03:16 | 3 | 461 | YangTegap |
75,064,080 | 1,142,502 | Python error The truth value of a DataFrame is ambiguous | <p>My Python Pandas DF block is giving me the below error:</p>
<pre><code>The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
Traceback (most recent call last):
File "/var/task/lambda_function.py", line 58, in lambda_handler
df, charter, charter_filename = c... | <python><pandas> | 2023-01-09 23:49:09 | 3 | 427 | aki2all |
75,064,033 | 15,781,591 | How to bin values in python based on dynamic ranges? | <p>I have the following datafame, df1:</p>
<pre><code> ID Min_Value Max_Value
---------------------------------------
0 ID_1 100 150
1 ID_1 150 170
2 ID_2 80 105
3 ID_2 ... | <python><pandas><dataframe> | 2023-01-09 23:36:43 | 0 | 641 | LostinSpatialAnalysis |
75,064,024 | 996,815 | Code coverage for Python using Bazel 6.0.0 | <p>I want to generate a code coverage report using Bazel for a Python project (my environment: macOS Ventura, M1 arm64, Python 3.10, Bazel 6.0).</p>
<p>The <a href="https://bazel.build/configure/coverage#python" rel="nofollow noreferrer">documentation</a> states that for this task Bazel 6.0 and a modified version of <c... | <python><code-coverage><bazel><bazel-python> | 2023-01-09 23:35:22 | 0 | 7,859 | Vertexwahn |
75,063,930 | 3,647,167 | Adding columns for the closest lat/long in a reference list to existing lat/long | <p>I have a base dataframe (df_base) which contains my records and a lookup dataframe (df_lookup) containing a lookup list. I would like to find the closest lat/log in df_lookup to the lat/long in df_base and add them as columns. I am able to do this but it is very slow. df_base has over 1 million rows and df_lookup is... | <python><pandas><geospatial> | 2023-01-09 23:20:34 | 1 | 4,950 | Keith |
75,063,839 | 14,057,599 | How to use Numpy to compute the outer contour of binary image and fill inner area? | <p>I want to use Numpy (without any other packages) to find the outer contour of the 1st binary image and fill the inside area so it looks like the 2nd image, basically filling the holes of the wheels but I don't know how to do it. Does anyone have any ideas?</p>
<p><a href="https://i.sstatic.net/KGBg5.png" rel="nofoll... | <python><numpy> | 2023-01-09 23:06:16 | 1 | 317 | Qimin Chen |
75,063,761 | 8,322,295 | Can't get GridSearchCV working with Keras | <p>I'm trying to use <code>GridSearchCV</code> to optimise the hyperparameters in a custom model built with <code>Keras</code>. My code so far:</p>
<p><a href="https://pastebin.com/ujYJf67c#9suyZ8vM" rel="nofollow noreferrer">https://pastebin.com/ujYJf67c#9suyZ8vM</a></p>
<p>The model definition:</p>
<pre><code>def bui... | <python><tensorflow><machine-learning><keras><gridsearchcv> | 2023-01-09 22:51:15 | 1 | 1,546 | Jim421616 |
75,063,631 | 12,409,665 | py script stop after execute | <p>I have the following script:</p>
<pre><code>import time
from pynput import keyboard
from pynput.keyboard import Key, Listener
STATUS=False
COMBINATION={keyboard.Key.esc, keyboard.Key.alt}
# The currently active modifiers
current = set()
def on_press(key):
if key in COMBINATION:
current.add(key)
... | <python><python-3.x><pynput> | 2023-01-09 22:30:03 | 1 | 462 | Felipe |
75,063,570 | 16,978,074 | grouping a dictionary inside a list in python | <p>I've just been studying python and I'm having trouble doing some exercises. I have a list containing, I think, a dictionary:</p>
<pre><code>dictionary_title=[
{'Color': 'Green', 'ids': 878},
{'Color': 'Pink', 'ids': 16},
{'Color': 'Orange', 'ids': 28},
{'Color': 'Yellow', 'ids': 9648},
{'Color': 'Red', 'ids': 878},
... | <python><arrays><list><dictionary><grouping> | 2023-01-09 22:22:33 | 2 | 337 | Elly |
75,063,478 | 10,825,362 | how to debug python modules while developing | <p>Let's say we are developing a simple python module with the following directory structure</p>
<pre><code>.
├── module
│ ├── __init__.py
│ ├── core.py
│ └── helpers.py
└── test.py
</code></pre>
<p>contents of <strong>init</strong>.py</p>
<pre><code>#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from .core impo... | <python><python-module> | 2023-01-09 22:11:10 | 1 | 351 | IjonTichy |
75,063,390 | 12,285,078 | How can I load tf.data.dataset object into an autoencoder? | <p>I have been struggling with this issue for weeks now...
I more or less try to reproduce this code: <a href="https://github.com/mostafaibrahim17/Whole-Image-Slides-Unsupervised-Categorization/blob/master/Autoencoders/Convolutional%20Autoencoders/Basic%20Convolutional%20Autoencoder.ipynb" rel="nofollow noreferrer">htt... | <python><tensorflow><keras><deep-learning><tensorflow-datasets> | 2023-01-09 22:00:16 | 2 | 343 | chalbiophysics |
75,063,300 | 338,101 | Music21 - How to keep the time signature when transposing? | <p>I am trying to transpose to a common key (C major/A minor) like this:</p>
<pre class="lang-py prettyprint-override"><code>def main():
print("cwd=", os.getcwd())
path="midi/bachjs"
with os.scandir(path) as it:
for entry in it:
if entry.name.startswith("Minuet&q... | <python><transpose><midi><music21> | 2023-01-09 21:51:34 | 1 | 6,436 | smirkingman |
75,063,269 | 17,696,880 | Set a multichoice regex to make its matching attempts always from left to right, no matter if another previous regex tries to capture more chars? | <pre><code>import re
input_text = 'el dia corrimos juntas hasta el 11° nivel de aquella montaña hasta el 2022_-_12_-_13'
#input_text = 'desde el corrimos juntas hasta el 11° nivel de aquella montaña y luego bajamos hasta la salida, hasta el 2022_-_12_-_01 21:00 hs caminamos juntas' #example 2
date_format = r"... | <python><python-3.x><regex><regex-group><regex-greedy> | 2023-01-09 21:47:39 | 1 | 875 | Matt095 |
75,063,264 | 1,550,811 | Docker [Errno 13] Permission denied with custom user | <p>I am trying to create a docker image and here is my current <code>Dockerfile</code>.</p>
<p><strong>Dockerfile:</strong></p>
<pre><code>FROM path-to-internal-images/python:3.8
RUN adduser --system myuser
WORKDIR /home/myuser
COPY requirements.txt .
RUN pip install -i https://myendpoint/api/pypi/pypi-abc/simple -r re... | <python><docker><dockerfile> | 2023-01-09 21:46:35 | 0 | 1,543 | Learner |
75,063,220 | 16,589,029 | Django changing date format is not working | <p>I decided to change the date format from <code>YYYY-mm-dd</code> to <code>%d %b %Y</code> something like <code>10 Jan 2023</code></p>
<p>However, i have tried many things and it all seem to fail, let's start with settings.py:</p>
<pre><code>LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = False
USE_TZ = True
... | <python><django><datetime><django-rest-framework> | 2023-01-09 21:41:43 | 1 | 766 | Ghazi |
75,063,069 | 480,118 | VSCode multi-project workspace: how to add individual files such as the .gitignore at the root of the workspace? | <p>I have the following folder structure..where _app, and _infra are two different projects. At the root of the workspace however are two files, the workspace project file itself and a .gitignore file.
Each project has it's own .vscode folder and own .env files.
The entire workspace is a single repository in git.</p>
... | <python><git><visual-studio-code> | 2023-01-09 21:23:49 | 2 | 6,184 | mike01010 |
75,063,000 | 6,423,456 | Is it possible to have Python sort data the same was PostgreSQL does? | <p>My PostgreSQL DB appears to be using <code>en_US.UTF-8</code> collation:</p>
<pre class="lang-bash prettyprint-override"><code># SHOW lc_collate;
lc_collate
-------------
en_US.UTF-8
</code></pre>
<p>If I have a list of strings like: <code>['C - test', 'Common Scope']</code>, and I sort them in Python, I get:</p... | <python><postgresql> | 2023-01-09 21:15:22 | 1 | 2,774 | John |
75,062,929 | 11,809,811 | changing the color the tkinter title bar on macOS | <p>I have an app and want to change the color of the title bar. I can do that on windows with the following code:</p>
<pre><code>import tkinter as tk
from ctypes import windll, byref, sizeof, c_int
root = tk.Tk()
root.update()
HWND = windll.user32.GetParent(root.winfo_id())
DWMWA_ATTRIBUTE = 35
COLOR = 0x000000FF # ... | <python><macos><tkinter> | 2023-01-09 21:07:40 | 0 | 830 | Another_coder |
75,062,897 | 1,171,746 | How to have typing support for a static property (using a decorator) | <p>Given a static property decorator:</p>
<pre class="lang-py prettyprint-override"><code>class static_property:
def __init__(self, getter):
self.__getter = getter
def __get__(self, obj, objtype):
return self.__getter(objtype)
@staticmethod
def __call__(getter_fn):
return stati... | <python><design-patterns><static><python-decorators><python-typing> | 2023-01-09 21:03:32 | 1 | 327 | Amour Spirit |
75,062,621 | 726,802 | Issue while trying to select record in mysql using Python | <p><strong>Error Message</strong></p>
<blockquote>
<p>You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use
near '%s' at line 1</p>
</blockquote>
<p><strong>MySQL Database Table</strong></p>
<pre><code>CREATE TABLE `tblorders` (
`order_id` i... | <python><mysql> | 2023-01-09 20:30:38 | 2 | 10,163 | Pankaj |
75,062,500 | 6,057,371 | Pandas dataframe expand rows in specific times | <p>I have a dataframe:</p>
<pre><code>df = T1 C1
01/01/2022 11:20 2
01/01/2022 15:40 8
01/01/2022 17:50 3
</code></pre>
<p>I want to expand it such that</p>
<ol>
<li>I will have the value in specific given times</li>
<li>I will have a row for each round timestamp</li>
</ol>
<p>So if ... | <python><pandas><dataframe><ffill> | 2023-01-09 20:18:03 | 3 | 2,050 | Cranjis |
75,062,480 | 12,945,785 | how to get the sum of a dataframe by month/year | <p>I have a data frame that consists of :</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th style="text-align: left;">DATE</th>
<th style="text-align: right;">X.</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">1982-09-30 00:00:00</td>
<td style="text-align: right;">0</td>
</tr>... | <python><pandas> | 2023-01-09 20:15:10 | 3 | 315 | Jacques Tebeka |
75,062,429 | 1,226,649 | NetworkX: Subgraph matching | <p>Trying to match a Query subgraph to a Target graph, where:</p>
<p>Query:</p>
<p><a href="https://i.sstatic.net/MxT29.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/MxT29.png" alt="enter image description here" /></a></p>
<p>and Target:</p>
<p><a href="https://i.sstatic.net/r5l91.png" rel="nofollow no... | <python><graph><networkx> | 2023-01-09 20:09:24 | 0 | 3,549 | dokondr |
75,062,344 | 2,798,289 | Python pandas group by, transform multiple columns with custom conditions | <p>I have dataframe containing 500k+ records and I would like to group-by multiple columns (data type of string and date) and later pick only few records inside each group based on custom condition.</p>
<p>Basically, I need to group the records (by <code>first_roll_up</code>, <code>date</code>, <code>granular_timestamp... | <python><pandas><dataframe><dask> | 2023-01-09 19:59:26 | 2 | 2,522 | Govind |
75,062,303 | 17,718,587 | Detecting the pressed keys in multi-languages in Psychopy | <p>I'm creating an experiment where I loop/finish a loop depending on the clicked key.</p>
<p>The example below continues the loop when the participant presses the <code>r</code> key. When the participant presses the <code>p</code> or <code>q</code> key, the loop is finished:</p>
<pre class="lang-py prettyprint-overrid... | <python><psychopy> | 2023-01-09 19:55:44 | 1 | 2,772 | ChenBr |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.