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,359,017 | 15,215,859 | FileNotFoundError: [Errno 2] No such file or directory: while exporting a parquet file from pandas dataframe | <p>I am basically trying to export a parquet file inside GCS cloud bucket as shown below in my code which is a GCP cloud function where i am getting error in the line "chunk.to_parquet(parquet_file_path, engine='fastparquet', compression='snappy')" saying -" No such file or directory: 'new_folder_2023020... | <python><python-3.x><google-cloud-platform><pyspark> | 2023-02-06 08:40:40 | 1 | 317 | Tushaar |
75,358,989 | 736,312 | PySimpleGUI - Binding shortcut key to one element of a sub-layout | <p>Thank you for reading this.</p>
<p>I am searching for a standard solution but couldn't find one.<br>
I have a simple layout made out of two layouts and the first layout is the one used to create the window.</p>
<p><a href="https://i.sstatic.net/rgarN.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/rga... | <python><pysimplegui> | 2023-02-06 08:36:37 | 1 | 796 | Toyo |
75,358,678 | 1,897,151 | opencv detecting website form image for certain icon to determine the field | <p>trying to use opencv on python with this as opening</p>
<pre><code>import cv2
img = cv2.imread("image2.jpg")
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
edges = cv2.Canny(gray, 50, 150)
contours, _ = cv2.findContours(edges, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
for contour in contours:
# te... | <python><selenium><opencv> | 2023-02-06 08:01:02 | 0 | 503 | user1897151 |
75,358,527 | 15,358,800 | Pandas reversing Data Frames giving strange results | <p>Let's say I've a df</p>
<pre><code> value
2023-02-01 a
2023-02-02 b
2023-02-03 c
2023-02-04 d
</code></pre>
<p>when I try to reverse <code>df</code> and after doing some operations If i reverse back It not showing complete df Like</p>
<pre><code>import pandas as pd
df = pd.DataFrame(
{&... | <python><pandas><dataframe><reverse> | 2023-02-06 07:41:32 | 0 | 4,891 | Bhargav |
75,358,506 | 1,308,967 | How do you incrementally add lexeme/s to an existing Django SearchVectorField document value through the ORM? | <p>You can add to an existing Postgresql <code>tsvector</code> value using <code>||</code>, for example:</p>
<pre class="lang-sql prettyprint-override"><code>UPDATE acme_table
SET my_tsvector = my_tsvector ||
to_tsvector('english', 'some new words to add to existing ones')
WHERE id = 1234;
</code></pre>
<p>I... | <python><django><postgresql><full-text-search> | 2023-02-06 07:39:12 | 0 | 6,522 | Chris |
75,358,443 | 10,722,752 | How to get original string values of encoded categorical columns in Lime graph | <p>I am trying to work on local explainability using Lime graph. Before building the model, I encode some of the categorical variables.</p>
<p>Sample Data and code:</p>
<pre><code>import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.pre... | <python><pandas><scikit-learn><lime> | 2023-02-06 07:29:41 | 1 | 11,560 | Karthik S |
75,358,422 | 10,867,713 | Is there any command that points me to the kubeconfig file in k8s/openshift | <p>Is there any command which points me to the path where kubeconfig file is present?
I mean I am working on python k8s/openshift client. I am looking for linux or python command or libraries which can print me the path where kubeconfig file is present.</p>
<p>By default kubeconfig is present it home most of the time, ... | <python><linux><kubernetes><openshift> | 2023-02-06 07:27:25 | 2 | 409 | majid asad |
75,358,285 | 8,696,281 | How to generate numeric mapping for categorical columns in pandas? | <p>I want to manipulate categorical data using pandas data frame and then convert them to <code>numpy</code> array for model training.</p>
<p>Say I have the following data frame in pandas.</p>
<pre><code>import pandas as pd
df2 = pd.DataFrame({"c1": ['a','b',None], "c2": ['d','e','f']})
>>>... | <python><pandas><dataframe><torch><categorical-data> | 2023-02-06 07:09:09 | 1 | 783 | noobie2023 |
75,358,246 | 12,331,179 | Nested Json Using pyspark | <p>We have to build nested json using below structure in pyspark and i have added data that need to feed using this</p>
<p>Input Data structure</p>
<p><a href="https://i.sstatic.net/Jep4n.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Jep4n.png" alt="enter image description here" /></a></p>
<p>Data</p>
... | <python><json><pyspark><nested-loops><nested-json> | 2023-02-06 07:02:38 | 1 | 386 | Amol |
75,358,230 | 4,732,175 | How to upgrade pypy itself? | <p>I've installed <code>pypy</code> by <code>conda</code>:</p>
<pre><code>conda create -n pypy37 pypy python=3.7
</code></pre>
<p>and pypy version is:</p>
<pre><code>Python 3.7.12 | packaged by conda-forge | (44db2626, Oct 29 2021, 16:19:11)
[PyPy 7.3.7 with GCC Clang 11.1.0]
</code></pre>
<p>Now I want to upgrade <co... | <python><pypy> | 2023-02-06 07:01:14 | 1 | 11,212 | Zhang Buzz |
75,358,101 | 7,784,797 | Could not use `streamlit` to annotate a dataset of multiple labels | <p>I am trying to build an annotation interface using <code>streamlit</code>.</p>
<p>In my dataset, each data point may have multiple labels (i.e. <code>labels</code> in the code below). However, I could only select one label using <code>st.multiselect()</code> rather than the expected "multiple select". Spec... | <python><frontend><streamlit> | 2023-02-06 06:44:55 | 1 | 349 | Mr.Robot |
75,357,968 | 3,650,087 | How to use read-only, shared memory (as NumPy arrays) in multiprocessing | <p>Following the documentation for shared memory <a href="https://docs.python.org/3/library/multiprocessing.shared_memory.html#multiprocessing.shared_memory.SharedMemory" rel="nofollow noreferrer">here</a>, I have implemented a minimal example of accessing NumPy arrays backed with shared memory in a function called by ... | <python><numpy><multiprocessing><shared-memory> | 2023-02-06 06:23:04 | 1 | 2,666 | Acoop |
75,357,888 | 4,117,975 | How to scrape the content from all the div tags which also contain another tag? | <p>The website I am trying to scrape has all of its content laid out under the same <code>div</code> class type: <code>mock-div</code>. Upon inspecting its HTML, the relevant content is only present under those <code>div</code> tags which also contain the <code>figure</code> tag. What should be the correct XPath?</p>
<... | <python><web-scraping><scrapy> | 2023-02-06 06:12:32 | 2 | 1,258 | Amogh Mishra |
75,357,850 | 8,168,294 | Pandas select columns ordered at the beginning and the rest remain unchanged | <p>For example, I have dataframe with many columns, with the number of columns not clear, e.g.. between 10 and 20.</p>
<p>The column name in the follows:</p>
<p><code>RecordID, price, company, date, feature1, return, some_inf, feature2, feature3, ... </code></p>
<p>Sample data:</p>
<pre><code>column_names = ["Reco... | <python><pandas><dataframe> | 2023-02-06 06:07:19 | 1 | 382 | XYZ |
75,357,816 | 6,403,044 | Getting an error when tried to scrape data from instagram | <p>I am trying to use <code>instagramy</code> python package to scrape some instagram data, by following this tutorial: <a href="https://pypi.org/project/instagramy/" rel="nofollow noreferrer">https://pypi.org/project/instagramy/</a></p>
<p>I used following lines of code (I have used a fake seesion id in this post)</p>... | <python><web-scraping><instagram> | 2023-02-06 06:01:51 | 1 | 1,012 | student_R123 |
75,357,643 | 13,132,728 | Query/Filter a pandas df using a dict of lists | <h2><strong>My problem</strong></h2>
<p>I have a dict <code>d</code> that can be of varying length consisting of the following format:</p>
<pre><code>d = {
"foo": [
50,
100
],
"bar": [
5,
10
]
}
</code></pre>
<p>Where the key is a column name and the value is a two length lis... | <python><pandas> | 2023-02-06 05:31:55 | 2 | 1,645 | bismo |
75,357,630 | 11,901,732 | Compare <class 'pandas._libs.tslibs.timestamps.Timestamp'>, str and datetime64[ns] dates in Python | <p>I need to query using dates of various data types, the data and their corresponding data types are listed below:</p>
<pre><code>last_month_year: <class 'str'> ** Used `pd.to_datetime()` and got `<class 'pandas._libs.tslibs.timestamps.Timestamp'>` format
current_month_year: <class 'str'>
df['Year_Mo... | <python><pandas><date> | 2023-02-06 05:30:27 | 1 | 5,315 | nilsinelabore |
75,357,468 | 9,249,533 | matplotlib supylabel on second axis of multiplot | <p>I'm not finding it possible to add a second supylabel for a right-hand y-axis of a multiplot.</p>
<p>Can anyone please confirm 1) whether or not it can be done and/or 2)provide guidance on how?</p>
<p>I am trying to achieve this:
<a href="https://i.sstatic.net/FMLxz.png" rel="noreferrer"><img src="https://i.sstatic.... | <python><matplotlib><axis-labels><yaxis> | 2023-02-06 05:01:15 | 1 | 2,399 | CreekGeek |
75,357,151 | 6,494,707 | How to convert the distance between the object and the camera from pixels to meter? | <p>I need to convert the distance between the object and the camera from <code>pixels</code> to <code>meter/cm</code> frame by frame and then calculate the speed of the moving object. In the first frame, the distance of the object from the camera is <code>4 meter</code>, and the Focal length FL = 8mm. The width of the ... | <python><object-detection><camera-calibration><opencv> | 2023-02-06 03:40:24 | 2 | 2,236 | S.EB |
75,357,092 | 233,347 | Nested dictionary or list using given unindent data using Python | <p>Hi I have given below data but its unindent only using total keyword I can find the right nodes and can build tree structure.
Input:</p>
<pre><code>Current Assets
Cash
Checking 583961
Savings 224600
Petty Cash 89840
Total Cash 898402
Accounts Receivable 3593607
Work in Process 589791
Other Current As... | <python><list><dictionary><tree> | 2023-02-06 03:29:36 | 1 | 5,165 | prashant thakre |
75,357,031 | 3,351,474 | Python requirements.txt restrict dependency to be installed only on atom processors | <p>I'm using TensorFlow under inside an x64_64 environment, but the processor is an Intel Atom processor. This processor lacks the AVX processor extension and since the pre-built wheels for TensorFLow are complied with the AVX extension TensorFLow does not work and exits. Hence I had to build my own wheel and I host it... | <python><pip><python-packaging><requirements.txt><pyproject.toml> | 2023-02-06 03:13:53 | 1 | 6,458 | k_o_ |
75,357,022 | 3,247,006 | How to automatically fill all info in the 2nd payment but not 3rd or 4th payments in Stripe? | <p>With the Django's code below, I'm testing <a href="https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_method_options-card-setup_future_usage" rel="nofollow noreferrer">payment_method_options.card.setup_future_usage</a> in <strong>Stripe Checkout</strong> in <code>test</code> mode:</... | <python><django><django-views><stripe-payments><checkout> | 2023-02-06 03:12:26 | 1 | 42,516 | Super Kai - Kazuya Ito |
75,356,848 | 12,458,212 | Regex - removing everything after first word following a comma | <p>I have a column that has name variations that I'd like to clean up. I'm having trouble with the regex expression to remove everything after the first word following a comma.</p>
<pre><code>d = {'names':['smith,john s','smith, john', 'brown, bob s', 'brown, bob']}
x = pd.DataFrame(d)
Tried:
x['names'] = [re.sub(r'/... | <python><regex> | 2023-02-06 02:27:11 | 2 | 695 | chicagobeast12 |
75,356,723 | 1,358,829 | Tensorflow.data.Dataset.rejection_resample modifies my dataset's element_spec | <p>I am trying to use <code>tf.data.Dataset.rejection_resample</code> to balance my dataset, but I am running into an issue in which the method modifies the <code>element_spec</code> of my dataset, making it incompatible with my models.</p>
<p>The original element spec of my dataset is:</p>
<pre class="lang-py prettypr... | <python><tensorflow><machine-learning><tensorflow-datasets> | 2023-02-06 01:50:46 | 2 | 1,232 | Alb |
75,356,710 | 6,004,338 | Duck Typing Annotations in Python3 | <p>I am trying to add a type annotation to a function input argument that is a <code>dataclass</code> with attributes that overlap with another <code>dataclass</code>, which actually gets passed in as an input argument.</p>
<p>Consider the following code:</p>
<pre class="lang-py prettyprint-override"><code>from datacla... | <python><python-3.x><duck-typing> | 2023-02-06 01:48:01 | 1 | 690 | Sean |
75,356,685 | 5,363,621 | Python delete rows for each group after first occurance in a column | <p>I Have a dataframe as follows:</p>
<pre><code>df = pd.DataFrame({'Key':[1,1,1,1,2,2,2,4,4,4,5,5],
'Activity':['A','A','H','B','B','H','H','A','C','H','H','B'],
'Date':['2022-12-03','2022-12-04','2022-12-06','2022-12-08','2022-12-03','2022-12-06','2022-12-10','2022-12-03','2022-1... | <python><pandas> | 2023-02-06 01:39:54 | 3 | 915 | deega |
75,356,644 | 6,534,818 | Python Async what is causing the memory leak? | <p>I am downloading zip files and looking inside them to check their contents for a few million items, but I am constantly accruing memory and I will eventually go OOM, even with small semaphores.</p>
<p>Consider the block:</p>
<pre><code> async def zip_reader(self, blobFileName, blobEndPoint, semaphore):
t... | <python><python-asyncio> | 2023-02-06 01:29:31 | 1 | 1,859 | John Stud |
75,356,619 | 14,109,040 | Scraping table of data from webpage with inconsistently nested html tags | <p>I am trying to scrape some data off of the tables in <a href="https://www.ptv.vic.gov.au/footer/data-and-reporting/network-performance/daily-performance/" rel="nofollow noreferrer">https://www.ptv.vic.gov.au/footer/data-and-reporting/network-performance/daily-performance/</a>
Specifically, I want to scrape the 'Metr... | <python><web-scraping><beautifulsoup><html-table> | 2023-02-06 01:22:53 | 1 | 712 | z star |
75,356,413 | 3,810,748 | How does pytorch automatically know what are my model's parameters? | <p>I have defined the custom class as follows:</p>
<pre><code>class MLPClassifier(nn.Module):
"""
A basic multi-layer perceptron classifier with 3 layers.
"""
def __init__(self, input_size, hidden_size, num_classes):
"""
The constructor for... | <python><pytorch> | 2023-02-06 00:18:35 | 1 | 6,155 | AlanSTACK |
75,356,400 | 6,760,729 | How to parallel for loop in Sagemaker Processing job | <p>I'm running a python code on Sagemaker Processing job, specifically SKLearnProcessor. The code run a for-loop for 200 times (each iteration is independent), each time takes 20 minutes.
for example: script.py</p>
<pre><code>for i in list:
run_function(i)
</code></pre>
<p>I'm kicking off the job from a notebook:</p... | <python><amazon-web-services><distributed-computing><amazon-sagemaker><embarrassingly-parallel> | 2023-02-06 00:15:48 | 1 | 585 | SKSKSKSK |
75,356,395 | 14,224,000 | Cannot create weak reference to 'Weakcallableproxy' object in Pytorch Module | <p>When i run my project in my system it was running fine, but when i made it as nvidia-docker2 container and run it i am getting the following error :</p>
<p>I ensured my pytorch version, cuda version are almost same in both the environments, whereas python version differs , 3.10 in my system, 3.8 in the docker contai... | <python><pytorch><garbage-collection><nvidia-docker> | 2023-02-06 00:14:27 | 1 | 931 | NavinKumarmMNK |
75,356,215 | 420,827 | DataFrame groupby on each item within a column of lists | <p>I have a dataframe (<code>df</code>):</p>
<pre class="lang-markdown prettyprint-override"><code>| A | B | C |
| --- | ----- | ----------------------- |
| CA | Jon | [sales, engineering] |
| NY | Sarah | [engineering, IT] |
| VA | Vox | [services, engineering] |
</code></pr... | <python><pandas> | 2023-02-05 23:25:34 | 1 | 551 | Manas |
75,356,081 | 1,893,275 | Print whole numbers as integers in Pandas LaTeX conversion | <p>I'm trying to write a small script to print LaTeX tables based on CSV.
A lot of the functionality formerly in e.g. <code>matrix2latex</code> have now been included in Pandas proper, which is cool.</p>
<p>However, no matter what I do (I tried a number of the other suggestions on here, it ended up becoming a convolute... | <python><pandas><csv><types><latex> | 2023-02-05 22:57:26 | 3 | 18,114 | TheChymera |
75,356,060 | 15,011,362 | How can I get quantity with SP API Python | <p>I need a product's unit of stock(quantity). Is it possible with SP API, if possible how can I get it?</p>
<p>Note: I can get it with SKU like the following code but the product is <strong>not listed</strong> by my sellers.</p>
<pre><code>from sp_api.api import Inventories
quantity = Inventories(credentials=credentia... | <python><amazon-selling-partner-api> | 2023-02-05 22:54:14 | 1 | 452 | Melisa |
75,356,032 | 654,019 | error in installing ultralytics in python as they have conflicting dependencies | <p>I am trying to install ultralytics in a visual environment and I am getting this error message:</p>
<pre><code>pip install ultralytics
Collecting ultralytics
Using cached ultralytics-8.0.6-py3-none-any.whl (251 kB)
Collecting hydra-core>=1.2.0
Using cached hydra_core-1.3.1-py3-none-any.whl (154 kB)
Collecting... | <python><pytorch> | 2023-02-05 22:48:06 | 1 | 18,400 | mans |
75,356,007 | 20,959,773 | How to keep JavaScript values between multiple pages in one session? | <p>I have this code:</p>
<pre><code>from selenium.common import TimeoutException, WebDriverException
from selenium import webdriver
import sys
class Main:
def _init_(self, page_url):
self.driver = webdriver.Chrome()
self.element_list = []
self.page_url = page_url
def javascript(self):... | <javascript><python><html><selenium> | 2023-02-05 22:42:51 | 0 | 347 | RifloSnake |
75,355,852 | 8,696,281 | How do I get columns that are generated by pandas.get_dummies()? | <p>I have the following dataframe:</p>
<pre><code>>>> df
n1 n2 dense c1 c2 c3
0 1 4 [1, 4] a h1 tt
1 2 5 [2, 5] b bbw ebay
2 3 6 [3, 6] c we yahoo
</code></pre>
<p>If I want to create a one-hot encoding columns for <code>c1, c2, c3</code> columns:</p>
<pre><code>>&g... | <python><pandas><dataframe> | 2023-02-05 22:07:32 | 1 | 783 | noobie2023 |
75,355,711 | 482,819 | Modify an attribute of an already defined class in Python (and run its definition again) | <p>I am trying to modify an already defined class by changing an attribute's value. Importantly, I want this change to propagate internally.</p>
<p>For example, consider this class:</p>
<pre class="lang-py prettyprint-override"><code>class Base:
x = 1
y = 2 * x
# Other attributes and methods might follow
... | <python><class><metaclass><inject> | 2023-02-05 21:40:08 | 2 | 6,143 | Hernan |
75,355,708 | 17,696,880 | Why are these negative-lookaheads failing to constrain a regex pattern that decides when to perform substitutions with the re.sub() function? | <pre class="lang-py prettyprint-override"><code>import re
#Example input:
input_text = "en la montaña a las (2023_-_02_-_04(19:00 pm)) o a las 2023_-_02_-_04 19:00 pm aasassa 2023_-_02_-_04 sdshdhshj 19:00 pm 2023_-_02_-_04 fgfg"
date_format_00 = r"(\d*)_-_(\d{2})_-_(\d{2})" # Y*_-_MM_DD
identif... | <python><python-3.x><regex><regex-group><regexp-replace> | 2023-02-05 21:39:27 | 0 | 875 | Matt095 |
75,355,572 | 7,376,511 | poetry + watchmedo + uwsgi: unrecognized arguments | <p>I have a uWSGI application that I want to monitor with watchmedo, and is under a poetry environment.</p>
<p>Unfortunately, the following does not work:</p>
<pre><code>poetry run watchmedo auto-restart --directory=./ --pattern="*.py;*.yml;*.html" --recursive -- uwsgi --ini=uwsgi.ini
</code></pre>
<p>This co... | <python><uwsgi><python-poetry> | 2023-02-05 21:16:37 | 1 | 797 | Some Guy |
75,355,560 | 14,676,485 | Visualizing density function - difference between displot() and plot() | <p>I visualize density function (PDF) using two plotting approaches: <code>displot()</code> and <code>plot()</code>. I don't understand why <code>displot()</code> doesn't produce normally distributed plot wheras <code>plot()</code> do this perfectly. Density plots should look alike but they don't. What's wrong with <co... | <python><statistics><seaborn><data-science> | 2023-02-05 21:15:06 | 1 | 911 | mustafa00 |
75,355,269 | 2,716,241 | Installing GDAL for python in Google Cloud Functions -- error when deploying | <p>I've been unsuccessful in using GDAL in a Google Cloud Function with Python 3.9. I've included gdal in the "requirements.txt" file:</p>
<pre><code>numpy
pygrib
requests
google-cloud-storage
gdal
</code></pre>
<p>But get the following error when deploying the function:</p>
<pre><code>Build failed: .../setup... | <python><installation><pip><google-cloud-functions><gdal> | 2023-02-05 20:22:12 | 1 | 545 | TheGeographer |
75,355,268 | 15,724,084 | python tkinter waiting for an input to be inputted by user | <p>I have a code snippet. Entry widget creates itself with text, then waits seconds then destroys itself.</p>
<pre><code> entry_var_temporary = tk.StringVar()
entry_var_temporary.set(varsoundTitle_usernameHeroContainer)
entry_shtname_temp=tk.Entry(canvas2,width=30,textvariable=entry_var_temporary)
entry_... | <python><tkinter> | 2023-02-05 20:22:05 | 2 | 741 | xlmaster |
75,355,213 | 3,484,568 | How can I update a linearmodels PanelResults object with custom bootstrap estimates? | <p>I built my own class to implement an estimation procedure (call it <code>EstimationProcedure</code>). To run the procedure, the user calls method <code>fit</code>. First, this fits a Pooled OLS model using the <a href="https://bashtage.github.io/linearmodels/panel/panel/linearmodels.panel.model.PooledOLS.fit.html#li... | <python><oop><linearmodels> | 2023-02-05 20:13:51 | 2 | 618 | Jhonny |
75,354,898 | 7,895,542 | Python get meta data for hidden files on windows | <p>I have been using the replies from <a href="https://stackoverflow.com/questions/12521525/reading-metadata-with-python">here</a> to read out the metadata of files on windows.
However i noticed that it would just ignore hidden files.</p>
<p>How can one also include hidden files in this approach?</p>
| <python><winapi><pywin32> | 2023-02-05 19:21:34 | 1 | 360 | J.N. |
75,354,886 | 7,318,120 | copying modules from python 3.10 to 3.11 (does not work) | <p>I am trying to copy modules from python <code>3.10</code> to <code>3.11</code>.
I am using <code>windows 11</code>.</p>
<ul>
<li>My understanding is that one just downloads and install the new version of python.</li>
<li>I make sure that <code>python is added to path</code>.</li>
</ul>
<p>i follow this instruction: ... | <python><pip><upgrade> | 2023-02-05 19:19:46 | 1 | 6,075 | darren |
75,354,878 | 106,140 | Python making tuple of an array with a step 2 | <pre><code>els = [1, 2, 3, 4, ]
print([(v, els[idx + 1]) for idx, v in enumerate(els[::2])])
</code></pre>
<p>Why does Python output <code>[(1, 2), (3, 3)]</code> instead of <code>[(1, 2), (3, </code><strong>4</strong><code>)]</code>?</p>
<p>PS: I know I could do this: <code>[(els[i], els[i + 1]) for i in range(0,len(e... | <python><loops> | 2023-02-05 19:18:26 | 1 | 15,858 | Olivier Pons |
75,354,825 | 9,843,081 | Creating Python Chart withThree Axis | <p>Suppose I have the following data for five different categories:
<a href="https://i.sstatic.net/rLcZi.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/rLcZi.png" alt="enter image description here" /></a></p>
<p>I would like to create a figure showing the mean (and the 1-std.-band around the return) in ... | <python><pandas><matplotlib><seaborn><figure> | 2023-02-05 19:12:27 | 0 | 643 | John |
75,354,820 | 13,440,165 | Extracting from an array of strings, strings that contain a substring in them (Python) | <p>A question in Python (3.9.5) and Pandas:</p>
<p>Suppose I have an array of strings <code>x</code> and I want to extract all the elements that contains a certain substring, e.g. <code>feb05</code>. Is there a Pythonic way to do it in one-line, including using a Pandas functions?</p>
<p>Example for what I mean:</p>
<p... | <python><pandas><string> | 2023-02-05 19:11:44 | 2 | 883 | Triceratops |
75,354,780 | 15,341,457 | How can I make this Indexing algorithm more efficient? | <p>I've got a Dataframe (deriving from a csv file with various columns) with 172033 rows. I've created a custom indexing function that blocks pairs of records that haven't got similar 'name' attributes. The problem resides in the efficiency of the algorithm. Just to get to the 10th iteration it takes about a minute. Th... | <python><pandas><performance><for-loop><indexing> | 2023-02-05 19:04:20 | 4 | 332 | Rodolfo |
75,354,767 | 6,611,672 | Why is dataclasses.as_dict a function instead of a method | <p>I know I can convert a Python dataclass to a dictionary using the <code>asdict</code> function:</p>
<pre><code>from dataclasses import asdict, dataclass
@dataclass
class Point:
x: int
y: int
point = Point(1, 2)
asdict(point)
# {'x': 1, 'y': 2}
</code></pre>
<p>Why is <code>asdict</code> a separate functio... | <python><python-dataclasses> | 2023-02-05 19:01:23 | 0 | 5,847 | Johnny Metz |
75,354,503 | 5,203,628 | Azure Functions Python V2 Timer Trigger Does Not Deploy but Status Success in VSCode | <p>I am deploying a very basic Azure Functions App to demonstrate a few key features.</p>
<p>I have two functions, one demonstrating an HTTP Trigger and the other demonstrating a Timer Trigger. Both run perfectly on local instance.</p>
<pre><code>import azure.functions as func
import os
import datetime
import logging
... | <python><visual-studio-code><azure-functions><timer-trigger> | 2023-02-05 18:19:13 | 2 | 1,146 | Rob S. |
75,354,384 | 12,671,057 | Why is b.pop(0) over 200 times slower than del b[0] for bytearray? | <p>Letting them compete three times (a million pops/dels each time):</p>
<pre><code>from timeit import timeit
for _ in range(3):
t1 = timeit('b.pop(0)', 'b = bytearray(1000000)')
t2 = timeit('del b[0]', 'b = bytearray(1000000)')
print(t1 / t2)
</code></pre>
<p>Time ratios (<a href="https://tio.run/##hZDBas... | <python><arrays><performance><cpython><python-internals> | 2023-02-05 18:04:17 | 2 | 27,959 | Kelly Bundy |
75,354,311 | 15,365,513 | How can I convert a tensor with the shape of [1, 3, 64, 64] to [1, 4, 64, 64] with the newly added layer being the same as the previous? | <p>I have a PyTorch tensor with the shape of <code>[1, 3, 64, 64]</code>, and I want to convert it to the shape <code>[1, 4, 64, 64]</code> while setting the value of the newly added layer to be the same as the previous layer in the same dimension (eg <code>newtensor[0][3] = oldtensor[0][2]</code>)</p>
<p>Note that my ... | <python><pytorch><tensor> | 2023-02-05 17:52:10 | 2 | 691 | raspiduino |
75,354,216 | 14,193,915 | How to insert a row into a multiindex dataframe so that rows sum to the total? | <p>I have a multi index dataframe that I want to insert a row into.</p>
<pre><code>>>>import numpy as np
>>>import pandas as pd
>>> date = pd.date_range('2023-01-01', periods=3)
>>> size = ['s','m','total']
>>> arrays = [date, size]
>>> index = pd.MultiIndex.from_pr... | <python><pandas><dataframe><multi-index> | 2023-02-05 17:35:22 | 1 | 831 | jgg |
75,354,115 | 7,713,770 | How to filter with rest api django? | <p>I have this model:</p>
<pre><code>class Item(models.Model):
category = models.CharField(max_length=255)
subcategory = models.CharField(max_length=255)
name = models.CharField(max_length=255)
amount = models.PositiveIntegerField()
def __str__(self) -> str:
... | <python><django><django-rest-framework> | 2023-02-05 17:21:35 | 0 | 3,991 | mightycode Newton |
75,354,106 | 12,439,119 | Python unittest that at least one exception is raised | <p>Is there a way to get <code>unittest</code> standard library to check for multiple exceptions?</p>
<p>Obviously <code>assertRaises</code> works for a single exception: <a href="https://stackoverflow.com/questions/129507/how-do-you-test-that-a-python-function-throws-an-exception">How do you test that a Python functio... | <python><unit-testing><error-handling><python-unittest> | 2023-02-05 17:20:07 | 1 | 4,303 | Alexander L. Hayes |
75,354,104 | 15,479,269 | python web scraping for emails | <p>I wrote this code to scrape email addresses from google search results or websites depending on t url given. However, the output is always blank.</p>
<p>The only thing in the excel sheet is the column name. I'm still new to python so not sure why that's happening.</p>
<p>What am I missing here?</p>
<pre><code>import... | <python><pandas><web-scraping><beautifulsoup> | 2023-02-05 17:19:48 | 2 | 703 | someone |
75,353,986 | 2,652,254 | How can I place a pdf asset into a empty PDF page? | <p>I have multiple PDF files with small sizes (e.g. 3cm x 2 cm) exported from Adobe Indesign.
I want to compose many of these into one new PDF which has the size of a whole page.
The small PDFs contain a plotter line in a special color which would get lost if I convert them into images.</p>
<p>How can I place these PDF... | <python><pdf><pdfbox><pypdf> | 2023-02-05 17:00:46 | 2 | 460 | Iarwa1n |
75,353,844 | 2,023,397 | Select a button with Selenium | <p>I have a webpage I am trying to fill in. In the middle of the page there is a button i need to click, whose info in the inspection are as follow:</p>
<pre><code><label class="btn btn-default col-md-6 ng-binding active btn-success" ng-class="{'btn-success active': paziente.consenso_informato == 1 }&... | <python><selenium> | 2023-02-05 16:35:49 | 2 | 397 | Gloria Dalla Costa |
75,353,644 | 10,535,123 | How does PySpark work behind the scene when using a Python module which should load files? | <p>Let's say I have the two following python projects -</p>
<pre><code>PROJECT A
class FeatureBuilder:
def __init__(self):
self.artifact = read_artifacts_from_s3()
def create_features(self):
# do something with artifact
</code></pre>
<pre><code>PROJECT B
from pyspark.sql import DataFrame
from... | <python><pandas><apache-spark><pyspark> | 2023-02-05 16:04:31 | 1 | 829 | nirkov |
75,353,556 | 6,027,879 | python module ZipFile get base folder using regex | <p>Assume this zip file "acme_example.zip" contains below content of the files/folders :</p>
<pre><code>acme/one.txt
acme/one1.txt
acme/one2.txt
acme/one3.txt
acme/one4.txt
__MACOSX
.DS_Store
</code></pre>
<p>And i am using this below script</p>
<pre><code> output_var = []
skip_st = '__MACOSX'
wit... | <python><python-re> | 2023-02-05 15:52:03 | 1 | 406 | hare krshn |
75,353,529 | 14,790,056 | how to count unique values after groupby ID | <p>I have the following pandas dataframe <strong>df</strong></p>
<pre><code>ID from to
A 0x 0c
A 0x 0f
A 0f 0n
B 0f 0c
B 0c 0f
C 0k 0j
C 0j 0k
C 0k 0a
</code></pre>
<p>First I want to group by <code>id</code> and only keep groups if the number of unique values from <co... | <python><pandas><dataframe> | 2023-02-05 15:47:39 | 1 | 654 | Olive |
75,353,488 | 21,092,961 | ModuleNotFoundError: No module named 'numpy' But numpy module already installed | <p>Error:
<a href="https://i.sstatic.net/zJaIe.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/zJaIe.png" alt="enter image description here" /></a>
I have already installed numpy module(<code>pip show numpy</code>):</p>
<p><a href="https://i.sstatic.net/TwZjy.png" rel="nofollow noreferrer"><img src="http... | <python><numpy><modulenotfounderror> | 2023-02-05 15:43:43 | 2 | 659 | Amith A G |
75,353,413 | 1,864,294 | subprocess returns different output than shell | <p>Short context: Github's <code>gh</code> client adds ANSI colors to its JSON output, which is nice but makes post process hard. So if you pipe the output, gh makes a slightly different and regularly encoded output, for example:</p>
<pre><code>gh api organizations | cat
</code></pre>
<p>prints something like</p>
<pre>... | <python><shell><subprocess><pipe><github-cli> | 2023-02-05 15:35:12 | 0 | 20,605 | Michael Dorner |
75,353,367 | 10,377,640 | psycopg.OperationalError: connection failed: Connection refused in Docker | <p>so I tried to connect my docker app (python-1) into another docker app (postgres). But it giving me this error:</p>
<pre><code>psycopg.OperationalError: connection failed: Connection refused
python-1 | Is the server running on host "localhost" (127.0.0.1) and accepting
python-1 | ... | <python><docker><docker-compose> | 2023-02-05 15:28:32 | 1 | 931 | alramdein |
75,353,111 | 7,713,770 | how to get relationship with one-to-many on same table? | <p>I am using django and rest api. And I have two models:</p>
<pre><code>class Category(models.Model):
name = models.CharField(max_length=100)
slug = models.SlugField(max_length=100)
images = models.ImageField(upload_to="photos/categories")
category = models.ForeignKey("Category",... | <python><django><django-rest-framework> | 2023-02-05 14:47:03 | 1 | 3,991 | mightycode Newton |
75,353,032 | 73,137 | How to pass a variable sized array to TensorFlow Lite model | <p>I am trying to find how I can pass a dynamic-sized array (not fixed size) into my TensorFlow.</p>
<p>I am building an Android App to read Accelerometer values and predict an activity. I have built a TensorFlow model and am able to successfully import <code>.tflite</code> file into my Android.</p>
<pre><code>converte... | <python><android><tensorflow><accelerometer><tensorflow-lite> | 2023-02-05 14:34:03 | 1 | 9,986 | SyncMaster |
75,352,822 | 12,494,765 | I get UnicodeDecodeError while running Flask | <p>UnicodeDecodeError: 'utf-8' codec can't decode byte 0x99 in position 0: invalid start byte while I tried to start a Flask Server.</p>
<p>The following is the code</p>
<pre class="lang-py prettyprint-override"><code>from flask import Flask
app = Flask(__name__)
app.run(debug=True, port=5000)
</code></pre>
<p>This gen... | <python><python-dotenv> | 2023-02-05 14:01:55 | 1 | 388 | Danwand N S |
75,352,810 | 11,006,089 | How to web scrap Economic Calendar data from TradingView and load into Dataframe? | <p>I want to load the Economic Calendar data from TradingView link and load into Dataframe ?</p>
<pre><code>Link: https://in.tradingview.com/economic-calendar/
Filter-1: Select Data for India and United States
Filter-2: Data for This Week
</code></pre>
<p><a href="https://i.sstatic.net/Ftb28.png" rel="nofollow noreferr... | <python><python-3.x><pandas><selenium><web-scraping> | 2023-02-05 14:00:27 | 1 | 465 | Rohit |
75,352,799 | 11,963,167 | Creating an empty dataframe in pandas with column of type datetime64[ns, Europe/Paris] | <p>I want to create an empty dataframe in pandas with a single column 'time'. I also want it to be of type <code>datetime64[ns, 'Europe/Paris']</code>, ie. to be able to store timezone-aware timestamps.</p>
<p>I actually need to return an empty dataframe under certain conditions, but I still want to be able to perform ... | <python><pandas><dataframe><numpy><python-datetime> | 2023-02-05 13:58:35 | 1 | 496 | Clej |
75,352,728 | 11,079,284 | How to get a high-quality image from an IIIFv21 API in Python? | <p>I have an <code>info.json</code> file in the IIIFv21 format, and I want to use it to retrieve high-quality image tiles. We can use, for example, the file that is available <a href="https://iiif.nli.org.il/IIIFv21/FL202979482/info.json" rel="nofollow noreferrer">here</a> and looked like:</p>
<pre><code>> {
"... | <python><image><web-scraping><iiif> | 2023-02-05 13:48:00 | 1 | 1,052 | Yanirmr |
75,352,480 | 7,665,821 | NameError when putting variable declaration in if __name__ == '__main__': | <p>I have a Python file named <code>main.py</code>. I am running it on Python 3.9.13 on Windows.
import uvicorn
from fastapi import FastAPI</p>
<pre><code>app = FastAPI()
@app.post('/c')
async def c(b: str):
print(a)
if __name__ == '__main__':
a = load_embeddings('embeddings')
uvicorn.run('main:app', host... | <python><variables><fastapi><uvicorn> | 2023-02-05 13:08:08 | 1 | 381 | Billy Cao |
75,352,393 | 5,141,652 | Python tkinter dynamic checkbutton method | <p>I have a settings page with lots of checkbuttons on it so I am trying to reduce the code but I am struggling when it comes to getting the checkbutton value to work so far I have:-</p>
<pre><code>def _create_checkbox(self, label, index, state=0):
x = label.replace(" ", "-").lower()
self.se... | <python><tkinter> | 2023-02-05 12:55:00 | 2 | 1,037 | Chris |
75,351,935 | 2,749,397 | BoundaryNorm, unexpected behavior | <p><em>My code:</em></p>
<pre><code>import numpy as np
import matplotlib.pyplot as plt
from matplotlib import colors
x = y = np.linspace(0, 10, 51)
X, Y = np.meshgrid(x, y)
Z = X+Y # Z.min() => 0, Z.max() => 20
cf = plt.contourf(X, Y, Z,
levels=[5, 10, 15],
norm=colors.Bounda... | <python><matplotlib><colorbar><colormap><normalize> | 2023-02-05 11:37:57 | 1 | 25,436 | gboffi |
75,351,892 | 6,810,805 | How can i add several audio tracks in moviepy to support different languages? | <p>Now i have a moviepy code that sets an audio to my CompositeVideoClip:</p>
<pre><code>video = CompositeVideoClip([sequence])
video = video.set_audio(audio)
</code></pre>
<p>I would like to localize my video by adding additional soundtracks to it. Smth like this</p>
<pre><code>video = CompositeVideoClip([sequence])
l... | <python><localization><video-processing><moviepy> | 2023-02-05 11:30:16 | 0 | 1,758 | Mike Kovetsky |
75,351,823 | 3,735,871 | PySpark- How to handle source data schema change | <p>I'm trying to use PySpark to read from Avro file into dataframe, do some transformations and write the dataframe out to HDFS as hive tables using the code below. The file format for the hive tables is parquet.</p>
<pre><code>df.write.mode("overwrite").format("hive").insertInto("mytable"... | <python><dataframe><apache-spark><pyspark><hive> | 2023-02-05 11:17:41 | 3 | 367 | user3735871 |
75,351,791 | 10,666,587 | Numpy close range equivalent to `x <values < z` | <p>If I am looking for a boolean array whether my array is in a close range, I can use the next code:</p>
<pre><code>import numpy as np
vals = np.arange(10)
in_range = (vals < 8) & (vals > 3) # equiv to np.logical_and([vals < 8, vals > 3])
</code></pre>
<p>For the upper code, I wished to have an alter... | <python><numpy> | 2023-02-05 11:08:55 | 0 | 328 | Shaq |
75,351,688 | 1,184,717 | ruamel.yaml dump explicit/dereferenced data | <p>Using <code>ruamel.yaml</code>, how to (1) produce exactly the same input (same order, comments, references, aliases, anchor) and (2) how to produce a dereferenced values?</p>
<p>For instance, given the following code</p>
<pre class="lang-py prettyprint-override"><code>import sys
import ruamel.yaml
yaml_input = &qu... | <python><yaml> | 2023-02-05 10:50:29 | 1 | 10,220 | Mr. |
75,351,618 | 9,640,238 | Export DataFrame timedelta column to timestamp Excel column | <p>I have a DataFrame that contains a <code>datetime64</code> and a <code>timedelta64</code>. Unfortunately, I can't export the latter to a properly formatted <code>hh:mm:ss</code> column in an Excel file:</p>
<pre class="lang-py prettyprint-override"><code>import pandas as pd
data = {
"date": [
... | <python><excel><pandas><dataframe><xlsxwriter> | 2023-02-05 10:37:21 | 2 | 2,690 | mrgou |
75,351,547 | 9,279,753 | Equivalent C structure in Python | <p>I have the following in C:</p>
<pre><code>typedef struct {
short Whole;
unsigned short Frac;
} FirstStruct, FAR *pFirstStruct;
typedef struct {
char FirstArr[3];
FirstStruct SecondArr[3][3]
} SecStruct, FAR * pSecStruct;
</code></pre>
<p>I would like to do something similar in Python. Found... | <python><c><ctypes> | 2023-02-05 10:26:29 | 2 | 599 | Jose Vega |
75,351,526 | 3,146,582 | Can't start PyGame Zero (pgzrun) from cmd | <p>I can't start PyGame Zero window from cmd. According to book I bought my kid, I suppose to start it with</p>
<pre><code>pgzrun test.py
</code></pre>
<p>Unfortunteally what I get is:</p>
<pre><code>'pgzrun' is not recognized as an internal or external command,
operable program or batch file.
</code></pre>
<p>As a Pyt... | <python><pgzero> | 2023-02-05 10:22:15 | 3 | 751 | Tomek |
75,351,398 | 196,489 | python-gnupg always returning empty decryption result | <p>I am using this piece of code to generate a key, encrypt some content and then decrypt it</p>
<pre><code>with tempfile.TemporaryDirectory() as tmpdir:
gpg = gnupg.GPG(gnupghome=str(tmpdir), verbose=True)
gpg.encoding = 'utf-8'
input_data = gpg.gen_key_input(
key_type='RSA',
key_length=204... | <python><gnupg><python-gnupgp> | 2023-02-05 09:57:38 | 0 | 12,904 | Thorben Croisé |
75,351,387 | 4,053,840 | Passing azure secret variables to pytest in pipeline? | <p>We are running integration tests, written in Python, in Azure Pipeline. These tests access a database, and the credentials for accessing the database are stored in a variable group in Azure, including secret variables. This is the part of the yaml file, where the integration tests are started:</p>
<pre><code>jobs:
-... | <python><azure><environment-variables><pipeline> | 2023-02-05 09:54:44 | 1 | 483 | Ivajlo Iliev |
75,351,259 | 3,735,871 | Write multiple Avro files from pyspark to the same directory | <p>I'm trying to write out dataframe as Avro files from PySpark dataframe to the path <code>/my/path/</code> to HDFS, and partition by the col 'partition', so under <code>/my/path/</code> , there should be the following sub directory structures</p>
<pre><code>partition= 20230101
partition= 20230102
....
</code></pre>
... | <python><apache-spark><pyspark><hdfs><avro> | 2023-02-05 09:27:06 | 1 | 367 | user3735871 |
75,351,252 | 887,651 | Link Django models together via GenericKey? | <p>i have the following models:</p>
<pre><code>class Team(models.Model):
users = models.ManyToManyField("User")
class User(AbstractUser):
...
class Subscription(models.Model):
team = models.ForeignKey("Team", on_delete=models.CASCADE)
name = models.CharField(max_length=64)... | <python><django><database><django-models> | 2023-02-05 09:26:16 | 2 | 4,644 | Dail |
75,350,843 | 3,415,077 | What is the recommended async Oracle driver for SQLAlchemy 2.0? | <p>We are developing an asynchronous Python-based server using SQLAlchemy 2. So far, asynchronous access to PostgreSQL, MySQL and SQLite work fine. However, we cannot find an async driver for Oracle.</p>
| <python><oracle-database><sqlalchemy> | 2023-02-05 08:01:59 | 1 | 2,242 | Juergen Zimmermann |
75,350,817 | 3,507,584 | Plotly - Remove axis ticks and numbers but keep label | <p>In this MWE, I have a plot with ticks and labels.</p>
<pre><code>fig = go.Figure(data=go.Scatter(x=[2.3], y=[5.3], mode='markers'))
fig.update_xaxes(range=[0,10], constrain="domain",title_text="Some x label",title_font={"size":22,"color":"black"}, showgrid=False)
fig... | <python><plotly><axis><axis-labels> | 2023-02-05 07:55:18 | 2 | 3,689 | User981636 |
75,350,689 | 305,135 | Pandas merging value of two rows in columns of a single row | <p>I have data like this, it's output of a <strong>groupby</strong>:</p>
<pre><code>numUsers = df.groupby(["user","isvalid"]).count()
count
user isvalid
5 0.0 1336
1.0 387
</code></pre>
<p>But I need to have cou... | <python><pandas><aggregate> | 2023-02-05 07:26:23 | 2 | 19,540 | AVEbrahimi |
75,350,612 | 1,800,459 | How to get user's IP address using Amazon API Gateway and FastAPI? | <p>I am using Amazon API Gateway that forwards requests to a FastAPI server (I am not using nginx). I am trying to get the user's IP address in a FastAPI endpoint, but it does not seem to be working (<code>x_forwarded_for</code> is empty).</p>
<p>Here is a snippet of my FastAPI backend:</p>
<pre><code>@app.post("/... | <python><amazon-web-services><fastapi><aws-api-gateway><x-forwarded-for> | 2023-02-05 07:06:21 | 0 | 1,134 | AJ222 |
75,350,533 | 722,553 | How do I validate using pytest that my Python code is not logging any stack traces? | <p>I would like to use pytest to check that my function is not generating any stack trace data into logs, e.g. via <a href="https://docs.python.org/3/library/logging.html#logging.exception" rel="nofollow noreferrer">logging.exception()</a>, but the <code>caplog</code> object (<a href="https://docs.pytest.org/en/7.1.x/h... | <python><pytest><python-logging> | 2023-02-05 06:43:54 | 1 | 3,593 | Dawngerpony |
75,350,508 | 305,135 | Pandas equivalent of SQL Group By while concatenating columns | <p>Suppose I have table having following columns:
firstname, surname, tel</p>
<p>something like this :</p>
<pre><code>firstname surname tel
alex topol 1234
jim jimix 2312
alex topol 2344
</code></pre>
<p>now I want to find numberof tel per person and sort, so I write this i... | <python><sql><pandas><dataframe> | 2023-02-05 06:33:13 | 1 | 19,540 | AVEbrahimi |
75,350,446 | 14,154,784 | TemplateDoesNotExist at /accounts/login/ | <p>I have checked the answers <a href="https://stackoverflow.com/questions/65199789/how-to-change-default-template-auth-login-in-django-this-is-not-working">here</a>, <a href="https://stackoverflow.com/questions/46846923/django-loginview-doesnt-override-attributes">here</a>, <a href="https://stackoverflow.com/questions... | <python><django><django-views><django-templates><django-urls> | 2023-02-05 06:14:22 | 1 | 2,725 | BLimitless |
75,350,417 | 1,112,406 | How do instances of Andrej Karpathy's BigramLanguageModel run as functions with no `__call__` function? | <p>Andrej Karpathy's nanoGPT defines <a href="https://colab.research.google.com/drive/1JMLa53HDuA-i7ZBmqV7ZnA3c_fvtXnx-?usp=sharing" rel="nofollow noreferrer"><code>BigramLanguageModel</code></a> as follows.</p>
<pre><code>class BigramLanguageModel(nn.Module):
def __init__(self):
super().__init__()
... | <python><call> | 2023-02-05 06:00:18 | 1 | 2,758 | RussAbbott |
75,350,395 | 19,504,610 | How should we manage datetime fields in SQLModel in python? | <p>Let's say I want to create an API with a <code>Hero</code> SQLModel, below are minimum viable codes illustrating this:</p>
<pre><code>from typing import Optional
from sqlmodel import Field, Relationship, SQLModel
from datetime import datetime
from sqlalchemy import Column, TIMESTAMP, text
class HeroBase(SQLModel): ... | <python><fastapi><pydantic><sqlmodel> | 2023-02-05 05:54:14 | 2 | 831 | Jim |
75,350,113 | 19,716,381 | Delete numpy arrays from memory after loading into tensorflow | <p>I have 4 numpy arrays <code>x_train</code>, <code>x_test</code>, <code>y_train</code>, <code>y_test</code> which consume about 5GB of memory. I have loaded these into tensorflow with the following code.</p>
<pre class="lang-py prettyprint-override"><code>train_dataset = tf.data.Dataset.from_tensor_slices((x_train, y... | <python><numpy><tensorflow> | 2023-02-05 04:25:54 | 3 | 484 | berinaniesh |
75,350,111 | 11,280,068 | dagster can you trigger a job to run via an api? | <p>I have been looking all over for the answer, but can't seem to find what I'm looking for</p>
<p>I want to create an api endpoint that can pass information to the dagster assets and trigger a run. For example, I have the following asset in dagster</p>
<pre><code>@asset
def player_already_registered(player_name: str):... | <python><python-3.x><rest><pipeline><dagster> | 2023-02-05 04:24:37 | 1 | 1,194 | NFeruch - FreePalestine |
75,350,107 | 11,969,592 | How to pull the total balance on an SPL token for a wallet address in solana (python) | <p>I'm looking to get the token balance for an SPL token in solana based on the:</p>
<ul>
<li>Wallet address of the token holder</li>
<li>The token address</li>
</ul>
<p>How can I do this?</p>
<p>I thought it would be something like:</p>
<pre class="lang-py prettyprint-override"><code>import requests
import os
url = o... | <python><solana> | 2023-02-05 04:23:27 | 1 | 6,207 | Patrick Collins |
75,350,097 | 5,869,383 | Python array: remove one dimension from a tuple that only has one 1D list | <p>I have one tuple that only has one list element <code>a = ((3, 2, 2, 2, 2), )</code>, whose length is <code>1</code>; can I remove one dimension from it to achieve <code>(3, 2, 2, 2, 2)</code>, whose length is <code>5</code>? Thank you!</p>
<pre><code>>>> a1 = ((3, 2, 2, 2, 2),)
>>> print(len(a1))
... | <python> | 2023-02-05 04:19:53 | 1 | 644 | debug_all_the_time |
75,350,072 | 2,205,916 | `pipreqs` generating blank requirements.txt in Docker Container | <p>I am using Python in a Jupyter Lab notebook in a Docker container. I have the following code in one cell:</p>
<pre><code>import numpy as np
import os
import pandas as pd
</code></pre>
<p>Then I run the following cell:</p>
<pre><code>!pipreqs /app/loaded_reqs
</code></pre>
<p>and get:</p>
<pre><code>INFO: Successfull... | <python><docker> | 2023-02-05 04:12:03 | 1 | 3,476 | user2205916 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.