QuestionId int64 74.8M 79.8M | UserId int64 56 29.4M | QuestionTitle stringlengths 15 150 | QuestionBody stringlengths 40 40.3k | Tags stringlengths 8 101 | CreationDate stringdate 2022-12-10 09:42:47 2025-11-01 19:08:18 | AnswerCount int64 0 44 | UserExpertiseLevel int64 301 888k | UserDisplayName stringlengths 3 30 ⌀ |
|---|---|---|---|---|---|---|---|---|
74,992,493 | 17,501,206 | Find all words in binary buffer using Python | <p>I want to find in <strong>binary buffer</strong> (<code>bytes</code>) all the "words" build from ascii lowercase and digits that <strong>only</strong> 5 chars length.</p>
<p>For example:</p>
<p><code>bytes(b'a\x1109ertx01\x03a54bb\x05')</code> contains <code>a54bb</code> and <code>09ert</code> .</p>
<p>No... | <python><python-3.x><set> | 2023-01-03 11:05:34 | 1 | 334 | vtable |
74,992,220 | 925,913 | Python: Mock class constructor to throw an Exception, inside another class's constructor | <h3>Problem</h3>
<p>To put concisely, I have a class A whose constructor catches any exceptions that might occur. The only logic that <em>can</em> throw an exception though, is the construction of another class B (from an external library, in case that matters). I want to test that when this inner constructor (B) throw... | <python><mocking> | 2023-01-03 10:41:16 | 1 | 30,423 | Andrew Cheong |
74,992,183 | 7,052,830 | Uvicorn gives "access is denied" in Anaconda Prompt | <p><strong>Problem</strong></p>
<p>I have two conda virtual environments. One can run uvicorn commands such as <code>uvicorn main:app --reload</code> to run <a href="https://fastapi.tiangolo.com/tutorial/first-steps/" rel="nofollow noreferrer">the example code from the FastAPI tutorial</a>, but the other environment re... | <python><anaconda><fastapi><uvicorn> | 2023-01-03 10:38:08 | 0 | 545 | Tim J |
74,992,166 | 20,051,041 | How to define dynamic column range in Excel using Python | <p>I am using Python 3 to generate an Excel file. In each run a number of columns is different.</p>
<p>With static number of columns, I would use e.g.:</p>
<pre><code>writer = pd.ExcelWriter("File.xlsx", engine = "xlsxwriter")
writer.sheets["Sheet"].set_column("A:G", 10)
</code><... | <python><excel> | 2023-01-03 10:36:14 | 2 | 580 | Mr.Slow |
74,992,120 | 19,580,067 | Find the row and column index of the particular value in Dataframe | <p>I have to find the row and column index of the particular value from the dataframe. I have the code to find the row index based on the column name. But not sure how to find both row and column indexes.</p>
<p>Current Table:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>0</th>
<th>1</th... | <python><pandas><dataframe><python-camelot> | 2023-01-03 10:32:19 | 2 | 359 | Pravin |
74,991,976 | 9,102,437 | How to change the default charset for in MySQL? | <p>I have a python code which adds rows to the MySQL database which runs on the same machine. The code is as follows:</p>
<pre class="lang-py prettyprint-override"><code>import mysql.connector
config = {
'user': 'root',
'password': 'a$$enjoyer',
'host': 'localhost',
'database': 'db',
'raise_on_warnings': Tru... | <python><mysql><sql><python-3.x><mysql-connector-python> | 2023-01-03 10:21:10 | 1 | 772 | user9102437 |
74,991,778 | 12,394,386 | 'BertModel' object has no attribute 'bert' error german bert model | <p>i want to replicate the work in this repo
<a href="https://github.com/theartificialguy/NLP-with-Deep-Learning/blob/master/BERT/Multi-Class%20classification%20TF-BERT/multi_class.ipynb" rel="nofollow noreferrer">https://github.com/theartificialguy/NLP-with-Deep-Learning/blob/master/BERT/Multi-Class%20classification%2... | <python><nlp><model><huggingface-transformers><bert-language-model> | 2023-01-03 10:04:31 | 1 | 323 | youta |
74,991,754 | 7,161,679 | How to yield one array element and keep other elements in pyspark DataFrame? | <p>I have a pyspark DataFrame like:</p>
<pre>
+------------------------+
| ids|
+------------------------+
|[101826, 101827, 101576]|
+------------------------+
</pre>
<p>and I want explode this dataframe like:</p>
<pre>
+------------------------+
| id| ids|
+------------------------... | <python><pyspark><apache-spark-sql> | 2023-01-03 10:01:57 | 1 | 1,438 | littlely |
74,991,684 | 4,796,942 | Batch update validation and formatting cells using pygsheets | <p>I am using pygsheets and would like to batch validate cells instead of looping through each cell and doing it iteratively. I have gone through the <a href="https://readthedocs.org/projects/pygsheets/downloads/pdf/stable/" rel="nofollow noreferrer">pygsheets documentation</a> and have not found an example of this, wo... | <python><google-sheets><google-sheets-api><pygsheets> | 2023-01-03 09:56:20 | 1 | 1,587 | user4933 |
74,991,641 | 2,320,153 | Gunicorn: do not empty specified log files when restarting | <p>I have created a Gunicorn project, with <code>accesslog</code> and <code>errorlog</code> being specified in a config file, and then the server being started with only a <code>-c</code> flag to specify this config file.</p>
<p>The problem is, each time I restart the same Gunicorn process (via <code>pkill -F <pidfi... | <python><linux><logging><gunicorn> | 2023-01-03 09:53:07 | 1 | 1,420 | Zoltán Schmidt |
74,991,629 | 14,122,835 | Inner join in pandas | <p>I have two dataframes:</p>
<ul>
<li>The first one was extracted from the manifest database.The data explains about the value, route (origin and destination), and also the actual SLA</li>
</ul>
<pre><code>awb_number route value sla_actual (days)
01 A - B 24,000 2
02 A - C ... | <python><pandas><inner-join> | 2023-01-03 09:52:12 | 3 | 531 | yangyang |
74,991,599 | 5,470,966 | Does PyCharm have the feature for executing python script in parts/cells (like in VsCode - Run in interacting Window)? | <p>when using <strong>VSCode</strong>, I can run python files in cells/parts as if it was Jupyter notebook, without actually having a notebook.
<a href="https://code.visualstudio.com/docs/python/jupyter-support-py" rel="nofollow noreferrer">https://code.visualstudio.com/docs/python/jupyter-support-py</a>
It means, you ... | <python><visual-studio-code><jupyter-notebook><pycharm><ipython> | 2023-01-03 09:49:53 | 2 | 488 | ggcarmi |
74,991,551 | 10,238,256 | Summarize rows in pandas dataframe by column value and append specific column values as columns | <p>I have a dataframe as follows with multiple rows per id (maximum 3).</p>
<pre><code>dat = pd.DataFrame({'id':[1,1,1,2,2,3,4,4], 'code': ["A","B","D","B","D","A","A","D"], 'amount':[11,2,5,22,5,32,11,5]})
id code amount
0 1... | <python><pandas><transformation> | 2023-01-03 09:46:04 | 1 | 375 | sfluck |
74,991,540 | 7,376,511 | Python Requests: set proxy only for specific domain | <p>Is there a native way in Python with the requests library to only use a proxy for a specific domain?</p>
<p>Like how you can mount HTTP Adapters, but with proxies, like the following example:</p>
<pre><code>from requests import Session
from requests.adapters import HTTPAdapter
s = Session()
s.mount("http://ww... | <python><python-requests> | 2023-01-03 09:45:18 | 2 | 797 | Some Guy |
74,991,284 | 273,506 | pandas dataframe reset index | <p>I have a dataframe like this:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>Attended</th>
<th>Email</th>
<th>JoinDate</th>
<th>JoinTime</th>
<th>JoinTime</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td></td>
<td></td>
<td>JoinTimeFirst</td>
<td>JoinTimeLast</td>
</tr>
<tr>
<td>Yes</td>
... | <python><pandas><dataframe> | 2023-01-03 09:20:01 | 3 | 1,069 | Arjun |
74,991,185 | 6,282,576 | Groupby using Django's ORM to get a dictionary of lists from the queryset of model with foreignkey | <p>I have two models, <code>Business</code> and <code>Employee</code>:</p>
<pre class="lang-py prettyprint-override"><code>from django.db import models
class Business(models.Model):
name = models.CharField(max_length=150)
# ...
class Employee(models.Model):
business = models.ForeignKey(
Business,... | <python><django><postgresql><group-by><django-orm> | 2023-01-03 09:10:31 | 2 | 4,313 | Amir Shabani |
74,990,801 | 7,175,247 | AttributeError: module 'sqlalchemy.orm' has no attribute 'DeclarativeMeta' | <p>Getting the below error while running a flask application:</p>
<pre><code>ubuntu@ip-10-50-50-190:~/RHS_US/application$ python3 run.py
Traceback (most recent call last):
Fil... | <python><flask><flask-sqlalchemy> | 2023-01-03 08:33:04 | 1 | 814 | Nagesh Singh Chauhan |
74,990,755 | 4,451,521 | Using pytest with dataframes to test specific columns | <p>I am writing pytest tests that use panda's dataframes and I am trying to write the code as general as I can. (I can always check element by element but trying to avoid that)</p>
<p>so I have an input dataframe that contains some ID column like this</p>
<pre><code>ID,othervalue, othervalue2
00001, 4, 3
00001, 3, ... | <python><pandas><pytest> | 2023-01-03 08:28:48 | 1 | 10,576 | KansaiRobot |
74,990,683 | 19,325,656 | Flask blueprint as a package | setuptools | <p>I have a flask blueprint that I'm pushing to GitHub as a separate repo. Then I install it via</p>
<p><em>pip install git@httpps://....</em></p>
<p>I get the package in my venv and it's all good I can import code etc.</p>
<p><strong>However</strong> there is an issue. I don't see HTML/CSS/js files that are visible on... | <python><flask><setuptools> | 2023-01-03 08:20:52 | 1 | 471 | rafaelHTML |
74,990,601 | 12,991,231 | How to convert the values in a Python Defaultdict to a Numpy array? | <p>I want multiple values to belong to the same key, so I used a Python defaultdict to walk around this.
However, since now the values in the defaultdict are nested lists, how do I make each element of the nested lists a row of a Numpy ndarray?</p>
<p>Let's say my defaultdict looks like this:</p>
<pre><code>my_dict = d... | <python><numpy> | 2023-01-03 08:13:10 | 2 | 337 | sensationti |
74,990,578 | 275,002 | Go: How to deal with Memory leaks while returning a CString? | <p>I have the following function signature which then return a JSON string</p>
<pre><code>func getData(symbol, day, month, year *C.char) *C.char {
combine, _ := json.Marshal(combineRecords)
log.Println(string(combine))
return C.CString(string(combine))
}
</code></pre>
<p>The Go code is then being called in Python... | <python><go><memory-leaks><ctypes><cgo> | 2023-01-03 08:10:28 | 2 | 15,089 | Volatil3 |
74,990,485 | 3,801,744 | Wrong `nbytes` value in a numpy array after broadcasting with `broadcast_to` | <p>I just noted this:</p>
<pre class="lang-py prettyprint-override"><code>import numpy as np
import sys
arr = np.broadcast_to(0, (10, 1000000000000))
print(arr.nbytes) # prints "80000000000000"
print(sys.getsizeof(arr)) # prints "120"
</code></pre>
<p>Is this a bug or intended behavior? I.e., is... | <python><arrays><numpy> | 2023-01-03 07:59:43 | 1 | 652 | SiLiKhon |
74,990,427 | 2,134,767 | ordering is not working with django model seralizer | <p>I am using 2.2.16 django versiong and 3.11.2 django_rest_framework version and using serializers.ModelSerializer CRUD operation is working but ordering is not working.</p>
<p>models.py code is below,</p>
<pre><code>class Ticket(models.Model):
title = models.CharField(max_length=255)
description = models.Char... | <python><django><django-rest-framework> | 2023-01-03 07:54:34 | 1 | 2,852 | Naggappan Ramukannan |
74,990,168 | 3,755,432 | Include config files with setup.py install | <p>I have tried all the option available on stackoverflow, still could not get etc directory to get copied to install path with <code>setup.py install</code> command. I have code in below structure.</p>
<pre><code>├── setup.py
├── MANIFEST.in
├── etc/
│ ├── config.yaml
│ └── message.xml
└── src/
└── my-app/
... | <python><setuptools> | 2023-01-03 07:26:06 | 1 | 2,017 | tempuser |
74,990,097 | 1,186,624 | How can I use scipy.integrate.solve_ivp() to solve an ODE in an interactive simulation? | <p>I have implemented a simple simulation on a uniform circular motion using the low level API <code>scipy.integrate.RK45()</code> like the following.</p>
<pre><code>import numpy as np
import scipy.integrate
import matplotlib.pyplot as plt
r = np.array([1, 0], 'float')
v = np.array([0, 1], 'float')
dt = 0.1
def motio... | <python><scipy><simulation><ode> | 2023-01-03 07:16:50 | 1 | 5,019 | relent95 |
74,990,085 | 17,267,064 | How do I transform a text data with cells in a rows separated by pipe sign into specific pattern of data via python? | <p>I want to transform below data in to a pattern of specific rows of 4 cells. Please find the specimen of below data.</p>
<pre><code>text = """A | B | Lorem | Ipsum | is | simply | dummy
C | D | text | of | the | printing | and
E | F | typesetting | industry. | Lorem
G | H | more | recently | with | des... | <python><python-3.x> | 2023-01-03 07:15:17 | 2 | 346 | Mohit Aswani |
74,990,008 | 10,035,978 | ping constantly an IP and write into txt | <p>I have this code</p>
<pre><code>def ping_google(command):
with open('google.txt', 'a') as f:
f.write(subprocess.check_output(command))
t1 = threading.Thread(target=ping_anel, args=("ping -t 8.8.8.8",))
</code></pre>
<p>And i would like to save the infinite pinging to google in a txt file. Is i... | <python><cmd><ping> | 2023-01-03 07:05:39 | 1 | 1,976 | Alex |
74,989,976 | 19,106,705 | nvidia-smi vs torch.cuda.memory_allocated | <p>I am checking the gpu memory usage in the training step.</p>
<p><strong>To start with the main question</strong>, checking the gpu memory using the <code>torch.cuda.memory_allocated</code> method is different from checking with <code>nvidia-smi</code>. And I want to know why.</p>
<p>Actually, I measured the gpu usag... | <python><pytorch><gpu><nvidia-smi><vram> | 2023-01-03 07:01:31 | 1 | 870 | core_not_dumped |
74,989,931 | 4,041,387 | converting the C# code to python on decryption | <pre><code>using System.Security.Cryptography;
public Task<byte[]> Decrypt(byte[] encryptedBytes, string encryptionKey)
{
if (encryptedBytes == null)
throw new ArgumentNullException("encryptedBytes can't be null");
if (string.IsNullOrEmpty(encryptionKey))
throw new ArgumentNull... | <python><c#><encryption><cryptography><aes> | 2023-01-03 06:55:40 | 1 | 425 | Imran |
74,989,827 | 18,092,798 | Snakemake rule higher priority than all other rules | <p>So I know that in order to set rule priority, you use <code>ruleorder</code>. Is there an efficient way to give a rule priority over all other rules? For example, suppose I have rules <code>a</code>, <code>b</code>, and <code>c</code>. I would like rule <code>b</code> to have higher priority over <code>a</code> and ... | <python><python-3.x><snakemake><directed-acyclic-graphs> | 2023-01-03 06:43:44 | 2 | 581 | yippingAppa |
74,989,725 | 13,560,598 | tensorflow sparse dense layer | <p>I want to create a custom dense layer in tf.keras, which works with sparse weight matrices. My weight matrices are zero almost everywhere, and I know the sparsity pattern. It would be a huge cost saving. How would I incorporate sparse matrices into a custom Dense layer? Could someone point me to a reference? I could... | <python><tensorflow><sparse-matrix><layer> | 2023-01-03 06:27:44 | 0 | 593 | NNN |
74,989,658 | 7,347,925 | How to apply scipy curve_fit to different magnitude data? | <p>I have two arrays: <code>x</code> ranges from 50 to 1000 while <code>y</code> ranges from 0 to 13.</p>
<p>I'm trying to fit them by the Gaussian function:</p>
<pre><code>import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
x = np.array([954.57747687, 845.47601272, 746.69873108, 6... | <python><scipy><curve-fitting><scipy-optimize> | 2023-01-03 06:17:47 | 0 | 1,039 | zxdawn |
74,989,136 | 19,238,204 | Question on Integration Formula and Negative Result with the Plot of the Volume | <p>I have created this code by modification from previous topics.</p>
<p><a href="https://i.sstatic.net/Cqjrm.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Cqjrm.png" alt="volume" /></a></p>
<p>I put the calculated volume on the volume plot. My questions are:</p>
<ol>
<li>My plots are correct right?</l... | <python><numpy><matplotlib> | 2023-01-03 04:50:10 | 1 | 435 | Freya the Goddess |
74,988,972 | 13,176,726 | Submitting a Post to API from Flutter app always returning Exception: type 'int' is not a subtype of type 'String' in type cast | <p>I have the following API in a Django project where I am trying to send a log with some variables that are Int and String.</p>
<p>Here is the Api/views.py:</p>
<pre><code>@api_view(['POST', 'GET'])
@permission_classes([IsAuthenticated])
def addlog(request,username, id):
workout = Workout.objects.get(id=id, user=r... | <python><flutter><dart> | 2023-01-03 04:09:31 | 2 | 982 | A_K |
74,988,964 | 9,218,680 | create multi index column dataframe by transposing(pivoting) a column | <p>I have a dataframe that looks something like:</p>
<pre><code>date enddate category Low High
2023-01-02 06:00:00 2023-12-01 A 45 55
2023-01-02 06:00:00 2024-12-01 A 46 56
2023-01-02 06:00:00 2025-12-01 A 47 57
2023-01-02 06:00:0... | <python><pandas><multi-index> | 2023-01-03 04:08:14 | 1 | 2,510 | asimo |
74,988,694 | 9,532,692 | Plotly: how to draw two linecharts with two dataframes with colors | <p>I am trying to draw two subplots (top and bottom) that contains category of 3 colors and values for each date. With the dataset below, I can draw a single plot with data_A (as shown below)</p>
<pre><code>fig = px.line(data_A,
x="Date", y="Percent",
color='Color',
... | <python><plotly> | 2023-01-03 02:57:51 | 0 | 724 | user9532692 |
74,988,630 | 1,219,322 | PyDeck in Streamlit - event handling for on_click | <p>Given the following code, the on_click event is not triggered, not certain why.</p>
<pre><code>def on_click(info):
print('Testing...')
st.write("TEST TEST")
chart = pdk.Deck(
map_style="dark",
initial_view_state={
"country": "CA",
... | <python><streamlit><pydeck> | 2023-01-03 02:38:50 | 0 | 1,998 | dirtyw0lf |
74,988,623 | 1,019,129 | MULTI level dict: Return reference instead of the content | <p>I have a tree. I have to calculate cummulatve sum up to every leaf. And finally keep only the top N leafs by sum.</p>
<p>So far I got the sum and i get the leafs content back .. the problem is I want back REFERENCES to the leafs so that I delete the ones with low cumsum</p>
<p>Is there way to do that ?</p>
<pre><cod... | <python><reference><tree><leaf> | 2023-01-03 02:36:15 | 1 | 7,536 | sten |
74,988,607 | 11,628,437 | Why does GitHub pagination give varying results? | <p>If I perform a code search using the GitHub Search API and request 100 results per page, I get a varying number of results -</p>
<pre><code>import requests
# url = "https://api.github.com/search/code?q=torch +in:file + language:python+size:0..250&page=1&per_page=100"
url = "https://api.github... | <python><github><github-api><github-search> | 2023-01-03 02:33:48 | 1 | 1,851 | desert_ranger |
74,988,529 | 7,968,024 | How to send messages from server to client in a Python WebSockets server, AFTER initial handshake? | <p>Here is a small websockets client and server POC.
It sends a single hard-coded message string from the (Python) server to the Javascript client page.</p>
<p>The question is, how to send further, ad-hoc messages? From the server to the client.</p>
<p>Tiny HTML client page with embedded Javascript:</p>
<pre class="lan... | <javascript><python><websocket> | 2023-01-03 02:09:56 | 1 | 1,536 | CyclingDave |
74,988,210 | 2,000,548 | How to know actual result of `proc_output.waitFor` if `expected_output` is wrong? | <p>I am trying to follow a <a href="https://www.youtube.com/watch?v=h-1IhC01T1c" rel="nofollow noreferrer">ROS2 testing tutorial</a> which tests a topic listener to understand how ROS2 testing works. Here is a screenshot of the related code at 21:15</p>
<p><a href="https://i.sstatic.net/0gF67.jpg" rel="nofollow norefer... | <python><python-3.x><ros><ros2> | 2023-01-03 00:47:13 | 1 | 50,638 | Hongbo Miao |
74,988,123 | 1,064,810 | How do you get stdout from pexpect? | <pre><code>import pexpect
domain = "test"
username = "user"
password = "password"
child = pexpect.spawn("virsh console " + domain)
# ensure we get a login prompt:
child.sendline()
# log in:
child.expect("login:")
child.sendline(username)
child.expect("Password:... | <python><pexpect><virsh> | 2023-01-03 00:22:07 | 0 | 1,563 | cat pants |
74,988,009 | 14,729,820 | How to implement Text2Image with CNNs and Transposed CNNs | <p>I wanna implement text2image neural networks like the image below: Please see the image
<a href="https://i.sstatic.net/MHgXL.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/MHgXL.png" alt="" /></a>
usin... | <python><pytorch><conv-neural-network><encoder><text2image> | 2023-01-02 23:53:48 | 2 | 366 | Mohammed |
74,987,896 | 12,708,740 | Move file using specific nav path to another folder | <p>I have a list of navigation paths to specific files, which all come from different folders. I'd like to move them all to a new folder.</p>
<p>Specifically, my data is formatted in two columns in a dataframe, where I'd like to move each file to its new folder. (Each row describes a file.)</p>
<p>My input:</p>
<pre><c... | <python><pandas><file><directory><shutil> | 2023-01-02 23:29:39 | 1 | 675 | psychcoder |
74,987,851 | 929,732 | Unable to insert a zulu date into mysql database using flask_mysqldb | <p>When I run the following iwth the value of Job_date being "2023-01-02T21:00:00.504Z"</p>
<pre><code>@api.route('/addjob', methods=["POST"])
def addjob():
f = open('addjob.txt','w')
f.write(str(request.json))
cursor = mysql.connection.cursor()
sql = '''INSERT into jobs (job_date,c... | <python><flask-mysql> | 2023-01-02 23:22:03 | 1 | 1,489 | BostonAreaHuman |
74,987,703 | 2,351,099 | Are Python Unix-only APIs supported under WSL? | <p>Some Python APIs, such as <a href="https://docs.python.org/3/library/os.html#os.pread" rel="nofollow noreferrer"><code>os.pread</code></a>, are documented with availability "Unix", and indeed they are <a href="https://stackoverflow.com/questions/50902714/python-pread-pwrite-only-on-unix">not visible when u... | <python><windows-subsystem-for-linux> | 2023-01-02 22:52:05 | 1 | 17,008 | Massimiliano |
74,987,695 | 1,513,168 | How to use Comparison Operator (>) with datetime? | <p>I am trying to do something with directories older than 4 days. Here is what I have:</p>
<pre><code>from datetime import datetime, date
#get current time
curret_time = datetime.now()
#get file creation time
stat = os.stat(my_directory)
creation_time = datetime.fromtimestamp(stat.st_birthtime)
#get the age of d... | <python> | 2023-01-02 22:49:42 | 1 | 810 | Supertech |
74,987,667 | 10,292,638 | How to properly connect to SQL Server from a python script when python packages are based on github? | <p>Suppose that due to an HTTP 403 Error it's not possible to download the packages from the PyPi repo (nor <code> pip install <package></code> commands) which causes me to install the <code>pyodbc</code> by cloning the repo from Github (<a href="https://github.com/mkleehammer/pyodbc" rel="nofollow noreferrer">h... | <python><sql-server><windows><git><odbc> | 2023-01-02 22:46:21 | 1 | 1,055 | AlSub |
74,987,528 | 11,631,828 | How to correctly call the API endpoint with Python 3 without getting error 500? | <p>I am following the instruction as per the API documentation and enquiring the following endpoint:</p>
<pre><code>summary = 'https://api.pancakeswap.info/api/v2/summary'
</code></pre>
<p>However I am getting the following error:</p>
<pre><code>{'error': {'code': 500, 'message': 'GraphQL error: panic processing query:... | <python><python-requests><endpoint><pancakeswap> | 2023-01-02 22:21:13 | 1 | 982 | Pro Girl |
74,987,486 | 443,836 | How to use struct pointer from C in Python? | <p>This is a snippet from a C header for a Windows DLL that was generated by Kotlin Multiplatform/Native:</p>
<pre class="lang-c prettyprint-override"><code>typedef struct {
struct {
struct {
// ...
} root;
} kotlin;
} libnative_ExportedSymbols;
extern libnative_ExportedSymbols* libnative_symbols(void... | <python><ctypes><kotlin-native> | 2023-01-02 22:14:55 | 2 | 4,878 | Marco Eckstein |
74,987,480 | 3,574,176 | Failing to deploy python azure function when including git repository into requirements.txt | <p>I am using VS code and Azure functions extension to create and deploy a python HTTP trigger azure function.</p>
<p>The problem I am having is that when I include a git repository to the <code>requirements.txt</code> the deployment fails without clear error. As soon as I remove the reference the deployment is success... | <python><git><azure><deployment><azure-functions> | 2023-01-02 22:13:47 | 1 | 1,555 | vsarunov |
74,987,453 | 8,864,226 | Need to sort NaN in Python to the end of a list | <p>I'm trying to sort a list and work around Python's poor handling of <code>nan</code> and <code>inf</code>.</p>
<p>I need to partition a list into all the numbers sorted (or reversed) and at the end of the list any NaN or Inf. The order of the non-number (NaN/Inf) elements is not important, so long as they are arrang... | <python><list><sorting><nan> | 2023-01-02 22:10:16 | 1 | 6,097 | James Risner |
74,987,358 | 2,487,653 | How to embed Jupyter-notebook inside Python code with access to caller's environment | <p>Often when I develop code I want to work inside the environment where that code will run. Typically I do this by invoking an IPython interpreter [which I do by setting PYTHONBREAKPOINT to point to a routine that calls <code>IPython.terminal.embed.InteractiveShellEmbed()</code>]. I am thinking that it would be way be... | <python><jupyter-notebook> | 2023-01-02 21:53:40 | 1 | 858 | bht |
74,987,297 | 2,163,109 | Matplotlib -- how to retreive polygons colors from choropleth map | <p>I made the choropleth map using GeoPandas and Matplotlib. I want to add value labels to each polygon of the map in a way that font label color must be a contrast to polygon fill color (white on a darker color and black on a lighter).</p>
<p>Thus, I need to know every polygon's fill color. I found the solution (see m... | <python><matplotlib><geopandas> | 2023-01-02 21:44:05 | 0 | 424 | codkelden |
74,987,168 | 2,072,962 | Keras prediction incorrect with scaler and feature selection | <p>I build an application that trains a Keras binary classifier model (0 or 1) every x time (hourly,daily) given the new data. The data preparation, training and testing works well, or at least as expected. It tests different features and scales it with MinMaxScaler (some values are negative).</p>
<p>On live data predi... | <python><keras><scikit-learn> | 2023-01-02 21:21:31 | 2 | 764 | galgo |
74,987,100 | 6,346,514 | Python, change email to name format | <p>How can I parse the below email options to just expected output. These are not in a dataframe, they are separate strings. I have a loop that loops through each string.</p>
<p>example input</p>
<pre><code>Louis.Stevens@hotmail.com
Louis.a.Stevens@hotmail.com
Louis.Stevens@stackoverflow.com
Louis.Stevens2@hotmail.com ... | <python><pandas> | 2023-01-02 21:12:20 | 3 | 577 | Jonnyboi |
74,987,090 | 11,058,930 | Create column in DataFrame1 based on values from DataFrame2 | <p>I have two Dataframes, and would like to create a new column in DataFrame 1 based on DataFrame 2 values.</p>
<p>But I dont want to join the two dataframes per say and make one big dataframe, but rather use the second Dataframe simply as a look-up.</p>
<pre><code>#Main Dataframe:
df1 = pd.DataFrame({'Size':["Big... | <python><pandas> | 2023-01-02 21:11:15 | 2 | 1,747 | mikelowry |
74,987,080 | 1,546,710 | Keras Concatenate and Lambda not recognized as Layer, TypeError: The added layer must be an instance of class Layer | <p>I have been unable to find a solution for my problem. The below (with and without Lambda) does not recognize the result of Concatenate as a Layer:</p>
<pre class="lang-py prettyprint-override"><code>tensors = []
for item in items:
tensor = tf.constant(item, dtype=tf.string, shape=[1])
tensors.append(tensor)
... | <python><tensorflow><machine-learning><tf.keras> | 2023-01-02 21:09:32 | 1 | 3,415 | aug2uag |
74,986,826 | 2,540,336 | How does NumPy in-place sort work on views? | <p>Could you please help me understand the output of these two sorting attempts:</p>
<p>Attempt 1</p>
<pre class="lang-py prettyprint-override"><code>import numpy as np
a = np.array([1, 2, 3])
a[::-1].sort()
print(a)
# prints [3 2 1]
</code></pre>
<p>I somehow understand that <code>a[::-1]</code> is a view and hence so... | <python><numpy> | 2023-01-02 20:35:53 | 2 | 597 | karpan |
74,986,796 | 13,536,496 | Setting up HTTPS for Elastic Beanstalk single instance Python (FastAPI) application | <p>Please note: No Load Balancers. I'm specifically looking for solutions with single instances.</p>
<p>Greetings! As the title suggests, I'm having trouble setting up HTTPS with a self signed certificate (certbot) for an EB instance running python.</p>
<p>To get started, I did follow the instructions here <a href="htt... | <python><ssl><https><amazon-elastic-beanstalk><fastapi> | 2023-01-02 20:31:05 | 0 | 352 | Mark |
74,986,791 | 11,400,377 | Tkinter not updating when changing variables | <p>I'm tinkering with Tkinter and trying to check if my program is open on pressing a button, but the Tkinter is not updating my label. Why?</p>
<pre class="lang-py prettyprint-override"><code>from win32gui import GetWindowRect, FindWindow
from tkinter import Tk, ttk, BooleanVar
class Bot:
root = Tk()
i... | <python><tkinter> | 2023-01-02 20:30:02 | 2 | 993 | Cholewka |
74,986,775 | 159,072 | How can I send a message from server to client using socketIO? | <p>I want to send a message from server app to the html page. So, I wrote the following code.</p>
<p>However, the html page is showing nothing.</p>
<p>What am I doing incorrectly?</p>
<p><strong>server_sends_client_receives.py</strong></p>
<pre><code>from flask import Flask, render_template
from flask_socketio import S... | <python><flask><flask-socketio> | 2023-01-02 20:28:35 | 2 | 17,446 | user366312 |
74,986,587 | 7,694,216 | Python Structural Pattern Matching: str(True) doesn't match into str(True) | <p>I've found an unexpected behaviour for Python structural pattern matching that I want to discuss today.<br />
All the code there is run with CPython 3.10.8</p>
<p>So, let's take a look on the code below</p>
<pre class="lang-py prettyprint-override"><code>match str(True):
case str(True): print(1)
case str(F... | <python><python-3.x><pattern-matching><python-3.10><structural-pattern-matching> | 2023-01-02 20:04:46 | 1 | 456 | inyutin |
74,986,461 | 6,020,161 | Load a Python XGBoost as SparkXGBoost? | <p>Is there a way to take a model object trained in base XGBoost and load it as a SparkXGBoost model? The docs aren't super clear on this split. I've tried:</p>
<pre><code>from xgboost.spark import SparkXGBClassifierModel
model2 = SparkXGBClassifierModel.load("xgboost-model")
</code></pre>
<p>Im getting the f... | <python><pyspark><xgboost> | 2023-01-02 19:47:11 | 1 | 340 | Alex |
74,986,333 | 11,092,636 | tqdm and pytest INTERNALERROR> UnicodeEncodeError: 'charmap' codec can't encode characters in position 245-254: character maps to <undefined> | <p>MRE:</p>
<p><code>test_test.py</code>:</p>
<pre><code>import main
def test_file() -> None:
main.main("qfqsdfsqdds")
assert True
</code></pre>
<p><code>main.py</code>:</p>
<pre><code>from tqdm import tqdm
def main(username: str):
for i in tqdm(range(10)):
a = i + 1
</code></pre>
<p>... | <python><pycharm><pytest><tqdm> | 2023-01-02 19:29:33 | 1 | 720 | FluidMechanics Potential Flows |
74,986,298 | 275,002 | Strugglign to pass string and int parameters from Python to Go library | <p>I have the go library with the following signature:</p>
<pre><code>//export getData
func getData(symbol string, day int, month string, year int) string {
return "getData2"
}
</code></pre>
<p>In Python I did like the below:</p>
<pre><code>import ctypes
library = ctypes.cdll.LoadLibrary('./lib.so')
get_d... | <python><go><ctypes><cgo> | 2023-01-02 19:24:37 | 1 | 15,089 | Volatil3 |
74,986,221 | 8,610,286 | Given a list of Wikidata identifiers, is there a way to find which ones are directly related using Python and/or SPARQL? | <p>I have a list of Wikidata IDs and I want to find which of those are subclasses (P279) of others.</p>
<p>Let's suppose I have the list in pseudocode <code>["Q42" (Douglas Adams) , "Q752870" (motor vehicle) , "Q1420" (motor car), "Q216762" (hatchback car) </code>].</p>
<p>I'm tr... | <python><sparql><wikidata> | 2023-01-02 19:14:38 | 1 | 349 | Tiago Lubiana |
74,986,098 | 13,583,054 | How to use Async or Multithread on Azure Managed Endpoint | <p>I deployed a model using Azure ML managed endpoint, but I found a bottleneck.</p>
<p>I'm using Azure ML Managed Endpoint to host ML models for object prediction. Our endpoint receives a URL of a picture and is responsible for downloading and predicting the image.</p>
<p>The problem is the bottleneck: each image is d... | <python><machine-learning><azure-machine-learning-service> | 2023-01-02 19:00:09 | 1 | 384 | Juliano Negri |
74,985,998 | 8,588,743 | Adding percentages to Venn-diagram using matplotlib_venn | <p>I have a data frame that looks like this:</p>
<pre><code> customerid brand
0 A2222242BG84 A
1 A2222255LD3L B
2 A2222255LD3L A
3 A2222263537U A
4 A2222265CE34 C
... ... ...
6679602 A9ZZ86K4VM97 B
6679603 A9ZZ9629MP6E B
6679604 A9ZZ9629MP6E C
6679... | <python><python-3.x><venn-diagram><matplotlib-venn> | 2023-01-02 18:45:44 | 1 | 903 | Parseval |
74,985,970 | 1,870,832 | Convert np datetime64 column to pandas DatetimeIndex with frequency attribute set correctly | <p>Reproducing the data I have:</p>
<pre><code>import numpy as np
import pandas as pd
dts = ['2016-01-01', '2016-02-01', '2016-03-01', '2016-04-01',
'2016-05-01', '2016-06-01', '2016-07-01', '2016-08-01',
'2016-09-01', '2016-10-01', '2016-11-01', '2016-12-01',
'2017-01-01', ... | <python><pandas><numpy><datetime><indexing> | 2023-01-02 18:42:18 | 1 | 9,136 | Max Power |
74,985,825 | 8,059,615 | Scraping Aliexpress search page does not return all products | <p>I have the below code, which I expect to return 60 products, but instead only returns 16:</p>
<pre><code>driver = webdriver.Firefox(service=Service(GeckoDriverManager().install()))
url = 'https://www.aliexpress.com/w/wholesale-silicone-night-light.html?SearchText=silicone+night+light"&"catId=0"&a... | <python><selenium><selenium-webdriver><web-scraping><beautifulsoup> | 2023-01-02 18:23:48 | 2 | 405 | Yousef |
74,985,816 | 13,745,926 | How to use gradient descent for cosine similarity optimization? | <p>so I have a vector A with 1508 dimensions that is defined, I have another list of n vectors in a list called C. Each of the n vectors is attributed a weight, and a vector B is defined by the following for each dimension : The weight times the first dimension of it's vector + the second weight times the first dimensi... | <python><tensorflow><optimization><vector><gradient-descent> | 2023-01-02 18:22:26 | 0 | 417 | Constantly Groovin' |
74,985,802 | 8,549,300 | Mask python array based on multiple column indices | <p>I have a 64*64 array, and would like to mask certain columns. For one column I know I can do:</p>
<pre><code>mask = np.tri(64,k=0,dtype=bool)
col = np.zeros((64,64),bool)
col[:,3] = True
col_mask = col + np.transpose(col)
col_mask = np.tril(col_mask)
col_mask = col_mask[mask]
</code></pre>
<p>but how to extend this... | <python><arrays><numpy> | 2023-01-02 18:20:43 | 1 | 361 | firefly |
74,985,762 | 2,079,306 | Curl issue. JSON.loads() works fine with python-requests, but fails when using curl to the flask API. Changes all double quotes to single | <p>TypeError: the JSON object must be str, bytes or bytearray, not 'dict'</p>
<p>I have a flask server that is running:</p>
<pre><code>@app.route('/getMyData', methods=['GET'])
def getMyData():
data = json.loads(request.get_json()) # get JSON string and load to python dict
# TYPE ERROR OCCURS HERE
</code></pre>
<... | <python><json><flask><curl> | 2023-01-02 18:14:56 | 1 | 1,123 | john stamos |
74,985,747 | 8,372,455 | pyTest for UDP protocol scripts | <p>Would anyone have a pyTest tip if its possible to use with a Python BACnet library called <a href="https://bac0.readthedocs.io/en/latest/" rel="nofollow noreferrer">BAC0</a>? I have never used pyTest before just curious if there would be any boiler plate scripts and if my ideology is on track or not.</p>
<p>I have a... | <python><pytest><bacnet><bac0><bacpypes> | 2023-01-02 18:13:45 | 1 | 3,564 | bbartling |
74,985,713 | 11,806,116 | Plotting a 3D vector field on 2D plane in Python | <p>I would like to plot a 3D vector field on a 2D plane.</p>
<p><a href="https://i.sstatic.net/AvE5P.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/AvE5P.png" alt="an example data" /></a>
i tried plotting but not able to get a 3D view of the vector fields</p>
<p>any help would be highly appreciated and ... | <python><plot><3d> | 2023-01-02 18:09:33 | 1 | 495 | code-freeze |
74,985,638 | 1,473,517 | How to plot points over a violin plot? | <p>I have four pandas Series and I plot them using a violin plot as follows:</p>
<pre><code>import seaborn
seaborn.violinplot([X1['total'], X2['total'], X3['total'], X4['total']])
</code></pre>
<p>I would like to plot the values on top of the violin plot so I added:</p>
<pre><code>seaborn.stripplot([X1['total'], X2['to... | <python><matplotlib><seaborn><violin-plot> | 2023-01-02 17:59:41 | 1 | 21,513 | Simd |
74,985,619 | 95 | virtualenv creation fails with error "StopIteration" | <p>In attempt to slim down a Docker image with a large Python environment, I tried removing as many files and directories as possible (cached packages, <code>__pycache__</code> directories, <code>.pyc</code>, <code>.md</code>, <code>.txt</code> files, etc).</p>
<p>Now <code>pre-commit</code> initialization fails becaus... | <python><virtualenv><python-packaging> | 2023-01-02 17:57:01 | 1 | 17,398 | Marek Grzenkowicz |
74,985,498 | 6,843,153 | why do I have to add a higher folder when opening a file in python when debugging? | <p>I have a directory tree similar to this:</p>
<pre><code>my_application
my_component
process_config.py
process_config.yaml
runner.py
</code></pre>
<p>I launch <code>python runner.py</code> and it calls a class inside <code>process_config.py</code> that reads the yaml file like this:</p>
<pre><... | <python><visual-studio-code><debugging> | 2023-01-02 17:42:54 | 0 | 5,505 | HuLu ViCa |
74,985,482 | 11,083,136 | Sum of sines and cosines from DFT | <p>I have a signal and want to reconstruct it from its spectrum as a sum of sines and/or cosines. I am aware of the inverse FFT but I want to reconstruct the signal in this way.</p>
<p>An example would look like this:</p>
<pre class="lang-py prettyprint-override"><code>sig = np.array([1, 5, -3, 0.7, 3.1, -5, -0.5, 3.2,... | <python><numpy> | 2023-01-02 17:41:17 | 0 | 566 | Dominik Ficek |
74,985,447 | 3,880,849 | PyCharm: namedtuple: unexpected argument, unfilled parameter | <p>In PyCharm, you can declare a named tuple.</p>
<pre><code>from collections import namedtuple
InstTyp = namedtuple(
typename='InstTyp',
field_names='''
instance_type
memory
num_cpus
'''
)
</code></pre>
<p>Code that uses the named tuple runs without error.</p>
<pre><code>it = I... | <python><collections><pycharm><namedtuple><code-inspection> | 2023-01-02 17:37:36 | 2 | 936 | Brian Fitzgerald |
74,985,335 | 7,236,133 | Pandas data frame - Group a column values then Randomize new values of that column | <p>I have one column (X) that contains some values with duplicates (several rows have the same value and they all are sequenced).
I have a requirement to randomize new values for that columns for testing one issue. so I tried:</p>
<pre><code>np.random.seed(RSEED)
df["X"] = np.random.randint(100, 500, df.shape... | <python><pandas> | 2023-01-02 17:24:56 | 1 | 679 | zbeedatm |
74,985,248 | 3,457,513 | How to combine Mixins and Protocols in Python | <p>I'm trying to understand the correct way to use <code>Protocol</code>s for ensuring the inheritor of a <code>Mixin</code> contains all the attributes needed by the <code>Mixin</code> to operate correctly. The <code>Mixin</code>s are part of an existing codebase, so will be hard to change the design but I will do it ... | <python><python-3.x><protocols> | 2023-01-02 17:13:02 | 0 | 1,045 | vahndi |
74,985,212 | 4,878,848 | How can I Convert 'pyspark.dbutils.DBUtils' to 'dbruntime.dbutils.DBUtils' in Databricks | <p>I am working on a project where we have some helper functions that uses dbutils and they were initially used as notebook but now they got converted to python modules. Now I cannot access those methods as they cannot find dbutils.</p>
<p>I searched for ways of using dbutils in a way that I can call that from notebook... | <python><pyspark><databricks><dbutils> | 2023-01-02 17:09:12 | 0 | 3,076 | Nikunj Kakadiya |
74,985,163 | 10,045,805 | How can I parse the unit : "g/100mL" using unit-parse in Python? | <p>I'm trying to parse strings in Python, looking for scientific values and units. I want to retrieve them in order to convert them to some other units.</p>
<p>I'm using the library <a href="https://pint.readthedocs.io/en/0.20.1/advanced/defining.html" rel="nofollow noreferrer">unit-parse</a> (based on <a href="https:/... | <python><text-parsing><units-of-measurement><pint> | 2023-01-02 17:04:06 | 2 | 380 | cuzureau |
74,985,086 | 1,169,091 | Why do Categories columns take up more space than the Object columns? | <p>When I run this code and look at the output of info() the DataFrame that uses Category types seems to take more space (932 bytes) then the DataFrame that uses Object types (624 bytes).</p>
<pre><code>def initData():
myPets = {"animal": ["cat", "alligator", "snake&quo... | <python><pandas> | 2023-01-02 16:56:27 | 1 | 4,741 | nicomp |
74,985,024 | 19,363,912 | Find a value in next td tag with bs4 | <p>Any way to pick the value <code>6.543</code> (ignoring <code><b></code>), belonging to next <code><td></code> after <code>Hello Friend </code>?</p>
<pre><code> <tr>
<td align="right" colspan="4">
Hey Hello Friend
</td>
<td align="right">
2... | <python><html><beautifulsoup> | 2023-01-02 16:49:20 | 2 | 447 | aeiou |
74,984,988 | 18,756,733 | Print None if pd.read_html can't find any tables | <p>I want to print the table if it exists.</p>
<pre><code>import pandas as pd
main_url='https://fbref.com/en/comps/9/2000-2001/2000-2001-Premier-League-Stats'
squad_advanced_goalkeeping=pd.read_html(main_url,match='Squad Advanced Goalkeeping')[0] if pd.read_html(main_url,match='Squad Advanced Goalkeeping') else None
... | <python><web-scraping> | 2023-01-02 16:44:49 | 1 | 426 | beridzeg45 |
74,984,983 | 19,797,660 | Dataframe get max() from multiple columns in a rolling window - Shape Error | <p><strong>EDIT 2:</strong></p>
<p>Considier the question closed.
After I gave the example in the first EDIT I have realised that I am senslessly looking through all of the columns looking for Highest value, since the <code>High</code> column will always have the highest value and the following code is sufficient:</p>
... | <python><pandas> | 2023-01-02 16:44:30 | 0 | 329 | Jakub Szurlej |
74,984,788 | 3,004,472 | how to remove string ending with specific string | <p>I have file names like</p>
<pre><code>ios_g1_v1_yyyymmdd
ios_g1_v1_h1_yyyymmddhhmmss
ios_g1_v1_h1_YYYYMMDDHHMMSS
ios_g1_v1_g1_YYYY
ios_g1_v1_j1_YYYYmmdd
ios_g1_v1
ios_g1_v1_t1_h1
ios_g1_v1_ty1_f1
</code></pre>
<p>I would like to remove only the suffix when it matches the string YYYYMMDDHHMMSS OR yyyymmdd OR YYYYmm... | <python><string> | 2023-01-02 16:24:56 | 5 | 880 | BigD |
74,984,700 | 14,895,107 | why am i getting this cloudflare error on replit? | <p>I am getting this cloudflare error</p>
<p><a href="https://i.sstatic.net/PWsvy.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/PWsvy.png" alt="enter image description here" /></a></p>
<p>Things I have tried :</p>
<p>1.) running <code>kill 1</code> in shell</p>
<p>2.) regenerating token</p>
<p>3.) crea... | <python><discord><discord.py><cloudflare><replit> | 2023-01-02 16:16:15 | 0 | 903 | Abhimanyu Sharma |
74,984,548 | 8,280,171 | how to read specific lines of list in yaml to python | <p>I have 2 files, first is <code>ip_list.yaml</code> which is</p>
<pre><code>globals:
hosted_zone: "test.com"
endpoint_prefix: defalt
ip_v4:
- 123
- 234
- 456
ip_v6:
- 123
- 234
- 345
</code></pre>
<p>and the other one is <code>network.py</code></p>
<pre><code># Creatin... | <python><yaml> | 2023-01-02 16:02:17 | 1 | 705 | Jack Rogers |
74,984,387 | 2,803,488 | How do I avoid global variables when using MQTT callbacks | <p>I am incrementing a global variable in my on_receive callback, to track how many messages have been received. I need to know this count for testing purposes.</p>
<p>Since global variables are generally considered a code smell, is there a way to avoid using global variables in this situation?</p>
<p>Here is my callb... | <python><callback><mqtt><global><paho> | 2023-01-02 15:46:22 | 1 | 455 | Adam Howell |
74,984,186 | 9,778,828 | Pandas read_SQL response is supposed to be in Hebrew, but I get gibberish instead | <p>I have a python script in which I make an SQL query to my Teradata server.</p>
<p>I use teradatasql python library for that:</p>
<pre><code>conn = tdSQL.connect(logmech=logmech, host=host)
query = "SELECT * FROM table"
df = pandas.read_sql(query, conn)
</code></pre>
<p>And instead of getting the "Hebr... | <python><sql><pandas><encoding><teradata> | 2023-01-02 15:27:27 | 2 | 505 | AlonBA |
74,984,168 | 9,439,097 | Pydantic generate json-schema enforcing field requirements | <p>I have the following model, where the field <code>b</code> is a list whose length is additionally enforced based on the value of field <code>a</code>.</p>
<pre class="lang-py prettyprint-override"><code>from pydantic import BaseModel, validator
from enum import Enum
class A(BaseModel):
a: int
b: list[int]
... | <python><json><validation><jsonschema><pydantic> | 2023-01-02 15:25:27 | 0 | 3,893 | charelf |
74,984,025 | 4,451,315 | when / then / otherwise with values from numpy array | <p>Say I have</p>
<pre class="lang-py prettyprint-override"><code>df = pl.DataFrame({'group': [1, 1, 1, 3, 3, 3, 4, 4]})
</code></pre>
<p>I have a numpy array of values, which I'd like to replace <code>'group'</code> 3 with</p>
<pre class="lang-py prettyprint-override"><code>values = np.array([9, 8, 7])
</code></pre>
<... | <python><dataframe><python-polars> | 2023-01-02 15:09:28 | 3 | 11,062 | ignoring_gravity |
74,983,997 | 16,665,831 | Decoding json message inside of string | <p>I have the following decoding function;</p>
<pre class="lang-py prettyprint-override"><code>def flatten_data(json_data):
"""
Arguments:
json_data (dict): json data
Returns:
dict : {a:1, b:2, b_c:1, b_d:2}
"""
out = {}
def flatten(x, name=''):
... | <python><json><json-deserialization><jsondecoder> | 2023-01-02 15:07:27 | 2 | 309 | Ugur Selim Ozen |
74,983,882 | 12,415,855 | Change value of the input date-box using selenium? | <p>i would like to change / select the date to "12/03/2022" on this website:</p>
<p><a href="https://www.cyberarena.live/schedule-efootball" rel="nofollow noreferrer">https://www.cyberarena.live/schedule-efootball</a></p>
<p>with the following code:</p>
<pre><code>from selenium import webdriver
from selenium.... | <python><selenium> | 2023-01-02 14:56:15 | 1 | 1,515 | Rapid1898 |
74,983,829 | 1,973,005 | Why is python's datetime conversion wrong in one direction? | <p>I am trying to convert a timezone aware <code>datetime.datetime</code> object to UTC and make it naive. For the conversion, I use the following code:</p>
<pre class="lang-py prettyprint-override"><code>from datetime import datetime
import pytz
dt: datetime = datetime(2023, 1, 2, 12, 0, 0, tzinfo=pytz.timezone("... | <python><datetime><timezone><pytz> | 2023-01-02 14:51:28 | 1 | 1,097 | Axel Köhler |
74,983,751 | 4,451,521 | Using parameters for pytest when parameters depend on each other | <p>I am writing a pytest test for a library similar to this</p>
<pre><code>from mylibrary use do_some_calculation
def test_df_against_angle():
df=load_some_df()
angle=30
result=do_some_calculation(df,angle)
assertTrue(result)
</code></pre>
<p>Now as you can see that test only works for a particular da... | <python><pytest> | 2023-01-02 14:45:17 | 2 | 10,576 | KansaiRobot |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.