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 ⌀ |
|---|---|---|---|---|---|---|---|---|
77,128,332 | 4,734,217 | How to remove dictionary keys before a specific one (in insertion order)? | <p>There is a <strong>dictionary</strong></p>
<pre><code>dic = {
'aa': 10,
'bb': 11,
'cc': 12,
'dd': 13,
'ee': 14,
'ff': 15,
}
</code></pre>
<p>How to remove the specified key - let's say <strong>'cc': 12</strong>, and all the keys before it (in order of insertion)?</p>
<p>I need to get the foll... | <python><dictionary> | 2023-09-18 15:06:51 | 3 | 460 | Michael |
77,128,325 | 9,518,890 | apsw.SQLError: SQLError: no such vfs: zipvfs when trying to read encrypted SQLite files on Windows using python & apsw | <p>I have a code that works under linux and I am trying to port it to windows. It uses apsw to work with encrypted SQLite files.</p>
<pre><code>flags = apsw.SQLITE_OPEN_READWRITE | apsw.SQLITE_OPEN_CREATE | apsw.SQLITE_OPEN_URI
connection_string = (
"file:{filepath}?zv=zlib&level=9&vfs=zipvfs&passwo... | <python><sqlite><zlib><apsw> | 2023-09-18 15:05:48 | 1 | 14,592 | Matus Dubrava |
77,128,200 | 512,480 | Windows pip3 and python3 disagree | <p>I've been having a problem that python3 from the command line fails to find and import packages installed by pip3 from the command line. Finally I got a clear view of the situation:</p>
<pre><code>C:\Users\Ken>where python3
C:\msys64\mingw64\bin\python3.exe
C:\Users\Ken\AppData\Local\Microsoft\WindowsApps\python3... | <python><pip> | 2023-09-18 14:48:52 | 1 | 1,624 | Joymaker |
77,128,122 | 75,103 | How do I create collapsible sections in the gitlab output from inside python script? | <p>According to the docs it should be simple:</p>
<pre><code>@contextmanager
def gitlab_section(name, header):
print(f'\033[0Ksection_start:{int(time.time())}:{name}[collapsed=true]\r\033[0K{header}')
yield
print(f'\033[0Ksection_end:{int(time.time())}:{name}:\r\033[0K')
</code></pre>
<p>however, using it l... | <python><gitlab><gitlab-ci> | 2023-09-18 14:34:58 | 1 | 27,572 | thebjorn |
77,128,073 | 7,383,799 | Python Numpy 'Invert' Boolean Mask Operation | <p>When I have an array a and a boolean mask b, I can find the 'masked' vector c.</p>
<pre><code>a = np.array([1, 2, 4, 7, 9])
b = np.array([True, False, True, True, False])
c = a[b]
</code></pre>
<p>Now suppose, it's the other way around. I have c and b and would like to arrive at d (below). What is the easiest way t... | <python><numpy><boolean> | 2023-09-18 14:27:40 | 1 | 375 | eigenvector |
77,127,986 | 5,128,087 | nektos/act - local github runner, how to reference local Platform (-P) image without needing docker.io | <p>How to run a local or non-docker image using nektos/act?</p>
<p>Nektos act by default attempts to login to docker.io to pull a remote image, is it possible to use a locally cached image?</p>
| <python><docker><nektos-act> | 2023-09-18 14:14:31 | 1 | 725 | Brian Horakh |
77,127,719 | 1,420,429 | filtering pandas dataframe rows by applying a function | <p>I have a pandas dataframe that has about 5 columns. One columns values are wrong strings.</p>
<blockquote>
<p>e.g. abspodfahoidf</p>
</blockquote>
<p>I have written a function to validate if this is a valid string (some characters are not allowed in the string).</p>
<p>Is there anyway that I can apply that function ... | <python><pandas> | 2023-09-18 13:37:25 | 3 | 2,503 | harish |
77,127,666 | 4,542,117 | Python Iteratively Fill Missing Values with Non-missing Values | <p>Let's say that I have 10 arrays with shape MxN. I want to iteratively loop through each array and fill in values where missing values are located in an initialized array.</p>
<p>For an example, let's take a 3x3 grid:</p>
<pre><code>initial_array = np.full((3,3),-999)
array([[-999, -999, -999],
[-999, -999, -9... | <python><arrays> | 2023-09-18 13:30:34 | 2 | 374 | Miss_Orchid |
77,127,629 | 20,088,885 | Why I can't see my custom app I created in Odoo? | <p>so I've been trying to learn Odoo16 development, and I'm following the documentation, but the problem is, after I enable the <code>access rights</code> i can't see my custom app in the general settings.</p>
<p>This is my directory.</p>
<p><a href="https://i.sstatic.net/FtsQe.png" rel="nofollow noreferrer"><img src="... | <python><xml><odoo> | 2023-09-18 13:25:50 | 1 | 785 | Stykgwar |
77,127,588 | 10,952,047 | error loading package "scvelo" on Rstudio using python environment | <p>I'm using python environment in <code>Rstudio</code> to load some packages, but when I try to load "scvelo" I found this message. I don't know where it comes from</p>
<pre><code>>>> import scvelo as scv
Traceback (most recent call last):
File "<string>", line 1, in <module&... | <python><r><import> | 2023-09-18 13:20:41 | 0 | 417 | jonny jeep |
77,127,551 | 6,557,593 | How to display Start-Stop bands across horizontal time axis | <p>We want to display productive time on the phone, by employee, in a simple 1-dimensional time-axis chart.</p>
<p>Green in the chart represents time on the phone (between 'start' and 'stop':</p>
<p><a href="https://i.sstatic.net/XD7TD.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/XD7TD.png" alt="enter... | <python><powerbi> | 2023-09-18 13:16:30 | 0 | 640 | ColinMac |
77,127,470 | 4,004,541 | Identify different cameras using OpenCV VideoCapture in Python | <p>I connected two USB cameras to my system (one RGB and another NIR).</p>
<p>One camera works on RGB and another on a grey scale, so they have a different channel.</p>
<p>I see that some people have suggested searching the camera IDs in the folder /dev/v4l/by-id/* and then opening the cameras as</p>
<pre><code>cap = c... | <python><opencv><camera> | 2023-09-18 13:05:02 | 0 | 360 | Patrick Vibild |
77,127,220 | 2,791,346 | UPS tracking API activity status options | <h3>UPS Tracking API</h3>
<p>I am trying to use a UPS tracking API in Python.</p>
<pre><code>import requests
inquiry_number = "1ZXXXXXXXXXXXXXXXX"
url = "https://wwwcie.ups.com/api/track/v1/details/" + inquiry_number
query = {
"locale": "en_US",
"returnSignature&qu... | <python><ups> | 2023-09-18 12:28:44 | 1 | 8,760 | Marko Zadravec |
77,127,192 | 1,417,075 | Cannot Decode RFID Tag | <p>Thanks for taking a look.</p>
<p>I'll include a full description here as I'm not sure what might be relevant to solving my question.</p>
<p><strong>Background Information:</strong></p>
<p>My current project involves reading <a href="https://en.wikipedia.org/wiki/Radio-frequency_identification" rel="nofollow noreferr... | <python><rfid><epc> | 2023-09-18 12:24:19 | 1 | 1,082 | James Scott |
77,126,852 | 3,121,975 | Generic XML message parsing | <p>I have a number of XML message types with an elaborate header and sequence structure, but separate business message types. I'm trying convert these to objects in Python, and so far my bottom-level structure looks like this:</p>
<pre><code>T = TypeVar("T", bound=XmlRecord)
def _extract_fixed_gen_data(rec_t... | <python><generics><python-descriptors> | 2023-09-18 11:36:12 | 0 | 8,192 | Woody1193 |
77,126,835 | 22,595 | How to enable diagnostics for python-kafka consumer? | <p>I have test cases that have to read from kafka topics. On some machines that works, but on machine dedicated for tests it simply ends without neither result nor error.</p>
<p>My code to read all message from kafka topic:</p>
<pre><code>def show_messageges_from_topic(kafka_server, topic, date_filter, msg_id_list):
... | <python><apache-kafka><kafka-consumer-api> | 2023-09-18 11:33:31 | 0 | 54,502 | Michał Niklas |
77,126,759 | 7,327,257 | LightGBM Classifier faster on CPU than on GPU | <p>I've followed instructions in <a href="https://lightgbm.readthedocs.io/en/latest/GPU-Tutorial.html" rel="nofollow noreferrer">official documentation</a> of LightGBM. I followed each step and when I tried to make the speed test on both GPU and CPU I noticed that <strong>CPU computation is faster than GPU</strong>. Ho... | <python><gpu><nvidia><lightgbm> | 2023-09-18 11:21:42 | 0 | 357 | M. Merida-Floriano |
77,126,706 | 5,722,359 | How to get the previous 10 and next 10 distinct group_ids from a SQLITE3 table after some data have been removed | <p>From a sqlite3 table column, I would like to extract the previous 10 distinct values at a given offset after some data have been removed.</p>
<p>Below is a sample script.</p>
<p><strong>Sample Script:</strong></p>
<pre><code>import sqlite3
import random
from itertools import count
from typing import Literal
class D... | <python><sqlite><sqlite3-python> | 2023-09-18 11:12:03 | 0 | 8,499 | Sun Bear |
77,126,603 | 16,306,516 | Adding link to a mobile message string in python | <p>I have a URL in a variable named <code>url_sale</code>,
I want to add url_sale in a string as a URL but am not able to achieve it
Here is my code</p>
<pre><code>base_url = self.env['ir.config_parameter'].get_param('web.base.url')
url_sale = base_url + '/web#id=%s&view_type=form&model=%s' % (record.id, record... | <python><python-3.x><odoo> | 2023-09-18 10:53:23 | 1 | 726 | Sidharth Panda |
77,126,571 | 12,787,236 | How to share similar code between Cloud Functions? | <p>I have multiple Cloud Functions in Google Cloud Platform that are very similar, changing only a few parameters and variable values between them.</p>
<p>Is there a way to tackle this problem, organizing them like Python modules in order to reduce code duplication? Sharing the same variable and functions between the... | <python><google-cloud-platform><google-cloud-functions><serverless><code-duplication> | 2023-09-18 10:49:16 | 1 | 1,948 | Henrique Branco |
77,126,558 | 9,877,065 | Don't understand how Python calls this C function | <p>please be patient , I am just trying to learn Python, but trying to figure out how some software works ( <a href="https://github.com/LBC-LNBio/pyKVFinder/tree/master" rel="nofollow noreferrer">https://github.com/LBC-LNBio/pyKVFinder/tree/master</a> ) .</p>
<p>Here in <a href="https://github.com/LBC-LNBio/pyKVFinder/... | <python><c><function><arguments><swig> | 2023-09-18 10:47:41 | 0 | 3,346 | pippo1980 |
77,126,224 | 1,769,197 | Display irregular timestamp on x-axis | <p>I have the following dataframe. And I would like to plot x and y but replace the x axis tick labels with the endTime column on. However, I just cannot get this right.</p>
<pre><code> endTime x y
0 2021-06-29 09:15:44.097 0.0 inf
1 2021-06-29 09:17:50.434 1.0 2.718282
2 2021-06-2... | <python><matplotlib> | 2023-09-18 09:57:02 | 0 | 2,253 | user1769197 |
77,126,112 | 9,373,320 | Creating dynamic pysimplegui tab | <p>I am trying to create a dynamic pysimplegui where I can add input box in the 2nd tab based on the entry from the inputs in the first tab from the user. That is if the user inputs 3 in the first tab then in the 2nd tab there will be 3 input boxes. Below is the sample code I am having. But this has error. Please help ... | <python><python-3.x><pysimplegui> | 2023-09-18 09:42:43 | 0 | 330 | sumanta das |
77,125,922 | 15,222,211 | FastAPI pydantic model property in a JSON response | <p>I want to use a property to automatically generate key-value pairs and include them in a FastAPI JSON Response.
In my example, I'm attempting to use a property within a Pydantic model, but it's not working as expected.</p>
<p>I requested: <a href="http://127.0.0.1:8000/" rel="nofollow noreferrer">http://127.0.0.1:80... | <python><fastapi><pydantic> | 2023-09-18 09:18:03 | 1 | 814 | pyjedy |
77,125,906 | 19,108,785 | Install python packages in docker Alpine base image | <p>I have requirement to install python packages from requirements.txt file in docker.
I am using "python:3.10.10-alpine" as my base image and installing the packages from requirements.txt file.
Here is my docker file for refernce:</p>
<pre><code>FROM python:3.10.10-alpine
RUN apk update && \
apk... | <python><docker><alpine-linux> | 2023-09-18 09:15:09 | 2 | 570 | Roronoa Zoro |
77,125,624 | 14,282,714 | SSLError: (MaxRetryError("HTTPSConnectionPool(host='huggingface.co', port=443) | <p>I would like to use the <code>SentenceTransformers</code> like from this <a href="https://www.sbert.net/" rel="nofollow noreferrer">page</a>. When running the following code I get an error which I'm not able to solve:</p>
<pre><code>import torch
from sentence_transformers import SentenceTransformer
sentences = ['Th... | <python><huggingface-transformers><huggingface><sentence-transformers> | 2023-09-18 08:35:36 | 1 | 42,724 | Quinten |
77,125,620 | 11,406,071 | Smoothing function with fixed end points (decreasing window size near boundary) | <p>I would like either</p>
<ul>
<li>a link to a smoothing function from existing library or</li>
<li>a 'reasonably performant' python function</li>
</ul>
<p>that performs simple boxcar smoothing but with the catch that it accepts a boundary condition like this:</p>
<p>Suppose an array of length 9, with a rolling window... | <python><smoothing> | 2023-09-18 08:35:12 | 2 | 407 | Victor Savenije |
77,125,386 | 1,238,934 | Python global var in multiprocessing | <p>For the following code, I declare 'GlobalCount' that is intended to be the global variable.
Then I start the process() method with multiprocessing, that increments GlobalCount each second. If I set a breakpoint there, the value is incremented ok.
Then, in parallel, I am requesting 'GETSTATUS', who should return the ... | <python><multiprocessing><global-variables><python-multiprocessing> | 2023-09-18 07:48:40 | 2 | 3,830 | Jaume |
77,125,327 | 3,833,632 | Can the parent process find out the PID of the child process | <p>I have some python code that forks</p>
<pre><code>try:
pid = os.fork()
if pid > 0:
# parent process, return and keep running
return
except:
print("EXCEPTION")
sys.exit(1)
</code></pre>
<p>And I would find it useful to be able to know the PID of the child process within ... | <python><fork> | 2023-09-18 07:37:34 | 2 | 715 | CalebK |
77,125,079 | 4,417,586 | Can't build a Python Docker container on Raspberry Pi | <p>I have a backend Python project which I've been dockerizing sucessfully on my local machine. After several tries, it seems some Python packages (either <a href="https://dbus.freedesktop.org/doc/dbus-python/" rel="nofollow noreferrer"><code>dbus-python</code></a> or <a href="https://pygobject.readthedocs.io/en/latest... | <python><docker><bluez><pygobject><dbus-python> | 2023-09-18 06:50:15 | 0 | 1,152 | bolino |
77,125,023 | 8,471,995 | Combining Inheritance and dataclass | <p>I would like a decorator for a class that will</p>
<ul>
<li>Add <code>dataclass</code>-ness</li>
<li>Inherits a superclass</li>
<li><code>mypy</code> identifies</li>
</ul>
<p>So far, below was my solution.</p>
<pre class="lang-py prettyprint-override"><code>import dataclass as dc
# An example superclass
class Base:... | <python><python-dataclasses> | 2023-09-18 06:40:53 | 0 | 1,617 | Inyoung Kim 김인영 |
77,124,910 | 3,833,632 | What is the proper cross-platform way to run a background thread after execution? | <p>I am trying to write code that will allow me to keep Selenium drivers alive in background processes. Or spawn background processes that periodically check for status changes.</p>
<p>The only requirement is that these background drivers hold the selenium drivers alive in a way I can connect to with a remote session (... | <python><multithreading> | 2023-09-18 06:19:36 | 0 | 715 | CalebK |
77,124,879 | 3,358,488 | pip: 'extras_require' must be a dictionary whose values are strings or lists of strings containing valid project/version requirement specifiers | <p>I tried running <code>pip install gym==0.21.0</code></p>
<p>but got the cryptic error:</p>
<pre><code>Collecting gym==0.21.0
Using cached gym-0.21.0.tar.gz (1.5 MB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit cod... | <python><pip><openai-gym> | 2023-09-18 06:12:27 | 1 | 5,872 | user118967 |
77,124,854 | 562,769 | Can I print the cumulative time per pytest fixture? | <p>I'm currently struggling with a test suite that is slower than I would like it to be. I want to figure out which part is the most promising to work on.</p>
<p>One technique I know is <a href="https://stackoverflow.com/a/27899853/562769"><code>--durations</code></a>, but that is not super helpful in my case.</p>
<p>I... | <python><pytest><pytest-fixtures> | 2023-09-18 06:04:42 | 1 | 138,373 | Martin Thoma |
77,124,504 | 5,084,432 | Write large dataframe in Excel Pandas python | <p>I have a dataframe which contains data between 5,50,000, to 9,00,000 rows and 10 columns
I read the data from postgtresql and converted the data into dataframe which took few secondas.
However when trying to write data in excel it took more than 1 hour to write</p>
<p>writer = pd.ExcelWriter('filepath/file.xlsx', en... | <python><pandas><excel><xlsxwriter> | 2023-09-18 04:07:07 | 1 | 349 | shashank verma |
77,124,399 | 11,672,868 | how to get exact position of music playback in pygame? | <p>I know we can use <code>.get_raw()</code> on a Sound object to get a raw array of audio data, and I would like to get the exact values to pass as array indexes based on current playback position (for example <code>raw_array[pos:pos+offset]</code> would represent audio from current position plus an offset value, but ... | <python><audio><pygame> | 2023-09-18 03:21:07 | 1 | 308 | K-FLOW |
77,124,279 | 7,518,091 | TypeError: WebDriver.__init__() in selenium | <p>I have the following python code in selenium;</p>
<pre><code>from selenium.webdriver import Firefox, FirefoxOptions
from selenium.webdriver.firefox.service import Service
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.common.by import By
options = Options()
options.set_preference('br... | <python><selenium-webdriver> | 2023-09-18 02:28:52 | 1 | 3,699 | user1315789 |
77,124,208 | 5,162,426 | Optimizing NumPy finite differences via chain rule | <p>Consider the following code:</p>
<pre><code>x = np.array([1, 5, 6, 10]) # an unstructured coordinate
f = x**2 # function value on the points x
grad1 = np.gradient(f, x) # df/dx
grad2 = np.gradient(f) / np.gradient(x) # df/di * di/dx = df/dx
</code></pre>
<p>I would have expected ... | <python><numpy><gradient><derivative><finite-difference> | 2023-09-18 01:53:00 | 1 | 3,032 | pretzlstyle |
77,124,086 | 5,162,426 | Is there a way to compute gradients on unstructured coordinates with Numpy? | <p>I have a 3D array of data <code>A</code>, with shape <code>(NX, NY, NZ)</code> in the <code>x</code>, <code>y</code>, and <code>z</code> dimensions, respectively.</p>
<p>I want to find the gradient of <code>A</code> in the <code>y</code> dimension. This can be done easily with NumPy:</p>
<p><code>dAdy = np.gradient(... | <python><numpy><derivative><differentiation><finite-difference> | 2023-09-18 00:47:31 | 1 | 3,032 | pretzlstyle |
77,123,898 | 3,605,608 | How to provide placeholders for multiple rows in EXCEPT clause? | <p>My goal is to, given a list of id's in Python, find id's not mapped to a row in an SQLite table. I'm trying to achieve this using the <code>EXCEPT</code> operator:</p>
<pre class="lang-sql prettyprint-override"><code>-- if the table currently stores id1 and id3 would only return id2
WITH cte(id) as VALUES ('id1'), (... | <python><sqlite><sqlite3-python> | 2023-09-17 22:59:47 | 1 | 585 | Scott M |
77,123,707 | 13,460,543 | Identify in a series the column with the maximum value for each row of a dataframe | <p>Suppose we have the following dataframe :</p>
<p><strong>Source Dataframe</strong></p>
<pre><code> A B C
0 55 9 96
1 69 86 5
2 30 63 12
3 79 52 31
</code></pre>
<p>I would like to identify in a series the column with the maximum value for each row of a dataframe.
So the expected result would be ... | <python><pandas><dataframe><max> | 2023-09-17 21:39:37 | 0 | 2,303 | Laurent B. |
77,123,653 | 769,449 | Scrapy Spider with dynamically called Spider does not save any output to desired folder | <p>I want to run "___SPIDER_RUNNER.py" by hitting F5 in Visual Studio code. All seems to crawl ok, logging shows that items are being retrieved, but the output JSON file is not saved to folder C:\scrapy\JSON_output.
That folder exists. I have write persmissions.</p>
<p>I'm completely stuck as no errors are lo... | <python><scrapy> | 2023-09-17 21:19:28 | 1 | 6,241 | Adam |
77,123,583 | 275,002 | How to create a tweet using V2 API without Tweepy? | <p>I am trying the following code but it gives 401 error:</p>
<pre><code>headers = {
"Authorization": f"OAuth oauth_consumer_key={consumer_key},oauth_token={access_token},oauth_signature_method=HMAC-SHA1"
}
# Create data payload for the tweet with attached med... | <python><twitter><python-3.5> | 2023-09-17 20:56:31 | 1 | 15,089 | Volatil3 |
77,123,435 | 33,404 | Why does Chroma DB crash with "illegal instruction" in this python:3.10-slim container? | <p>I am using <a href="https://docs.trychroma.com/" rel="nofollow noreferrer">Chroma DB</a> (0.4.8) in a Python 3.10 Flask REST API application. The application runs well on local developer machines (including Windows and OS X machines).</p>
<p>I am using the multi-stage <code>Dockerfile</code> below to package the app... | <python><docker><dockerfile><python-poetry><chromadb> | 2023-09-17 20:09:49 | 2 | 16,911 | urig |
77,123,420 | 1,608,765 | Unequally spaced subplots | <p>I got 3 pairs of images that I would like to have paired together (See first figure, which is created by using a simple plt.subplots(161), with axes turned off for the even numbered subplots.)</p>
<p>Since the image contains 3 pairs of images, I would like each pair to be togetherm thus with smaller spacing. (See 2n... | <python><matplotlib><subplot> | 2023-09-17 20:05:58 | 0 | 2,723 | Coolcrab |
77,123,249 | 17,157,890 | converting keras h5 to tfjs | <p>I am a total noob in pythona and with help of yt tuts made a keras h5 model with 97% accuracy.</p>
<p>Now I want to convert it to tfjs model to use it in my web app
for my first attempt</p>
<pre><code>!tensorflowjs_converter \
--input_format=keras \ h5jsmodelpath \outputpath
</code></pre>
<p>the following error po... | <python><tensorflow><keras><tensorflow.js> | 2023-09-17 19:08:34 | 0 | 391 | Kartic Joshi |
77,122,892 | 13,174,189 | How replace specific quotation marks into apostrophes? | <p>My AI model generates this string:</p>
<pre><code>'{"name": "hammer 1.5"", "brand": "Eurosteel"}'
</code></pre>
<p>I want to turn it into dict using <code>json.loads</code>. But it is not possible because of "hammer 1.5"" in value of name key. So I want to... | <python><json><python-3.x><string> | 2023-09-17 17:16:58 | 2 | 1,199 | french_fries |
77,122,799 | 11,665,178 | gcloud crashed (AttributeError): 'str' object has no attribute 'get' cleanup policy | <p>I am trying to run the example command : <code>gcloud artifacts repositories set-cleanup-policies my-repo --policy=policy.json</code> mentioned in the <a href="https://cloud.google.com/sdk/gcloud/reference/artifacts/repositories/set-cleanup-policies" rel="nofollow noreferrer">documentation</a> but i am getting the f... | <python><google-cloud-platform><gcloud> | 2023-09-17 16:48:04 | 1 | 2,975 | Tom3652 |
77,122,703 | 16,611,809 | How to delete/unload all modules mentioned in a list= | <p>I want to unload all submodules that belong to a specifc module, because it conflicts with another module. Here's what I do:</p>
<pre><code>mainmodule_submodules = [key for key in sys.modules if key.startswith('mainmodule')]
for mainmodule_submodule in mainmodule_submodules:
del mainmodule_submodule # deletes th... | <python><del> | 2023-09-17 16:19:16 | 1 | 627 | gernophil |
77,122,604 | 18,904,265 | Use type hints from pydantic model for if/else logic | <p>I defined a pydantic model something like this:</p>
<pre class="lang-py prettyprint-override"><code>from typing import Literal
from pydantic import BaseModel
class Model(BaseModel):
title: str | None
number: int | None
items: list[int] | None
choice: Literal["one", "two"] | None
</code>... | <python><python-typing><pydantic> | 2023-09-17 15:55:09 | 1 | 465 | Jan |
77,122,568 | 5,222,301 | How to generate one json into two json? | <p>I have the following fixture from a Django project:</p>
<pre><code>[
{
"model": "music",
"pk": 1,
"fields": {
"attributed_to": false,
"creator": null,
"name": "Piano Trio No. 1",
"name_en": "Piano Tri... | <python><json><django><django-fixtures> | 2023-09-17 15:49:12 | 1 | 1,200 | H C |
77,122,565 | 6,399,645 | Run terminal command from native terminal rather than stripped down subprocess.run | <p>I have an alias <code>test</code> in my .bashrc file. It works if I call it from my standard terminal.</p>
<p>When I run <code>subprocess.run("test",shell=True)</code> it gives error: <code>/bin/sh: 1: test: not found</code>.</p>
<p>How do I run a shell command <strong>exactly</strong> as if I just opened ... | <python><linux><shell> | 2023-09-17 15:48:48 | 2 | 434 | user56834 |
77,122,116 | 952,708 | Extracting attributes from an XLIFF file using Python | <p>I am using Python to read an XML-based file, specifically the SDLXLIFF variant of an XLIFF file generated by computer-aided translation software. Such files typically contain a copy of the source file, followed by the body, which contains translation units, which usually contain "source" and "target&q... | <python><xml><xpath><xliff> | 2023-09-17 13:57:20 | 2 | 8,037 | SlowLearner |
77,122,068 | 13,835,759 | SqlAlchemy Stored Procedure Returns without executing entire proc | <p>I'm writing stored procedure for performing an update operation using SQL Server.</p>
<p>The Stored Procedure performs the following high level operations</p>
<pre><code>--Print the values before update
SELECT 'Before' as When, x, y, z FROM eod.fn_get_data(@pricingdate)
BEGIN TRAN;
--Logic to update the data
--Pri... | <python><sql-server><stored-procedures><sqlalchemy> | 2023-09-17 13:44:06 | 0 | 364 | Vedita Kamat |
77,121,957 | 1,881,329 | Psycopg3 Async Connection pool leakage/timeout problem | <p>I have a leakage problem in my Psycopg3 Async Connection pool and I cannot find the source of the problem.</p>
<p>I extended my Flask app such that once the server starts up it creates an Async Connection pool.</p>
<p>Then, whenever a request is made, the app gets the connections needed to retrieve the data from the... | <python><postgresql><flask><psycopg3> | 2023-09-17 13:15:00 | 0 | 436 | Carlos Souza |
77,121,890 | 1,390,993 | Regex pattern to exclude timestamps | <p>I have the following text:</p>
<pre><code>Master of the universe\n\n(Jul 26, 2023 - 1:00pm)\n\n(Interviewee: Marina)\n\n\n\n(00:00:05 - 00:00:09)\n\n\t Alice: This project. Uh my job is to ask lots of questions.\n\n\n\n(00:00:10 - 00:00:11)\n\n\t Marina: What is it?\n\n\n\n(00:00:11 - 00:00:14)\n\n\t Alice: Uh uh im... | <python><regex><ms-word><docx><regex-group> | 2023-09-17 12:54:30 | 2 | 1,158 | sifar |
77,121,817 | 988,549 | What kind of Text object are axis labels? | <p>Axis labels (<code>axis.xaxis.label</code>) appear to be <code>matplotlib.text.Text</code> objects, but when extracting the position and attempting to manually create text at the same position, there appears to be a large offset. In the example below, I expect the red "x" would exactly overlap the black on... | <python><matplotlib> | 2023-09-17 12:34:46 | 1 | 385 | fheshwfq |
77,121,770 | 561,243 | rich.Prompt to retrieve two numbers or a letter | <p>I have a coding issue I would like to share with you.</p>
<p>In my python code, I need some user inputs, in particular I need him to type in either a pair of float values or a specific letter from a list to execute a command.</p>
<p>Something like:</p>
<blockquote>
<p>Enter the required values OR Q to Exit:</p>
</bl... | <python><input><rich> | 2023-09-17 12:21:39 | 1 | 367 | toto |
77,121,698 | 15,341,457 | Scrapy XPath - @href returning unexpected value | <p>I'm currently web-scraping restaurant reviews from Tripadvisor and I'm trying to retrieve restaurant links from this <a href="https://www.tripadvisor.it/Restaurants-g187791-Rome_Lazio.html" rel="nofollow noreferrer">page</a>.</p>
<p>I want the links of the 30 restaurant pages in the bottom part but I'm making some t... | <python><http><web-scraping><xpath><scrapy> | 2023-09-17 12:04:25 | 2 | 332 | Rodolfo |
77,121,172 | 6,129,375 | How do I transpose a dataframe after groupby? | <p>I have this table</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>port</th>
<th>valueA</th>
<th>valueB</th>
<th>valueC</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>3.1</td>
<td>58.2</td>
<td>0.09</td>
</tr>
<tr>
<td>2</td>
<td>3.09</td>
<td>58.3</td>
<td>0.1</td>
</tr>
<tr>
<td>3</td>... | <python><pandas><dataframe> | 2023-09-17 09:12:37 | 3 | 380 | RedSmolf |
77,121,119 | 17,082,611 | GPU ran out of memory. How to invoke garbage collector for cleaning the GPU memory at each combination of hyperparameters using GridSearchCV? | <p>I am training my model on a remote server using <code>GridSearchCV</code> API for tuning some hyper parameters such as <code>epochs</code>, <code>l_rate</code>, <code>batch_size</code> and <code>patience</code>. Unfortunately while tuning them, after few iterations, I get the following error:</p>
<pre><code>Failed c... | <python><tensorflow><keras><memory-management><gpu> | 2023-09-17 08:52:30 | 1 | 481 | tail |
77,121,056 | 3,187,106 | Extract text from PDF got generated from autocad using Python | <p>I have got a PDF generated from AutoCad, I have used all python libraries to extract the text out of it (PyPDF2, PDFMiner,...) and all of them return empty text.</p>
<p>I have noticed that those PDFs are not a free text, e.g. I can NOT select any text in it, its like a picture or something</p>
<p>How can I extract t... | <python><python-3.x><pdf> | 2023-09-17 08:33:12 | 1 | 426 | Saeed isa |
77,121,040 | 1,261,930 | missing files at django-admin startproject | <p>I am learning Django & when following through I can create the startup project however it only brings one file.. so I cannot continue to start the Django development server. These are the instructions I followed so far:</p>
<p><a href="https://i.sstatic.net/s07pt.png" rel="nofollow noreferrer"><img src="https://... | <python><django><python-venv> | 2023-09-17 08:26:52 | 1 | 793 | Chagbert |
77,120,899 | 8,052,616 | How can I initialize an object with a string of package path in Python? | <p>For example, my package path is <code>component.sub_fold.package.class_name</code>. The <code>component.sub_fold</code> is the path of my package. The <code>package</code> is a file name. The <code>class_name</code> is a class name which I want to initialize it. I can initialize an object through</p>
<pre><code>from... | <python><python-import> | 2023-09-17 07:36:52 | 1 | 1,111 | taichi_tiger |
77,120,897 | 19,356,117 | How to solve "MemoryError" when download dataset by kaggle? | <p>I want to download dataset from kaggle, however when I run it on my local machine, it crashed, and this is my code:</p>
<pre><code>api = kaggle.KaggleApi(json_str)
api.authenticate()
api.datasets_download(owner_slug='headwater', dataset_slug='Camels')
</code></pre>
<p>This is crash report:</p>
<pre><code>tes... | <python><io><request><out-of-memory><kaggle> | 2023-09-17 07:36:48 | 1 | 1,115 | forestbat |
77,120,632 | 2,153,235 | What does ContainerType[str, ...] mean in Python? | <p>I realize that Python doesn't actually overload functions, but rather,
hints at multiple acceptable types for method input/output arguments.
By itself, this doesn't allow specification of which input types yield
which return types. Hence, the use of the <code>@overload</code> decorator to
designate multiple accepta... | <python><python-typing> | 2023-09-17 05:49:25 | 1 | 1,265 | user2153235 |
77,120,569 | 11,445,140 | In docker can't use tree command, get error: /bin/sh: 52: tree: not found | <p>I'm using docker, I want to use <code>tree</code> command, but I get error:</p>
<pre><code># tree -L 1
/bin/sh: 52: tree: not found
# whereis tree
tree:
# apt install tree
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package tree
# pip install tr... | <python><docker><tree><sh><bin> | 2023-09-17 05:17:18 | 1 | 519 | Tom |
77,120,536 | 3,899,975 | how to change the axis limit based on original data after transforming the data | <p>I have the following code, the problem is I want to keep the x limits as the original data (<code>failure</code>) and y data to be between 0, 1, or 0, 99.9999%. I want to do this without using <code>twinx</code> axis:</p>
<pre><code>import numpy as np
import matplotlib.pyplot as plt
#data
failure = np.array([168, ... | <python><matplotlib> | 2023-09-17 04:58:57 | 1 | 1,021 | A.E |
77,120,476 | 736,087 | System.IO.FileNotFoundException when calling dll from Pythonnet | <p>I am working on Pythonnet in Pycharm and calling C# dll from the python code, but getting error below while calling method.</p>
<p>Below is code</p>
<pre><code>from pythonnet import load
load("coreclr")
import platform
print(platform.architecture())
import clr
from System import *
from Microsoft import *
... | <python><dll><python.net> | 2023-09-17 04:29:46 | 1 | 5,727 | Saurabh |
77,120,413 | 13,771,657 | Converting single index pandas df to multi-index df and then grouping all rows with the same index together on separate lines | <p>I have a df that looks like this:</p>
<pre><code>import pandas as pd
# Create df
df = pd.DataFrame({'Name': ['Alice', 'Bob', 'Carol', 'Alice', 'Carol', 'Alice', 'Carol', 'Matt'],
'Address': ['123 A St', '123 B St', '123 C St', '123 A St', '123 C St', '456 X St', '123 C St', '123 M St'],
... | <python><pandas><dataframe><multi-index> | 2023-09-17 03:50:38 | 1 | 528 | BGG16 |
77,120,347 | 1,492,229 | extract alphanumeric from text in dataframe in Python | <p>I have a data frame that is called df and looks like this</p>
<pre><code>Text No
c0404079=0.00 34
c1444716<=0.00 45
1c0<0226311 <= 0.00 36
c0001208 <= 0.00 32
0.00<c0243026<=2.00 85
c0036983 <= 0.00 55... | <python><dataframe><text> | 2023-09-17 03:11:58 | 1 | 8,150 | asmgx |
77,120,024 | 2,587,816 | How to force a python float to not use exponents | <p>I have some code that reads numbers into a floating-point Numpy array (from a text format), multiplies the values by 1000.0, and later prints the array.</p>
<p>I format the array for printing like so, where <code>k</code> is a string identifying the array and <code>v</code> is the array itself:</p>
<pre><code>out = ... | <python><numpy><floating-point><exponentiation> | 2023-09-17 00:04:55 | 1 | 5,170 | Jiminion |
77,119,982 | 11,091,255 | Difficulty getting filtered dmesg output using subprocess with Python | <p>I've been trying to get the log of unplugged USB devices from dmesg from within a Python script. At the command line, I would type:
<code>dmesg | tail -100 | grep "USB disconnect"</code> and see the desired output. Within the script I have been using the subprocess.run command but it seems to have an iss... | <python><linux><subprocess><dmesg> | 2023-09-16 23:35:11 | 1 | 305 | Christopher Theriault |
77,119,956 | 997,406 | Improve map plot resolution | <p>I'm trying to plot an image of a map, using matplotlib. On top of it I'm looking to plot a hiking route using a dataframe of of Longitude/Latitude/Elevation. The image resolution is not good and I'm trying to improve it. However, when I try to add more map tiles it doesn't get any better. I would like it to be of a ... | <python><plot> | 2023-09-16 23:22:47 | 1 | 407 | gus |
77,119,827 | 1,691,278 | Speed up an O(n) algorithm: should I use pointers? | <p>I stumbled upon the following problem:</p>
<blockquote>
<p>Given an ordered list of cards with integers on them (e.g. <code>[1,24,3,4,5]</code>), two
players take turns to take cards. Player 1 goes first. Whenever either
player takes a card with an even number, they reverse the order of the
remaining cards, and the ... | <python><performance> | 2023-09-16 22:22:34 | 1 | 1,905 | user1691278 |
77,119,680 | 3,259,222 | Split array to multiple arrays using a collection of boolean masks | <p>Given a data array of shape (m,n) and array of bool masks of the same shape. Is there a way to apply the following routine without a loop:</p>
<ol>
<li>Apply each column of the masks array to the data array obtaining a sub-array</li>
<li>Store all sub-arrays</li>
</ol>
<p>Here is a loop solution</p>
<pre><code>impor... | <python><numpy> | 2023-09-16 21:32:03 | 1 | 431 | Konstantin |
77,119,678 | 12,086,248 | Groupby 3 column values and find the 3rd column count in descending order and sum up the count values by ignoring the first count value in python | <p>I am trying to do a groupby for 3 column values and wanted to find the below from a python dataframe:
1. 3rd column value counts in descending order
2. sum up the count values by ignoring the first count value</p>
<p>I have tried with the below 2 lines of code, but not getting the desired results, can anyone help me... | <python><pandas><dataframe> | 2023-09-16 21:31:01 | 1 | 433 | Goutam |
77,119,653 | 1,862,861 | Replace $ signs bounding equations within opening and closing parentheses | <p>I have a load of inline LaTeX-style maths strings in Python, e.g., <code>eq = "$E = mc^2$"</code> or <code>eq = "$F = ma$ (N)"</code> that I am writing out into a webpage that uses MathJAX. I therefore want to convert the opening and closing <code>$</code> symbols into the default MathJAX style o... | <python><regex> | 2023-09-16 21:21:38 | 2 | 7,300 | Matt Pitkin |
77,119,489 | 13,620,323 | ML Model: ValueError: Incompatible dimension for X and Y matrices: X.shape[1] == 150528 while Y.shape[1] == 512 | <p>So I am trying to train a model with some images and then the model should detect whether its similar to the images trained or not the training part works good I guess it generates .npy file then the calculating similarity file loads that file and tries to calculate the similarity here is the code for that</p>
<pre>... | <python><machine-learning><pytorch> | 2023-09-16 20:26:21 | 0 | 538 | Mohammed Abid Nafi |
77,119,311 | 3,810,748 | Why does timezone unaware datetime object print out in local timezone? | <p>When I instantiate a datetime object like this:</p>
<pre><code>>>> print(datetime.datetime.now())
2023-09-16 10:30:15.50
</code></pre>
<p>I get the correct local time, which is currently around <code>10:30 AM</code>.</p>
<p>Why is it like this? Shouldn't it default to UTC time or something?</p>
| <python><datetime><timezone><utc> | 2023-09-16 19:31:45 | 1 | 6,155 | AlanSTACK |
77,119,159 | 3,090,114 | Execute an excel macro from python in unix environment | <p>Can anyone share any code snippet to execute an execl macro using python code in unix environment?</p>
<p>I tried using xlwings, but that doesn't support in unix environment.</p>
<p>Use Case: I have a pivot table report in excel with filter and using macro we want to change the filter value.</p>
| <python><excel><unix> | 2023-09-16 18:53:05 | 1 | 1,491 | Koushik Chandra |
77,119,100 | 8,831,742 | Label structure for a keras model with multiple outputs | <p>I have a keras model that inputs a simple array and outputs two values (x and y) that belong to 5 possible categories (encoded as one-hot), with a custom loss function. I know that you have to set the loss function for each desired output value, which I did in my script.</p>
<p>I initialized the model like this:</p>... | <python><tensorflow><machine-learning><keras> | 2023-09-16 18:38:07 | 1 | 353 | none none |
77,119,048 | 386,861 | How is it possible to turn an jupyter notebook that uses altair, pandas and ipywidget into workable .py that i can throw into an exist page? | <p>I learned python through IPython Notebooks and scrambled together but I want to know if it is possible to take the notebook and sort of paste it it with its own route? Or can I upload the notebook into pythonanywhere and create a separate app that way?</p>
| <python><pandas><altair><pythonanywhere> | 2023-09-16 18:23:12 | 0 | 7,882 | elksie5000 |
77,119,031 | 540,665 | numpy behaves differently on a normal Jupiter notebook and one from a visual studio venv | <p>I am running a web version of a Jupyter notebook from a course material, and this code cell runs through successfully:</p>
<p><a href="https://i.sstatic.net/vN2kl.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/vN2kl.jpg" alt="enter image description here" /></a></p>
<p>But when I ran it from a VS COD... | <python><numpy><jupyter-notebook><jupyter-console> | 2023-09-16 18:18:14 | 1 | 2,398 | dig_123 |
77,118,839 | 758,174 | tqdm.notebook horizontal alignment of multiple bars | <p>I'd like to know if there is a way to align multiple progress bars in a Jupyter notebook, like they look <a href="https://github.com/tqdm/tqdm#ipythonjupyter-integration" rel="nofollow noreferrer">in the docs</a>.</p>
<p>By contrast, my experience is that the horizontal position of the bar varies through the iterati... | <python><jupyter-notebook><tqdm> | 2023-09-16 17:24:09 | 0 | 26,554 | Pierre D |
77,118,831 | 722,209 | Table created with alembic migration using sqlite memory cannot be found | <p>I'm creating a table with an alembic migration using an in-memory sqlite connection. The migration is successful, but when I try to load the table with sqlalchemy, it isn't found.</p>
<p>This does not happen with I use a file for sqlite. I'm wondering if the alembic migration is really a separate process call that u... | <python><sqlite><sqlalchemy><alembic> | 2023-09-16 17:21:49 | 0 | 2,976 | Tyrick |
77,118,564 | 4,575,197 | How to pass a Dataframe as train dataframe and another dataframe as Validation to GridSearchCV | <p>I'm a programmer who tries to find he's way into ML world. so the Question might be basic.</p>
<p>i have data from years 2010-2019. Now i'm trying to test different parameters on gradient boosting regression and i want to use 60% for traning,20% for Validation and 20% for Testing. Due to the nature of the Question t... | <python><pandas><machine-learning><evaluation><gridsearchcv> | 2023-09-16 16:07:41 | 1 | 10,490 | Mostafa Bouzari |
77,118,099 | 12,275,675 | TypeError: Updater.__init__() got an unexpected keyword argument 'token' | <p>I have this code which is suppose to look for /help command in telegram. So once you type /help in the telegram channel it will give you options. The code is as follows.</p>
<pre><code>from telegram import Update
from telegram.ext import Updater, CommandHandler, MessageHandler, CallbackContext
from telegram.ext impo... | <python><bots><telegram> | 2023-09-16 14:05:57 | 3 | 1,220 | Slartibartfast |
77,118,088 | 9,940,188 | How to build a self-referential associative data structure? | <p>I'm trying to build a hierarchical structure consisting of Nodes where each Node is linked both to several "up" nodes as well as "down" nodes. However, when I run the code below, I get the error:</p>
<pre><code>sqlalchemy.exc.AmbiguousForeignKeysError: Could not determine join condition
between p... | <python><sqlalchemy> | 2023-09-16 14:04:10 | 0 | 679 | musbur |
77,117,924 | 11,830,394 | Error while trying to install mmengine (ImportError: cannot import name 'six' from 'pkg_resources.extern') | <p>Error found with Python 3.8 and pip 20.0.2.</p>
<p>Following mmsegmentation install instructions, when running the command</p>
<pre><code>mim install mmengine
</code></pre>
<p>I was getting the following error:</p>
<pre><code>Traceback (most recent call last):
File "<frozen importlib._bootstrap>", ... | <python> | 2023-09-16 13:15:29 | 1 | 331 | ASRodrigo |
77,117,575 | 9,391,359 | docker compose volumes empty folder | <p>inside my vvchatbot folder are</p>
<ul>
<li>app</li>
<li>configs</li>
<li>docker-compose.yaml</li>
</ul>
<p>docker compose</p>
<pre><code>version: '3'
services:
app:
container_name: app
restart: always
build:
context: ./app
args:
- LLAMA_2_ACCESS=${LLAMA_2_ACCESS}
- CHAT_MO... | <python><docker><docker-compose> | 2023-09-16 11:31:58 | 0 | 941 | Alex Nikitin |
77,117,483 | 839,733 | Iterator for k-combinations | <p><a href="https://leetcode.com/problems/combinations" rel="nofollow noreferrer">LeetCode 77. Combinations</a>:</p>
<blockquote>
<p>Given two integers n and k, return all possible combinations of k numbers chosen from the range [1, n].
You may return the answer in any order.</p>
</blockquote>
<p>My code using backtrac... | <python><algorithm><iterator><combinations><backtracking> | 2023-09-16 11:05:39 | 3 | 25,239 | Abhijit Sarkar |
77,117,451 | 1,959,753 | Disable the "nanny" when running Dask SSHCluster | <p>Consider an SSHCluster with multiple hosts.</p>
<pre><code>cluster = SSHCluster(["localhost", "hostname"],
connect_options={"known_hosts": None},
worker_options={"n_workers": params["n_workers"], },
schedule... | <python><dask><dask-distributed><dask-delayed> | 2023-09-16 10:55:53 | 0 | 736 | Jurgen Cuschieri |
77,117,449 | 8,817,161 | How to reload config data in running Flask instance? | <p>Suppose we have a service that uses filesystem config file to get some job done:</p>
<pre><code>class Service:
def _load():
# (re)loads config file
pass
def do_some_work():
# uses config file
pass
</code></pre>
<p>... and a Flask app that provides the service to its client... | <python><flask><resources> | 2023-09-16 10:54:20 | 1 | 398 | Maxim |
77,117,081 | 17,157,890 | Model training failing after 1 epoch | <p>I am a noob in python and needed to train a model on a dataset.I found both the notebook and dataset at the same place and made appropriate changes to notebook to run the data from storage.The code fails at the training stage after 1 epoch completes with 'graph execution error'</p>
<p>Here is my jupyter notebook:<a ... | <python><tensorflow><keras><kaggle> | 2023-09-16 09:12:58 | 1 | 391 | Kartic Joshi |
77,117,067 | 775,155 | How do I solve a nonlinear Least Squares Error problem using Tensorflow 2 in Python? | <p>From known r, YC and ZC values I generate N (theta,YL) pairs using the equation:</p>
<pre><code>YL = YC + ZC*tan(theta + r) + noise
</code></pre>
<p>Having N such (theta,YL) pairs I want to recover r, YC and ZC by minimizing an error function, SE, using TensorFlow 2.</p>
<p>The following Python code shows how I gene... | <python><tensorflow><tensorflow2.0> | 2023-09-16 09:08:06 | 0 | 4,009 | Andy |
77,116,715 | 12,635,140 | How to group data by heading in Pandas | <p>How can I group this data with pandas by heading in column <code>sl. no</code>
I have data like below in CSV or excel.</p>
<div class="s-table-container"><table class="s-table">
<thead>
<tr>
<th>sl. No</th>
<th>v1</th>
<th>v2</th>
<th>v3</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>Heading1</code></td>
<td></td>
<td><... | <python><pandas><group-by> | 2023-09-16 07:06:04 | 1 | 319 | Hillal Kumar Roy |
77,116,236 | 678,572 | Find longest interval between overlapping intervals in Python? | <p>I have a list of intervals in the form of tuples such as this:</p>
<pre class="lang-py prettyprint-override"><code>data = [(5,10), (3,10), (13,15), (12,18), (20,29), (25,30)]
</code></pre>
<p>Each item in the tuple has 2 values (i.e., start, end) and there may or may not be overlaps between different intervals. If... | <python><list><tuples><intervals><overlap> | 2023-09-16 03:23:56 | 3 | 30,977 | O.rka |
77,116,082 | 10,262,805 | "addmm_impl_cpu_" not implemented for 'Half' | <p>This is the code for authentication:</p>
<pre><code>from huggingface_hub import notebook_login
#I passed the correct token and got `Token is valid (permission: read)`
notebook_login()
</code></pre>
<p>this is the code to create a model</p>
<pre><code>tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-... | <python><huggingface-transformers><large-language-model><llama> | 2023-09-16 01:55:39 | 1 | 50,924 | Yilmaz |
77,115,964 | 265,932 | Is there a way to access the root dictionary used by Jinja2 from within a template? | <p>Note: The lead-up to the question is a bit long, since I want to share the various ways of dealing with this issue, to help others struggling with it.</p>
<p>I'm trying to use Jinja2 in Python to format AWS SNS events (which are nested dictionaries). For example:</p>
<pre><code>event = {
"id": "c3a1... | <python><jinja2> | 2023-09-16 00:56:53 | 1 | 2,272 | Jemenake |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.