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,759,646 | 127,670 | Are prepared statements supported with Azure Cosmos Cassandra API? | <p>Are prepared statements supported with Azure Cosmos Cassandra API with Python?</p>
<p>It <em>appears</em> not - when I execute</p>
<pre><code>stmt = session.prepare("SELECT provider FROM providers WHERE country_code=?")
</code></pre>
<p>I get the following exception:</p>
<pre><code>Traceback (most recent c... | <python><azure-cosmosdb><azure-cosmosdb-cassandra-api> | 2023-03-16 17:24:51 | 2 | 6,235 | Ian Goldby |
75,759,641 | 13,039,962 | Issues avoiding division by zero in pandas | <p>I have this df:</p>
<pre><code> A B
0 2 8
1 3 1
2 5 0
3 -1 2
4 2 1
5 3 0
.. .. ..
</code></pre>
<p>I want to calculate <code>((df['B']-df['A'])/df['B'])*100</code> in a new column so i did this code to avoid division by zero:</p>
<pre><code>if data['B']!=0:
data['D%']=((data['B']-data['A'])/d... | <python><pandas> | 2023-03-16 17:24:17 | 2 | 523 | Javier |
75,759,564 | 12,845,199 | Flag element in groupby if it is equal to his sucessor in next row | <p>I have the following df</p>
<pre><code>df = pd.DataFrame(
{'id':[1,1,1,2,2,2,3,3,3],
'value':['pot','pot','jebus','pot','jebus','pot','pot','jebus','jebus']})
</code></pre>
<p>What I want to do is to identify if an id contains repetitive values but only if a row is followed by another row with the same value. So if ... | <python><pandas> | 2023-03-16 17:17:44 | 2 | 1,628 | INGl0R1AM0R1 |
75,759,563 | 1,258,509 | How to create multiple models from a single endpoint w/ Django RF | <p>I want to have an single endpoint that accepts a POST request and creates an "Order" that can be one of two types. The User should be able to submit an order (of either type) as JSON, and create a new Order.</p>
<p>Behind the scenes, two models are created. One "Base Order" Model that describes ... | <python><django><django-rest-framework><model> | 2023-03-16 17:17:44 | 3 | 1,467 | Brian C |
75,759,544 | 10,192,593 | Joining two multi-dimentional arrays by adding a new dimention in Python | <p>Let's say I have two arrays of shape (3,2,3)</p>
<pre><code>a = np.array([[[1,2,3],[4,5,6]],[[7,8,9],[10,11,12]],[[13,14,15],[16,17,18]]])
b = np.array([[[1,2,3],[4,5,6]],[[7,8,9],[10,11,12]],[[13,14,15],[16,17,18]]])
a.shape
b.shape
</code></pre>
<p>I would like to join these two arrays by adding a new dimention to... | <python><numpy> | 2023-03-16 17:16:22 | 1 | 564 | Stata_user |
75,759,542 | 13,340,923 | How to catch errors/exception in gekko when you have an infeasible solution? | <p>I am getting a <code>Exception: @error: Solution Not Found</code> with gekko. By using <code>disp=True</code>.
I got more details : <code>Unsuccessful with error code 0</code> and
<code>Warning: no more possible trial points and no integer solution Maximum iterations</code>. <br/>
I was checking the docum... | <python><nonlinear-optimization><gekko> | 2023-03-16 17:16:15 | 1 | 375 | ElVincitore |
75,759,437 | 1,107,226 | How to print text with specific format to a printer in Python? | <p>I am printing a text string to a printer like so:</p>
<pre class="lang-py prettyprint-override"><code>import os
string_value = 'Hello, World!'
printer = os.popen('lpr -P Canon_iP110_series', 'w')
printer.write(string_value)
printer.close()
</code></pre>
<p>This works perfectly, printing the text to the printer in ... | <python><text><printing> | 2023-03-16 17:07:20 | 1 | 8,899 | leanne |
75,759,382 | 8,068,733 | ImportError: cannot import name 'runtime' in OpenVINO | <p>I am trying to run the openvino notebook for object detection task as follows</p>
<pre><code>from openvino import runtime as ov
</code></pre>
<p>But I get the following error</p>
<pre><code>---------------------------------------------------------------------------
ImportError Traceback... | <python><machine-learning><intel><openvino> | 2023-03-16 17:02:31 | 2 | 3,135 | Ashok Kumar Jayaraman |
75,759,348 | 14,349,010 | Using weights and biases for storing pytorch experiments of different architectures | <p>following the basic pytorch <a href="https://pytorch.org/tutorials/beginner/blitz/cifar10_tutorial.html" rel="nofollow noreferrer">tutorial</a>, I'm trying to experiment with different CNN architectures (different number of layers, channels per layer, etc.) and I want to be organized so I'm trying to use <code>wandb... | <python><machine-learning><pytorch><wandb><python-inspect> | 2023-03-16 16:59:20 | 1 | 373 | Ariel Yael |
75,759,146 | 19,980,284 | Convert dataframe from wide to long format on multiple columns with differing names | <p>I have a dataframe with shape 500x200 and I'd like to pivot/melt it based on a subset of the columns. Here is an example test dataframe where I have and <code>id</code> column, three <code>case</code> columns, and an additional column with data for each id.</p>
<pre class="lang-py prettyprint-override"><code>pd.Data... | <python><pandas><dataframe><pivot><melt> | 2023-03-16 16:42:05 | 1 | 671 | hulio_entredas |
75,758,944 | 6,494,707 | Manual weight updates: torch.autograd returns none, why? | <p>I am new to pytorch and it may sound a simple question, sorry for that. I have written a function that updates the parameters of a network manually:</p>
<pre><code>def update_params(self, loss, update_lr):
# parameter update
updated_params = OrderedDict()
for name, param in self.graph_model.g... | <python><deep-learning><pytorch><torchvision><pytorch-geometric> | 2023-03-16 16:22:15 | 0 | 2,236 | S.EB |
75,758,917 | 2,100,039 | DLL load failed while importing _netCDF4 in Python | <p>I am trying to download and plot NCAR reanalysis data that requires importing the netCDF4 module. Here is the link to a python program similar to mine used to plot this NCAR .nc data below.
<a href="https://geoclimatologyblog.wordpress.com/2016/04/24/plot-highs-and-lows-in-a-ncepncar-reanalysis-slp-file-with-python/... | <python><netcdf4> | 2023-03-16 16:19:21 | 0 | 1,366 | user2100039 |
75,758,845 | 1,112,325 | Convert string to date with multiple formats | <p>I have dates in the following format in the same file:</p>
<pre><code>"%m/%d/%Y" --> YEAR with 4 digits
"%m/%d/%y" --> YEAR with 2 digits
</code></pre>
<p>I want to be able to parse both formats. Here's my attempt:</p>
<pre><code>df[["field1", "field2"]] = pd.to_datetime... | <python><pandas><date><datetime> | 2023-03-16 16:12:44 | 1 | 3,037 | briba |
75,758,669 | 12,944,030 | ERROR when running airflow task: Log file does not exist Failed to fetch log file from worker. Request URL is missing an http:// or https:// protocol | <p>I am running a DAG in airflow (Docker compose ) containing a</p>
<ul>
<li>DummyOperator : start</li>
<li>PythonOperator : simple python function to print text</li>
<li>DummyOperator : end</li>
</ul>
<p><a href="https://i.sstatic.net/ScbUc.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ScbUc.png" alt=... | <python><airflow> | 2023-03-16 15:58:17 | 1 | 349 | moe_ |
75,758,644 | 913,098 | How to check for existence of multiple keys in s3 bucket in boto3? | <p>I have a long list of keys I want to check for existence in s3. They have different prefixes, and I want this to be fast, thus checking one by one won't do the trick.</p>
<p><a href="https://stackoverflow.com/a/38376288/913098">This</a> checks one by one<br />
<a href="https://stackoverflow.com/a/34562141/913098">Th... | <python><amazon-web-services><amazon-s3><boto3> | 2023-03-16 15:56:28 | 0 | 28,697 | Gulzar |
75,758,625 | 13,916,049 | How to match the index of a dataframe with a column of another dataframe and replace it with the values of an adjacent column? | <p>If the "Composite_Element_REF" column values of the <code>sym</code> dataframe matches the index of <code>df_normal_symbol</code>, I want to replace the index of <code>df_normal_symbol</code> with the adjacent column in the <code>sym</code> dataframe, i.e., the <code>Gene_Symbol</code> column.</p>
<pre><co... | <python><pandas><dataframe> | 2023-03-16 15:55:10 | 1 | 1,545 | Anon |
75,758,581 | 11,968,226 | Python convert two lines of Excel to CSV without row or column numbers | <p>I want to convert a <code>xlsx-file</code> to <code>.csv</code>. I tried it with this function:</p>
<pre><code>def excel_to_csv(excel_file, csv_file):
# read Excel file into pandas dataframe
df = pd.read_excel(excel_file)
# write dataframe to CSV file
df.to_csv(csv_file, index=False, header=False)
<... | <python><excel><csv><export-to-csv> | 2023-03-16 15:51:39 | 1 | 2,404 | Chris |
75,758,568 | 80,544 | Will using time.sleep(1) in a loop block other routes in my FastAPI server? | <p>I have a route that sends a number of emails. To avoid rate limits, I am using <code>time.sleep(1)</code> between emails. If I understand correctly, the route will run in its own thread or coroutine and this will not block other requests, but I thought it would be good to confirm this with the community. Here is a c... | <python><fastapi><blocking> | 2023-03-16 15:51:01 | 2 | 5,161 | Glenn |
75,758,516 | 11,232,438 | Why my json is not loading if I have all lines delimited? | <p>I'm trying to load a sample json:</p>
<pre><code>{
"bot_token": "##############################",
"GOOGLE_APPLICATION_CREDENTIALS": "assets/firebase-adminsdk.json",
"databaseURL": "https://########-default-rtdb.firebaseio.com/",
"storageBucket&... | <python><json> | 2023-03-16 15:46:55 | 1 | 745 | kuhi |
75,758,436 | 2,011,284 | Set TTL for Supervisor jobs | <p>I've been using Supervisor for over a year now to run 40 jobs on a project.<br />
Today, without any changes to the code or the server, two jobs got stuck, which caused some problems to the services I provide to my customers.</p>
<p>These jobs are very light, written in Python, and they usually process the workload ... | <python><supervisord> | 2023-03-16 15:39:51 | 1 | 4,927 | CIRCLE |
75,758,203 | 10,242,641 | Assign Group ID Based on Time Interval PySpark | <p>I have a PySpark data frame like the following (snap - i can have multiple dates)</p>
<pre><code>UID Time
1 10/1/2016 7:25:52 AM
1 10/1/2016 8:53:38 AM
1 10/1/2016 11:18:50 AM
1 10/1/2016 11:19:32 AM
2 10/1/2016 10:25:36 AM
2 10/1/2016 10:28:08 AM
3 10/1/2016 10:57:41 AM
3 10/1/2016 8:57:10 PM
</code... | <python><apache-spark><pyspark> | 2023-03-16 15:17:50 | 1 | 391 | mht |
75,758,195 | 1,008,883 | SqlAlchemy TEXT is not defined | <p>I recently discovered an issue where a query I wanted to run on MS SQL Server was not executing with an error <code>Textual SQL expression '\n SELECT CONVE...' should be explicitly declared as text('\n SELECT CONVE...')</code></p>
<p>This seemed fairly straightforward that I just need to cast the query as text. I've... | <python><sqlalchemy> | 2023-03-16 15:17:39 | 0 | 644 | jackie |
75,758,160 | 11,913,986 | compare columns with list of string values in two different df and return ID which has the highest match between the lists | <p>I have a pyspark dataframe 'jobs' like this:</p>
<pre><code> jobs=
id position keywords
5663123 A ["Engineer","Quality"]
5662986 B ['Java']
5663237 C ['Art', 'Paint', 'Director']
5663066 D ["Junior","Motion","Designer"]
5663039 E ['Junior', 'Designer... | <python><python-3.x><dataframe><apache-spark><pyspark> | 2023-03-16 15:15:17 | 1 | 739 | Strayhorn |
75,757,890 | 2,340,703 | Python overload single argument | <p>Let's assume I have a function with many arguments, e.g.</p>
<pre class="lang-py prettyprint-override"><code>import pandas as pd
def f(df: pd.DataFrame, a: int, b: int, c: int, d: int, inplace: bool = True) -> Optional[pd.DataFrame]:
raise NotImplementedError
</code></pre>
<p>The function will modify the dat... | <python><overloading><python-typing> | 2023-03-16 14:49:41 | 1 | 2,950 | Gregor Sturm |
75,757,786 | 113,586 | Getting the base class in a descriptor called via super() | <p>I have a following (simplified of course) descriptor:</p>
<pre class="lang-py prettyprint-override"><code>class d:
def __init__(self, method):
self.method = method
def __get__(self, instance, owner=None):
print(instance, owner, self.method)
return self.method(instance)
</code></pre>
... | <python><inheritance><python-descriptors> | 2023-03-16 14:41:06 | 1 | 25,704 | wRAR |
75,757,778 | 4,942,661 | Is there an equivalent pip command for poetry? | <p>I need to install a package with a flag using pip I run <code>pip3 install snowflakedb-snowflake-connector-python --no-use-pep517</code></p>
<p>but as the project is using poetry to manage de dependencies how can I run the same as pip?</p>
<p>I tried <code>poetry add snowflake-connector-python --extras ["--no-u... | <python><pip><snowflake-cloud-data-platform><python-poetry> | 2023-03-16 14:40:33 | 0 | 1,022 | Italo Lemos |
75,757,585 | 11,572,712 | hasura.io - connect postgres database - what is the correct database URL? | <p>Currently I am trying to create a GraphQL API and I would like to connect to a already running postgreSQL database.
I was looking for the connection settings in pgadmin and found the following:
Hostname: localhost
Port: 5432
Username: postgres
Password: postgres
Database: SuperMart_DB</p>
<p>I tried to connect and i... | <python><database><postgresql><hasura> | 2023-03-16 14:22:28 | 0 | 1,508 | Tobitor |
75,757,548 | 4,151,075 | Decode 32bit float with decade exponent | <p>I have this definition of a binary data (received from ModBus):</p>
<pre><code>Signed Measurement (32 bit):
Decade Exponent (Signed 8 bit)
Binary Signed value (24 bit)
Example: - 123456*10-3 = FDFE 1DC0(16)
</code></pre>
<p>I was trying to use <code>struct.unpack</code> to get the actual float from the binary d... | <python> | 2023-03-16 14:20:26 | 0 | 1,269 | Marek |
75,757,540 | 2,636,044 | Partial unpacking of kwargs | <p>Let's say I have a the following classes (consider that the classes have a couple more attributes, this is abbreviated for simplicity):</p>
<pre><code>class City:
def __init__(self, name=None, people=None, population=0):
self.name: str = name
self.people: Optional[List[Person]] = people
self.population... | <python> | 2023-03-16 14:19:52 | 1 | 1,339 | Onilol |
75,757,472 | 731,351 | Create a new column based on condition/comparison of two existing columns in Polars | <p>I am trying to create a new column in Polars data frame based on comparison of two existing columns:</p>
<pre class="lang-py prettyprint-override"><code>import polars as pl
df = pl.from_repr("""
βββββββ¬ββββββ
β a β b β
β --- β --- β
β i64 β i64 β
βββββββͺββββββ‘
β 2 β 20 β
β 30 β 3 β
βββββββ΄β... | <python><dataframe><python-polars> | 2023-03-16 14:13:37 | 1 | 529 | darked89 |
75,757,008 | 19,067,218 | Python throws "TypeError: 'module' object is not callable" whyle importing the selenium | <p>I'm trying to import selenium to start a scratch project but getting error constantly, I have tried couple of solution but non has worked for me</p>
<pre><code>from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
driver = webdriver.chrome()
drive... | <python><selenium-webdriver> | 2023-03-16 13:34:02 | 1 | 344 | llRub3Nll |
75,756,942 | 9,021,547 | Python inequality join with group by | <p>I have the following two dataframes</p>
<pre><code>import pandas as pd
dates = ['31-12-2015', '31-12-2016', '31-12-2017', '31-12-2018']
df1 = pd.DataFrame({'id': [1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4],
't': dates*4,
'stage': [1,2,2,3,1,1,2,3,1,1,1,3,2,1,1,3]})
df2 = df1.loc[df1['... | <python><group-by><left-join> | 2023-03-16 13:28:40 | 1 | 421 | Serge Kashlik |
75,756,705 | 14,427,209 | Getting error when trying to install some python packages in Amazon EC2 instance | <p>I am trying to install some packages from our requirements.txt file. But we are constantly seeing the below error. Any guidance on how to resolve it? Maybe some error in preshed or blis packages? Any dependencies we have to preinstall here? We have Python 3.7.9 installed. It's in 64 Bit.</p>
<pre><code> /... | <python><python-3.x><amazon-web-services><ubuntu><package> | 2023-03-16 13:08:13 | 0 | 317 | TECH FREEKS |
75,756,665 | 11,192,976 | How to make Pylance understand Pydantic's `allow_population_by_field_name` for initializers? | <p>In my current project, we are using an OpenAPI-to-TypeScript-API generator, that generates automatically typed functions for calling API endpoints via Axios. In Python, we use <code>snake_case</code> for our class properties, while in TypeScript we use <code>camelCase</code>.</p>
<p>Using this setup, we have found t... | <python><python-typing><pydantic><pyright> | 2023-03-16 13:05:04 | 1 | 1,565 | Sebastian |
75,756,601 | 2,729,627 | Is the Python garbage collection not working? Problematic processing of enormous XML files | <p>I'm trying to process a 4.6GB XML file with the following code:</p>
<pre><code>context = ET.iterparse(file_name_data, events=("start", "end"))
in_pandcertificaat = False
pandcertificaat = {}
pandcertificaten = []
number_of_pickles = 0
for index, (event, elem) in enumerate(context):
if event ... | <python><pandas><xml><large-data> | 2023-03-16 12:57:49 | 0 | 715 | Adriaan |
75,756,535 | 10,164,750 | psycopg2 execute_values - Update Query with Multiple Place holder - Throwing error - column is of type date but expression is of type text | <p>I am trying to replicate the answer provided by @jjanes to handle one of the <code>UPDATE</code> scenario.</p>
<p><a href="https://stackoverflow.com/questions/70470868/psycopg2-execute-values-the-query-contains-more-than-one-s-placeholder">Psycopg2 execute values -the query contains more than one '%s' placeh... | <python><sql><postgresql><psycopg2> | 2023-03-16 12:51:48 | 1 | 331 | SDS |
75,756,299 | 11,198,671 | Covering a 2D plotting area with lattice points | <p>My goal is to cover the plotting area with lattice points.</p>
<p>In this example we are working in 2D. We call the set Ξ β R^2 a lattice if there exists a basis B β R^2 with Ξ = Ξ(B). The set Ξ(B) is a set of all integer linear combinations of the basis vectors, so Ξ(B) = {x<em>b1 + y</em>b2 | x,y integers}.</p>
<p... | <python><algorithm><matplotlib><plot><mathematical-lattices> | 2023-03-16 12:29:28 | 1 | 345 | jupiter_jazz |
75,756,180 | 3,909,896 | Upgrade Python patch version from 3.8.10 to 3.8.16 on Windows without binary installers | <p>According to the <a href="https://www.python.org/downloads/release/python-3816/" rel="nofollow noreferrer">docs</a>, 3.8.10 was the last Python 3.8 version with binary installers. I need to install 3.8.16 on my local system. So I installed 3.8.10 first and then wanted to upgrade.</p>
<p>After unzipping + extracting ... | <python> | 2023-03-16 12:19:55 | 0 | 3,013 | Cribber |
75,755,958 | 848,746 | curl to python requests conversion for solr query | <p>I have a bit of a bizzare problem. I have a solr index, which I query using curl like so:</p>
<pre><code>curl 'http://localhost:8984/solr/my_index/select?indent=on&q="galvin%20life%20sciences"~0&wt=json&sort=_docid_%20desc&rows=5'
</code></pre>
<p>and I get (note the <code>q</code> string a... | <python><curl><python-requests><solr> | 2023-03-16 11:58:27 | 1 | 5,913 | AJW |
75,755,923 | 50,065 | pip install gives ResolutionImpossible: the user requested flax 0.6.8 but t5x depends on flax 0.6.8 | <p>I am trying to a requirements file that depends on versions of the packages <code>flax</code> and <code>t5x</code> at specific commits.</p>
<p>The problem can be reproduced with the following command:</p>
<pre><code>pip install "flax @ git+https://github.com/google/flax@ccf48a62acafd1f8658d60e21457c4bb57b25b95&... | <python><pip><dependency-management><flax> | 2023-03-16 11:55:10 | 0 | 23,037 | BioGeek |
75,755,801 | 19,336,534 | Changing column values in python | <p>I have a dataframe of shape:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>Col1</th>
<th>Col2</th>
</tr>
</thead>
<tbody>
<tr>
<td>0.3</td>
<td>1</td>
</tr>
<tr>
<td>0.22</td>
<td>0</td>
</tr>
<tr>
<td>0.89</td>
<td>0</td>
</tr>
<tr>
<td>0.12</td>
<td>1</td>
</tr>
<tr>
<td>0.54</td>
<t... | <python><python-3.x><pandas><dataframe> | 2023-03-16 11:43:40 | 1 | 551 | Los |
75,755,772 | 6,532,300 | TypeError("__init__() got an unexpected keyword argument 'phonemes'") with NeMo | <p>I'm trying to run a skript based on NeMo and am stuck with this error</p>
<pre><code>File "use_me.py", line 7, in <module>
spec_generator = FastPitchModel.restore_from(model_path)
File "/data/fburkhardt/tts/fastpitch_nemo/venv/lib/python3.8/site-packages/nemo/core/classes/modelPT.py",... | <python> | 2023-03-16 11:40:19 | 1 | 313 | Felix Burkhardt |
75,755,766 | 11,680,331 | Python local imports still not working: ModuleNotFoundError or ImportError | <p>How can I import <code>src/constants.py</code> from within <code>src/data/compute_embeddings.py</code>?</p>
<h3>Project structure</h3>
<p>I have the following project structure:</p>
<pre><code>.
βββ data
βΒ Β βββ raw
βΒ Β βββ sample.xlsx
βββ __init__.py
βββ notebooks
βΒ Β βββ clustering.ipynb
βββ src
βββ consta... | <python><module><python-import><importerror><file-structure> | 2023-03-16 11:39:36 | 0 | 847 | Joris Limonier |
75,755,691 | 16,343,968 | Confused about decimal precision in Python | <p>I use the Python decimal module to get around the floating point error. And from what I understand, I can set how many decimal places the decimal can have by setting the precision in the context. But I recently discovered that my understanding of the decimal precision is likely wrong as this is what happens when I r... | <python><python-3.x><python-decimal> | 2023-03-16 11:32:43 | 1 | 830 | Vladislav KoreckΓ½ |
75,755,441 | 11,318,472 | Why does saving `to_netcdf` without `encoding=` change some values to `nan`? | <p>I'm struggling to understand a problem in my code when saving a <code>xarray.DataSet</code> as <code>netCDF</code>. The file does not contain any <code>nan</code> values. However after saving and loading it suddenly does for one value:</p>
<ol>
<li><p>Before: no <code>nan</code> in the original data before saving:</... | <python><python-xarray><netcdf4> | 2023-03-16 11:10:57 | 1 | 1,319 | euronion |
75,755,367 | 848,510 | Unable to save data using pyarrow to gcs | <p>I am trying to save a data frame to GCS bucket, and it fails with the below error:</p>
<blockquote>
<p>TypeError: <strong>cinit</strong>() got an unexpected keyword argument
'existing_data_behavior'</p>
</blockquote>
<p>The code I try to use for saving the data is:
pd_df is the pandas dataframe which I am trying to ... | <python><google-cloud-platform><parquet><pyarrow><google-cloud-storage> | 2023-03-16 11:04:25 | 0 | 3,340 | Tom J Muthirenthi |
75,755,232 | 17,157,092 | How to avoid iterating over dataframe rows | <p>I have a dataframe <code>df</code> with columns 'Name', 'Date' and 'Id'. The 'Id' column is initially all 0 and I want to populate it as follows: the rows that have the same 'Date' and <code>same_names(name_i, name_j) == True</code> take the same Id.</p>
<p>I managed to do it with a for-loop which goes over the rows... | <python><pandas><dataframe><vectorization> | 2023-03-16 10:52:19 | 2 | 302 | orbit |
75,755,045 | 4,742,411 | PyQt6.QWidgets has no attribute qApp | <p>I am migrating (someone else his) code from pyqt5 to pyqt6 and the following code is giving me an error:</p>
<pre><code>def quitApp(self):
""" Exit application callback """
QtWidgets.qApp.quit
</code></pre>
<p>It seems that this no longer works in pyqt6 (I get the error ... | <python><pyqt><pyqt6> | 2023-03-16 10:37:50 | 1 | 1,065 | user180146 |
75,755,039 | 18,481,179 | polars and applying a UDF by column | <p>Importing text into a polars series arranges data in columns, which is what make polars (arrow) so efficient. The method <code>map_batches</code> will calculate a user-defined function (UDF) across rows but not columns. So I am in search of the fastest method to apply my UDF across each column.</p>
<p>This does what... | <python><python-polars> | 2023-03-16 10:37:03 | 1 | 339 | Sam |
75,754,951 | 11,235,205 | Pandas: how to turn time-series rows into a contiguous set of columns? | <p>I have a table that stores the steps by that an item is transferred (purposely made in Python Pandas for ease of reproduction):</p>
<pre class="lang-sql prettyprint-override"><code>import pandas as pd
df = pd.DataFrame([
(1, 1, '2023-01-01 00:00:00', 'Arrive in Warehouse', 'PS5'),
(2, 1, '2023-02-01 00:00:00', 'Pack... | <python><pandas> | 2023-03-16 10:31:22 | 3 | 2,779 | Long Luu |
75,754,842 | 4,432,671 | NumPy: argsort to give row-only permutation? | <p>I can use <code>np.argsort()</code> to create a permutation which if used as an indexing expression returns elements in order:</p>
<pre><code>>>> a = np.array([9, 3, 5, 2, 5, 1, 0, 8])
>>> idx = np.argsort(a)
>>> a[idx]
array([0, 1, 2, 3, 5, 5, 8, 9])
</code></pre>
<p>All well and good. No... | <python><numpy> | 2023-03-16 10:19:46 | 1 | 3,737 | xpqz |
75,754,735 | 11,328,614 | GET/POST request with additional non named parameter using python requests | <p>I'm currently dealing with the implementation of a Anel Power Outlet manager. The Anel power outlet supports the following requests:
<a href="https://forum.anel.eu/viewtopic.php?f=52&t=888&sid=39081b8e472aaae7ffcec4cd3fb41e83" rel="nofollow noreferrer">https://forum.anel.eu/viewtopic.php?f=52&t=888&s... | <python><python-3.x><python-requests><httprequest><positional-argument> | 2023-03-16 10:10:28 | 2 | 1,132 | WΓΆr Du Schnaffzig |
75,754,711 | 11,760,835 | Embed SpoutGL receiver in Qt widget | <p>I'm trying to embed a SpoutGL (<a href="https://github.com/jlai/Python-SpoutGL" rel="nofollow noreferrer">link to bindings</a>) program that receives graphics into a Qt (PySide6) window.
How can I do that?</p>
<p>The only example I have found uses PyGame to create a surface and then a image of it is converted into a... | <python><opengl><pyqt><pyside><spout> | 2023-03-16 10:08:26 | 0 | 394 | Jaime02 |
75,754,655 | 17,034,564 | Scrape pdfs links from dynamic content in div in Python with Selenium | <p>I am trying to scrape some PDFs' links from the <a href="https://www.bundestag.de/protokolle" rel="nofollow noreferrer">Bundestag's website</a>.
There is an <a href="https://stackoverflow.com/questions/54633910/find-dynamic-content-in-div-not-iframe-python-selenium">old question</a> regarding the same very issue, bu... | <python><selenium-webdriver><web-scraping><css-selectors><webdriverwait> | 2023-03-16 10:03:56 | 2 | 678 | corvusMidnight |
75,754,609 | 4,730,164 | Set style for pandas without changing its type | <p>I would like to change the style of my pandas without changing its type</p>
<p>Here a small example</p>
<pre><code>import pandas as pd
df = pd.DataFrame([[19, 439],[19, 439]], columns=['COOL','NOTCOOL'])
def colour_col(col):
if col.name == 'COOL':
return ['background-color: red' for c in col.values]... | <python><pandas><dataframe> | 2023-03-16 10:00:42 | 1 | 753 | olivier dadoun |
75,754,471 | 6,653,706 | How to interact trought a UI with a python script | <p>I created a prototype of a small rover with a raspberry, using python I created a script that allows me to move it simply by pressing a few keys on the keyboard.</p>
<p>The script essentially waits for a key to be pressed to "command" the rover motors, the code works through a terminal shell, now what I wo... | <python><java><android><html> | 2023-03-16 09:48:15 | 1 | 1,117 | Mattia |
75,754,443 | 1,780,761 | Python: copy file to clipboard | <p>I need a way to copy a PNG image with its known path to the windows clipboard. My program has a list of files, when one is selected a button is pressed and the file should be copied in the clipboard and allow for pasting somewhere else.</p>
<p>All I found online deals with images, by copying the image itself to the ... | <python><file><copy><clipboard> | 2023-03-16 09:44:59 | 1 | 4,211 | sharkyenergy |
75,753,922 | 3,389,669 | Failed tree-less parsing using python lark | <p>I use <a href="https://lark-parser.readthedocs.io/en/latest/index.html" rel="nofollow noreferrer">lark</a> to parse lines of a log file. The log file contains some equations and I would like to extract the left hand side and right hand side of the equations and store them in a dictionary. However, in my context the ... | <python><lark-parser> | 2023-03-16 08:58:34 | 1 | 819 | user3389669 |
75,753,909 | 12,016,688 | Defining an iterator without implementing the iterator protocol | <p>As noted <a href="https://docs.python.org/3/library/stdtypes.html#iterator-types" rel="nofollow noreferrer">here</a> iterator objects are required to implement both <code>__iter__</code> and <code>__next__</code> methods.</p>
<blockquote>
<p>The iterator objects themselves are required to support the
following two m... | <python><iterator> | 2023-03-16 08:57:56 | 0 | 2,470 | Amir reza Riahi |
75,753,868 | 12,931,358 | Error: Object of type IntervalStrategy is not JSON serializable when add `indent` to verticalize json | <p>I want to save a dataclass to a json file and save it, it is ok now without adding paramenter <code>indent</code>.</p>
<pre><code>class EnhancedJSONEncoder(json.JSONEncoder):
def default(self, o):
if dataclasses.is_dataclass(o):
return dataclasses.asdict(o)
# return su... | <python><json><python-3.x><python-dataclasses> | 2023-03-16 08:53:33 | 2 | 2,077 | 4daJKong |
75,753,615 | 11,680,995 | How to fix "Canceled future for execute_request message" error when using Polars? | <p>I'm using Polars to process a 35 GB file in Python, and I'm running the following line of code:</p>
<pre><code>df.unique(subset=['id']).select(pl.count()).collect(streaming=True).item()
</code></pre>
<p>However, I'm getting the following error:</p>
<pre><code>Canceled future for execute_request message before replie... | <python><python-polars> | 2023-03-16 08:23:46 | 0 | 343 | roei shlezinger |
75,753,568 | 12,436,050 | ValueError: Unterminated string starting at: Error while calling an API endpoint recursively in Python 3.7 | <p>I am trying to connect to an API endpoint, fetching the json response, writing and extending the response (looping through page: total number of pages are 200, number of items: 41500) to a list. And finally I would like to write the complete list to a single JSON file. I am running below code for performing this tas... | <python><python-requests> | 2023-03-16 08:18:36 | 1 | 1,495 | rshar |
75,753,553 | 8,551,360 | Elastic Beanstalk server slows down whenever a instance is added or removed on auto-scaling (Python 3.8 running on 64bit Amazon Linux 2) | <p>So we have recently uploaded a new enviornment for our product</p>
<p>We are using python 3.8</p>
<p>Elastic beanstalk is of application type</p>
<p><strong>This is my Auto Scaling group configuration</strong></p>
<p><a href="https://i.sstatic.net/zni2D.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/... | <python><amazon-web-services><amazon-ec2><amazon-elastic-beanstalk> | 2023-03-16 08:16:30 | 2 | 548 | Harshit verma |
75,753,322 | 981,764 | base64 encoding string with special char in python | <p>I'm trying to encode a string using like so:</p>
<pre><code>base64.b64encode(b'username\with\backslash:password')
</code></pre>
<p>but printing only the string results in this</p>
<pre><code>print('username\\with\\backslash:password')
>> username\withackslash:password
</code></pre>
<p>When escaping the backsla... | <python><encoding><base64> | 2023-03-16 07:44:37 | 0 | 1,468 | axel wolf |
75,753,296 | 8,599,834 | How to tell Mypy that an external package is annotated? | <p>I am using an external package that is fully annotated, but does not include the <code>py.typed</code> marker.</p>
<p>I have submitted a pull request to add it, but in the meantime, I'd like Mypy to know that the package is actually typed, possibly without ignoring the annotations.</p>
<p>By searching the internet, ... | <python><python-typing><mypy> | 2023-03-16 07:41:01 | 0 | 2,742 | theberzi |
75,753,120 | 965,002 | How to calculate the angle rotated of the cut out image? | <p>I have a 200*200 square image, now I draw a circle of 100 diameter with the center of this image as the center, cut this image into two parts along the circle, rotate this circle image by a certain angle and save it as <em>circle.jpg</em> and save the rest as background.jpg. Now what algorithm do I need to calculate... | <python><opencv> | 2023-03-16 07:19:07 | 2 | 487 | hoozecn |
75,753,100 | 726,802 | DJango pick Operating system username instead of user name present in settings file | <p><strong>About the issue</strong></p>
<p>I created the project using command <code>django-admin startproject test</code> and updated the settings file to have mysql database details. Apart from that nothing added/updated/deleted in code.</p>
<p><strong>Database details in config file</strong></p>
<pre><code>DATABASES... | <python><django> | 2023-03-16 07:16:38 | 1 | 10,163 | Pankaj |
75,753,067 | 6,182,971 | Python: Reddit PRAW extremely slow pulling comments for large thread | <p>I want to build a sentiment bot based on Reddit comments, so I've started working with the Reddit PRAW library for Python. Just googling this topic, it seems that getting all thread comments can be somewhat tricky.</p>
<p>The PRAW code itself is fairly simple (based on this documentation page: <a href="https://praw... | <python><reddit><praw> | 2023-03-16 07:11:00 | 1 | 3,174 | SuperCodeBrah |
75,752,849 | 45,843 | Can language model inference on a CPU, save memory by quantizing? | <p>For example, according to <a href="https://cocktailpeanut.github.io/dalai/#/" rel="nofollow noreferrer">https://cocktailpeanut.github.io/dalai/#/</a> the relevant figures for LLaMA-65B are:</p>
<ul>
<li>Full: The model takes up 432.64GB</li>
<li>Quantized: 5.11GB * 8 = 40.88GB</li>
</ul>
<p>The full model won't fit ... | <python><machine-learning><neural-network><cpu><half-precision-float> | 2023-03-16 06:41:19 | 1 | 34,049 | rwallace |
75,752,827 | 16,396,496 | how to make def to get str(name of Dataframe or list) in python | <pre><code>def get_name(list):
??
li=[1]
get_name(li) # -> 'li' simple string, 'li'
f'{get_name(li)}' # -> 'li' not [1]
</code></pre>
<p>I think it is very simple question. but I can't solve.
Actually, value of list is not necessary.
desired input li (not 'li') , desired output 'li' (not li)</p>
| <python><pandas> | 2023-03-16 06:36:25 | 0 | 341 | younghyun |
75,752,747 | 1,139,541 | How to create 2 environments in tox with different library version | <p>I need to test my library on the same python version but different dependent package version using <code>tox</code>. I have tried this:</p>
<pre><code>[tox]
requires =
tox>=4
env_list = py{37,38,39,310,311,typeguard_{v2,v3}}
[testenv]
description = run unit tests
deps =
-rrequirements.txt
commands =
... | <python><tox> | 2023-03-16 06:25:59 | 1 | 852 | Ilya |
75,752,586 | 11,713,196 | Cannot import LSHForest from sklearn in Google colab | <p>While importing the library <code>LSHForest</code> in Google colab, it is coming out as <code>ImportError: cannot import name 'LSHForest' from 'sklearn.neighbors' (/usr/local/lib/python3.9/dist-packages/sklearn/neighbors/__init__.py)</code>.</p>
<p>I took the code from the official documentation <a href="https://sci... | <python><scikit-learn><google-colaboratory> | 2023-03-16 05:55:01 | 1 | 429 | tarmas99 |
75,752,540 | 983,391 | How to plot multiple pie chart or bar chart from multi-index dataframe? | <p>Dataframe is as below.</p>
<p>There are multiple index as <code>category_1</code> & <code>category_2</code> and two column as <code>count</code> & <code>%</code></p>
<p>I need to draw multiple (for each <code>category_1</code>) pie chart for <code>category_2</code> & <code>%</code> and bar chart for <cod... | <python><pandas><matplotlib><bar-chart><pie-chart> | 2023-03-16 05:45:53 | 2 | 12,382 | Priyank Patel |
75,751,931 | 5,679,047 | Import succeeds in interpreter and fails in script (same Python executable) "No module named `src`" | <p>I have a program designed to automatically parse code in a repository and create an API based on a specification. Parsing the code requires using <code>importlib</code> to import the code I'm going to parse. The line where things diverge as mentioned in the title is <code>spec = importlib.util.find_spec(modulename, ... | <python><python-packaging><python-importlib> | 2023-03-16 03:31:54 | 0 | 681 | Zorgoth |
75,751,907 | 887,290 | OSError: CUDA_HOME environment variable is not set. Please set it to your CUDA install root | <p>I have a weird problem which only occurs since today on my github workflow. These are relevant commands.</p>
<pre><code>pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117
pip3 install mmengine==0.6.0 mmcv==2.0.0rc3 mmdet==3.0.0rc5 mmaction2==1.0rc3
</code></pre>
<p>The forme... | <python><pytorch><openmmlab> | 2023-03-16 03:26:57 | 2 | 2,153 | ThomasEdwin |
75,751,891 | 1,033,591 | Can I make the class name to be a variable in python? | <p>Can I make the class name to be a variable in the newer python release?</p>
<p>I mean can I short the following instructions to be briefer?</p>
<pre><code> if target == "course":
return Course.objects.all()[start:end]`
elif target == "Subject":
return Subject.objects.all()[start:end]
el... | <python><django> | 2023-03-16 03:23:44 | 2 | 2,147 | Alston |
75,751,881 | 19,491,471 | mean of a column after group by returns nan | <p>I have this:</p>
<pre><code>df = name year. salary. d.
a 1990. 3. 5
b 1992. 90. 1
c 1990. 234. 3
...
</code></pre>
<p>I am trying to group my data frame based on year, and then get the average of the salaries in that year. Then my goal is to as... | <python><pandas> | 2023-03-16 03:21:25 | 1 | 327 | Amin |
75,751,811 | 15,392,319 | How to omit certain parts of a SQL query | <p><em>Disclaimer that I'm highly aware there's a better way to word the question, if someone wants to suggest a better way I'd be happy to change it</em></p>
<p>I've been working with DynamoDB for the past 4 years and now I'm switching one of my tables over to postgreSQL. I've been working with the psycopg2 python lib... | <python><sql><postgresql><psycopg2> | 2023-03-16 03:07:59 | 1 | 428 | cmcnphp |
75,751,638 | 1,857,373 | Graph add_nodes_from() nodes not working, add_edges_from() edges not working properly for data no dependent node/edge DAG is created | <p><strong>Problem</strong></p>
<p>This code is not working to write graph edges and nodes from csv lists and this code is not creating a proper graph from edges sent to add_nodes_from() for nodes and add_edges_from() for edges. So what is the property way to get a graph database to receive and read nodes and edges and... | <python><graph><networkx> | 2023-03-16 02:21:22 | 1 | 449 | Data Science Analytics Manager |
75,751,564 | 1,311,866 | f-string and multiprocessing.Manager dict and list | <p>I am writing this question, because it does not seem like what I am experiencing should be the desired behavior:</p>
<p>The following code is pretty much lifted from the <a href="https://docs.python.org/3.9/library/multiprocessing.html" rel="nofollow noreferrer">3.9.16 documentation on <code>multiprocessing.Manager<... | <python><f-string><multiprocessing-manager> | 2023-03-16 02:02:03 | 1 | 3,737 | tipanverella |
75,751,478 | 10,215,301 | How can I include external Python scripts while executing their codes in Quarto? | <p>I am rendering a Quarto markdown as a parent file (<code>test.qmd</code> in the MWE). By way of rendering, I am trying to include an external Python script (<code>lm.py</code>) in the parent file while executing the Python code, and refer to the result of the code (<code>model</code> in <code>lm.py</code>) in the pa... | <python><execution><evaluation><quarto> | 2023-03-16 01:39:22 | 1 | 3,723 | Carlos Luis Rivera |
75,751,158 | 1,263,739 | How to extract and combine text and tables from PDF using AWS Textract | <p>I am using the <a href="https://aws-samples.github.io/amazon-textract-textractor/index.html" rel="nofollow noreferrer">textractor</a> package to extract the text and the table that is present in a pdf document through AWS Textract:</p>
<pre><code>from textractor import Textractor
from textractor.data.constants impor... | <python><ocr><amazon-textract> | 2023-03-16 00:21:59 | 1 | 2,374 | kahlo |
75,751,119 | 6,676,101 | In general, what is a pythonic way to write a decorator? | <p>In general, I want to know how to write a simple decorator in python.</p>
<p>However, it might help to have a specific example.</p>
<p>Consider the following function:</p>
<pre class="lang-python prettyprint-override"><code>def pow(base:float, exp:int):
"""
+------------------------------... | <python><python-3.x><decorator><python-decorators><functor> | 2023-03-16 00:13:19 | 2 | 4,700 | Toothpick Anemone |
75,751,096 | 1,585,767 | How to set same encoding in Python String as when reading it from file | <p>I'm building an AWS Lambda to generate a JWT from a Pem. The example I'm using is taken from this link:</p>
<p><a href="https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/generating-a-json-web-token-jwt-for-a-github-app" rel="nofollow noreferrer">https://docs.github.com/en/apps/cre... | <python><aws-lambda><encoding> | 2023-03-16 00:06:05 | 1 | 10,747 | Andres |
75,751,088 | 10,592,609 | Is there a more pythonic way of writing this? | <p>I wrote this code and it works. I wanted to have other thoughts on how the code can be improved thanks.</p>
<p>The main objective of the code is to determine whether it is possible to obtain a strictly increasing sequence by removing no more than one element from the array.</p>
<pre><code>def hh(s):
o = True
... | <python><python-3.x> | 2023-03-16 00:04:31 | 1 | 2,753 | Babatunde Mustapha |
75,750,742 | 18,313,588 | Get all elements with count less than 50 from a counter | <p>Code</p>
<pre><code>from itertools import dropwhile
for key, count in dropwhile(lambda key_count: key_count[1] < 50, countered.most_common()):
del countered[key]
</code></pre>
<p>Input which is the <code>countered</code> variable looks like this</p>
<pre><code>[('Required Weather API', 100),
('New York City ... | <python><python-3.x><counter><python-itertools> | 2023-03-15 22:46:36 | 2 | 493 | nerd |
75,750,656 | 16,665,831 | Kafka consumer not appending consumed data into list in docker/ docker compose | <p>I developed a python app that reads file, transform it after that send it to Kafka topic and receive data with consumer. I deployed this pipeline with docker and docker compose. But according to logs. Here, it sent data to Kafka topic and consumer can receive data line-by-line but when code comes to [msg.value for m... | <python><docker><apache-kafka><docker-compose><dockerfile> | 2023-03-15 22:32:17 | 0 | 309 | Ugur Selim Ozen |
75,750,646 | 2,684,771 | How do I use bindtags with ttk.Entry? | <p>Following <a href="https://stackoverflow.com/q/11541262/2684771">this question</a>, I can setup bindtags to get events that include the keypress that activated the event.</p>
<p>When I change <code>tk.Entry</code> to <code>ttk.Entry</code>, the events still work but I am unable to select the entry contents or click ... | <python><tkinter><tk-toolkit><ttk> | 2023-03-15 22:31:17 | 1 | 7,151 | sambler |
75,750,635 | 12,131,472 | how do I insert each row of a small dataframe before the matching rows of a big dataframe? | <p>I have one small and one big dataframe</p>
<p>the small one</p>
<pre><code> WS period shortCode identifier
6 197.78 2023-03-10 TC2-FFA spot
7 196.79 2023-03-10 TC5-FFA spot
8 253.13 2023-03-10 TC6-FFA spot
9 198.13 2023-03-13 TC12-FFA sp... | <python><pandas><dataframe> | 2023-03-15 22:30:01 | 1 | 447 | neutralname |
75,750,556 | 417,896 | pyarrow - Write binary file in arrow format | <p>How do I write a file <code>./my-data.arrow</code> using the arrow binary format?</p>
<p>Note I don't want a Parquet file.</p>
<pre><code>import pyarrow as pa
data = [('A', 1), ('B', 2)]
schema = pa.schema([
('name', pa.string()),
('id', pa.int64())
])
</code></pre>
| <python><pyarrow><apache-arrow> | 2023-03-15 22:14:27 | 1 | 17,480 | BAR |
75,750,489 | 3,595,231 | How to refer a lib in different location in python? | <p>This is the structure of our team code in python,</p>
<pre><code>`tree -L 1 apps/sockstunnel/sockstunnel auto_tasks/FEXT_STACKER/`
apps/sockstunnel/sockstunnel
βββ api.py
βββ db.py
βββ exceptions.py
βββ flags.py
βββ frame.py
βββ __init__.py
βββ libfix.py
βββ notification.py
βββ protocols.py
βββ proxy_router.py
βββ ... | <python><python-3.x> | 2023-03-15 22:05:44 | 1 | 765 | user3595231 |
75,750,421 | 18,313,588 | Change pandas column values to become lists in pandas dataframe | <p>Currently, I have</p>
<p><code>df['fruits']</code></p>
<pre><code>apple,
orange,
pineapple,
banana,tomato,
cabbage,watermelon,
Name: fruits, Length: 5, dtype: object
</code></pre>
<p>How can I change the above to lists and remove the commas at the end in pandas dataframe?</p>
<p>Expected output of <code>df['fruits'... | <python><python-3.x><pandas><dataframe> | 2023-03-15 21:55:26 | 1 | 493 | nerd |
75,750,390 | 12,193,952 | How to calculate rolling Volume Profile using Pandas faster? | <h2>Problem</h2>
<p>I am doing some market analysis and as a part of technical analysis, I am using a "rolling" <a href="https://www.tradingview.com/support/solutions/43000502040-volume-profile/" rel="nofollow noreferrer">Volume Profile</a> indicator. It calculates the price level with the highest volume in l... | <python><pandas><dataframe><numpy><performance> | 2023-03-15 21:50:47 | 1 | 873 | FN_ |
75,750,365 | 14,605,345 | Extracting three columns from a single column using pandas | <p>I have a csv file in which a column is itself a dictionary. This column contains three attributes each of which I want as a separate column in the resultant dataframe.</p>
<p>From the answer <a href="https://stackoverflow.com/questions/34304899/how-to-split-a-single-column-into-three-columns-in-pandas-python">How to... | <python><pandas><dataframe> | 2023-03-15 21:46:53 | 1 | 581 | Huzefa Sadikot |
75,750,325 | 741,692 | pyserial slow disconnection | <p>I found out my pyserial connection is taking a long time to disconnect, not sure why this is, because opening and sending/receiving seems to be quite fast and in line with the baudrates (225bits -> 0.09375 seconds). I wrote a minimal piece of code to showcase my problem. It is running on a raspberry pi3.</p>
<pre... | <python><serial-port><pyserial> | 2023-03-15 21:39:47 | 0 | 8,420 | DarkZeros |
75,750,225 | 1,306,907 | Automate a pipenv update run before merging | <p>My team has decided they want to enforce installing the latest version of packages before merging to master so that they don't become too out of date. So someone set up a pre-commit hook to call <code>pipenv update</code> to update the lock file and then install new versions of dependencies.</p>
<p>However, this ha... | <python><pipenv> | 2023-03-15 21:26:49 | 0 | 631 | ScoobyDrew18 |
75,750,132 | 5,132,559 | PyMongo save List of dict in subfield with own ObjectId for every dict entry | <p>I'm creating a list of Objects in my script, and want so save/update them in a subfield of an mongo db document.</p>
<p>My Objects looks like this:</p>
<pre><code>class IndividualRating:
def __init__(self, place=0, player="", team="", games="", legs=""):
self.place... | <python><mongodb><pymongo> | 2023-03-15 21:15:21 | 1 | 1,562 | Tobias |
75,750,025 | 6,676,101 | Inside of `__new__`, why is `cls` required instead of `args[0]`? | <p>I have two almost identical implementations of the <code>__new__</code> method for a class.</p>
<p>However, in one case, there is an error message.</p>
<p>In the other case, it works fine.</p>
<pre class="lang-python prettyprint-override"><code>class Klass1():
# causes RuntimeError: super(): no arguments
def... | <python><python-3.x><constructor><constructor-overloading> | 2023-03-15 20:59:51 | 0 | 4,700 | Toothpick Anemone |
75,749,945 | 506,824 | Why are breakpoints in site-packages code disabled when I start debugger? | <pre><code>MacOS Monterey
Python 3.9.13
VS Code 1.76.2
pytest==7.2.0
</code></pre>
<p>I'm running out of a virtualenv. When I debug one of my unit tests and try to step into a library function, it doesn't step in, it just runs to completion. Explicitly setting breakpoints in the library code has no effect. I have ju... | <python><visual-studio-code><vscode-debugger> | 2023-03-15 20:49:44 | 1 | 2,177 | Roy Smith |
75,749,862 | 3,826,115 | Using a checkbox widget in Holoviews to toggle visibility of Point plot | <p>I have the following code which gives me a scatter plot of two groups of points:</p>
<pre><code>import pandas as pd
import holoviews as hv
hv.extension('bokeh')
df1 = pd.DataFrame(data = {'x':range(1,5), 'y':range(1,5)})
df2 = pd.DataFrame(data = {'x':range(5,10), 'y':range(5,10)})
p1 = hv.Points(df1, label =... | <python><bokeh><holoviews> | 2023-03-15 20:40:18 | 1 | 1,533 | hm8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.