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,002,435 | 7,462,275 | Can "fsolve (scipy)" find many roots of a function? | <p>I read in the scipy documentation (<a href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.fsolve.html" rel="nofollow noreferrer">https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.fsolve.html</a>) that <strong>fsolve</strong> : <em>Find the root<strong>S</strong> of a function.... | <python><scipy><scipy-optimize> | 2023-01-04 07:57:18 | 2 | 2,515 | Stef1611 |
75,002,216 | 17,696,880 | Add substring at specified position within a string if a pattern is identified in it except for the absence of that substring which should be complete | <pre class="lang-py prettyprint-override"><code>import re, datetime
input_text = 'del dia 10 a las 10:00 am hasta el 15 de noviembre de 2020' #example 1
input_text = 'de el 10 hasta el 15 a las 20:00 pm de noviembre del año 2020' #example 2
input_text = 'desde el 10 hasta el 15 de noviembre del año 2020' #example 3
in... | <python><python-3.x><regex><replace><regex-group> | 2023-01-04 07:35:15 | 1 | 875 | Matt095 |
75,002,215 | 1,652,954 | cannot pickle 'generator' object created using yield key-word | <p>As shown in the below posted code, I call <code>__yieldIterables()</code> to generate iterables according to what the list <code>self.__itersList</code> contains. At run time I receive the following error:</p>
<pre><code>TypeError: cannot pickle 'generator' object
</code></pre>
<p>Please let me know how to correct t... | <python><generator><pickle><python-multiprocessing> | 2023-01-04 07:35:10 | 0 | 11,564 | Amrmsmb |
75,002,193 | 5,134,333 | How to export a huge table from BigQuery into a Google cloud bucket as one file | <p>I am trying to export a huge table (2,000,000,000 rows, roughly 600GB in size) from BigQuery into a google bucket as a single file. All tools suggested in <a href="https://cloud.google.com/bigquery/docs/exporting-data#python" rel="nofollow noreferrer">Google's Documentation</a> are limited in export size and will c... | <python><google-bigquery><google-bucket> | 2023-01-04 07:33:28 | 1 | 3,468 | Roee Anuar |
75,002,037 | 19,633,374 | Marking valid days on time series | <p>The following is my code:</p>
<pre><code>x = ts.loc[::-1, "validday"].eq(0)
x = x.groupby(x.index.to_period('M'), sort=False).cumsum().head(35)
x.head(35)
</code></pre>
<p>Current Output:</p>
<pre><code> Date
2022-11-14 1
2022-11-13 1
2022-11-12 1
2022-11-11 2
2022-11... | <python><pandas><dataframe><date><time-series> | 2023-01-04 07:15:15 | 1 | 642 | Bella_18 |
75,001,968 | 2,632,748 | How to sort a numpy array that contains floats and strings in numeric order? | <p>I've got a numpy array that contains some numbers and strings in separate columns:</p>
<pre><code>a = np.array( [[ 3e-05, 'A' ],
[ 2, 'B' ],
[ 1e-05, 'C' ]]
)
print(a[a[:, 0].argsort()])
</code></pre>
<p>However, when try to sort it based on the first column using <code>.argsort()</code> it's sorted in string order... | <python><numpy> | 2023-01-04 07:07:02 | 2 | 336 | John Westlund |
75,001,965 | 19,826,650 | Pass multiple array php data into python for use | <p>I have a multiple array of $dataraw from the code below</p>
<pre><code>$_SESSION['image'];
$dataraw = $_SESSION['image'];
echo '<pre>';
print_r($dataraw);
echo '</pre>';
</code></pre>
<p>print_r($dataraw); output looks like this :</p>
<pre><code>array(2) {
[0]=>
array(4) {
["FileName&quo... | <python><php> | 2023-01-04 07:06:53 | 0 | 377 | Jessen Jie |
75,001,954 | 20,771,881 | Repeat entire group 0 or more times (one or more words separated by +'s) | <p>I am trying to match words separated with the <code>+</code> character as input from a user in python and check if each of the words is in a predetermined list. I am having trouble creating a regular expression to match these words (words are comprised of more than one <code>A-z</code> characters). For example, an i... | <python><regex><regex-group> | 2023-01-04 07:06:00 | 2 | 361 | Nasser Kessas |
75,001,839 | 5,686,015 | Resetting multi-index dataframe with categorical index failing with ValueError: The result input must be a ndarray | <p>I've the following multiindex dataframe:</p>
<pre><code> item_quantity current_stock_qty_9XU7
month name zone product type
January East Product 18111.0 17799.0
Subtotal 19343.0 ... | <python><pandas><dataframe><multi-index> | 2023-01-04 06:50:31 | 1 | 1,874 | Judy T Raj |
75,001,725 | 16,142,496 | How to Merge this Data-frames in Python Pandas? | <p>I have 3 Data-frames of Following Shapes: <br />
(34376, 13), (52389, 28), (16531, 14)</p>
<p>This is the First Dataframe which we have:
<a href="https://i.sstatic.net/HwJCN.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/HwJCN.png" alt="enter image description here" /></a></p>
<p>This is the Second D... | <python><pandas><dataframe><merge><row> | 2023-01-04 06:35:55 | 1 | 351 | Manas Jadhav |
75,001,691 | 19,633,374 | Turning the dataframe upside down and performing groupby | <pre><code>x = ts.loc[::-1, "column_1"].eq(0) #First Line of code for reference
x.groupby(pd.Grouper(freq="M")).cumsum().head(35) #Second Line of code for reference
</code></pre>
<p><code>Goal</code>: I have a timeseries dataframe which i need to turn it upside down and perform the groupby</p>
<p><... | <python><pandas><dataframe><date><time-series> | 2023-01-04 06:31:51 | 1 | 642 | Bella_18 |
75,001,535 | 800,735 | In GCP Dataflow/Apache Beam Python SDK, is there a time limit for DoFn.process? | <p>In Apache Beam Python SDK running on GCP Dataflow, I have a <code>DoFn.process</code> that takes a long time. My DoFn takes a long time for reasons that are not that important - I have to accept them due to requirements out of my control. But if you must know, it is making network calls to external services that tak... | <python><timeout><google-cloud-dataflow><apache-beam><apache-beam-internals> | 2023-01-04 06:10:45 | 1 | 965 | cozos |
75,001,534 | 10,937,025 | How to upload a link of file in postman instead of downloading file in Django | <p>I created an API, that take xlsx as input file for post method and give me edited xlsx file.</p>
<p><strong>Problem is</strong>:- File I got from link and I have to download the xlsx file every time and put in postman.</p>
<p><strong>What I want</strong>:- directly put link in postman for input file</p>
<p><strong>N... | <python><django><postman> | 2023-01-04 06:10:38 | 1 | 427 | ZAVERI SIR |
75,001,178 | 13,194,245 | How to visualise nested functions in Django Admin documentation generator | <p>I have a django project and inside my <code>views.py</code> file I have the following (theoretical) functions where you can see that the <code>get_fullname()</code> function is nested:</p>
<pre><code>def dataframerequest(request, pk):
df_re = database_sql.objects.filter(projectid=pk).values()
df_list = [k for k ... | <python><django><documentation><documentation-generation> | 2023-01-04 05:09:33 | 1 | 1,812 | SOK |
75,001,076 | 3,264,407 | Flask-Sqlalchemy pagination - how to paginate through a table when there are multiple tables on same page | <p>I would like to have multiple tables on the same page and to be able to paginate through these tables individually.
Currently if I click Next to go to the next page of results for a table then all of the tables on the page go to the next page. This is an issue if the tables have a different number of pages as the on... | <python><ajax><pagination><flask-sqlalchemy> | 2023-01-04 04:48:23 | 2 | 473 | calabash |
75,001,056 | 4,451,521 | Correct way to test a function that has some unused parameter | <p>Rather than coding this is a question on how to correctly test a function.</p>
<p><strong>Background</strong></p>
<p>I am using pytest to test a function. Now a bit about the background of this function</p>
<p>Originally the developers wrote a function like</p>
<pre><code>def the_function(first_df, second_df)
</code... | <python><unit-testing> | 2023-01-04 04:45:21 | 1 | 10,576 | KansaiRobot |
75,000,973 | 6,335,363 | How can I cleanly assign class attributes as an instance of that class in Python? | <p>Consider the code below:</p>
<pre class="lang-py prettyprint-override"><code>class Color:
RED: "Color"
GREEN: "Color"
BLUE: "Color"
WHITE: "Color"
BLACK: "Color"
def __init__(self, r: int, g: int, b: int) -> None:
self.r = r
... | <python><class><attributes> | 2023-01-04 04:28:54 | 1 | 2,081 | Maddy Guthridge |
75,000,688 | 1,187,968 | Python List Indexing: What's the advantage of using Inclusive index for lower bound, and Exclusive index for upper bound? | <p>For example, in the <code>range(0, 6)</code> function, we only generate number from 0 to 5. 0 is included, but 6 is excluded.</p>
<p>Also I see this in list slicing. That <code>mylist[:6]</code>, index 0-5 in included, but index 6 is excluded.</p>
<p>What are the benefits of such indexing mechanisms? I find it stran... | <python><list><indexing> | 2023-01-04 03:29:57 | 1 | 8,146 | user1187968 |
75,000,519 | 6,114,709 | Comparing two dataframes on given columns | <p>I have two dataframes DF1 and DF2 with different column sets</p>
<pre><code>------------------------------------------------
DF1
col1 col2 col3 col4 col5 col6 col7
---------------------------------------------
Asr Suh dervi xyz yes NY 2022... | <python><pandas><dataframe><pyspark> | 2023-01-04 02:52:25 | 2 | 301 | Koushur |
75,000,224 | 2,930,156 | Why is tensorflow prediction_step extremely slow when the input features are python primitives instead of tensors? | <p>I spent half an hour debugging on the slowness of the following code snippet</p>
<pre><code>import time
feature_values = {'query': ['hello', 'world'], 'ctr': [0.1, 0.2]}
model = tf.saved_model.load(model_path)
start = time.time()
output = model.prediction_step(feature_values)
print(time.time() - start)
</code></pre... | <python><tensorflow2.0> | 2023-01-04 01:43:39 | 1 | 985 | John Jiang |
75,000,164 | 4,682,839 | Can't play video created with OpenCV VideoWriter | <h1>MWE</h1>
<pre class="lang-py prettyprint-override"><code>import cv2
FPS = 30
KEY_ESC = 27
OUTPUT_FILE = "vid.mp4"
cam = cv2.VideoCapture(0)
codec = cv2.VideoWriter.fourcc(*"mp4v") # MPEG-4 http://mp4ra.org/#/codecs
frame_size = cam.read()[1].shape[:2]
video_writer = cv2.VideoWriter(OUTPUT_FI... | <python><opencv> | 2023-01-04 01:31:30 | 1 | 2,096 | mcp |
75,000,045 | 4,019,495 | Is there a clean way to reindex a pandas dataframe, where you don't know if the index is a multiindex or a normal index? | <p>I have a pandas dataframe whose index might be a multiindex or may just be a normal index. This results from doing a groupby where there are one or more groups.</p>
<p>Regardless, I try to reindex with an index constructed from pd.MultiIndex.from_product. However this doesn't work.</p>
<pre><code>a = pd.DataFrame([1... | <python><pandas> | 2023-01-04 01:03:04 | 1 | 835 | extremeaxe5 |
74,999,927 | 2,482,149 | KeyError When Trying to Insert Nested Dictionary Into Postgres Table PsycoPg2 | <p>I'm getting this error <code>KeyError: 'country.id'</code> when I use psycopg2 to insert a list with a nested dictionary into a table in postgres:</p>
<pre><code>import psycopg2
import logging
from psycopg2.extras import LoggingConnection
def insert_fixture_data(match: dict):
conn = psycopg2.connect(
con... | <python><sql><postgresql><psycopg2> | 2023-01-04 00:36:37 | 1 | 1,226 | clattenburg cake |
74,999,869 | 10,430,394 | Clip patch not actually clipping in matplotlib | <p>I've made an animation that is supposed to show a Japanese hiragana character being drawn. To that end I am using a clip path so that my drawn line will only fill out a predetermined area. However, the clip path doesn't seem to do anything. It's not returning any errors and the clip patch is just not being applied i... | <python><matplotlib><animation><clip> | 2023-01-04 00:23:10 | 1 | 534 | J.Doe |
74,999,834 | 2,299,692 | MemoryError in Jupyter but not in Python | <p>I'm running</p>
<pre><code>NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
</code></pre>
<p>with plenty of memory</p>
<pre><code> total used free shared buff/cache available
Mem: 125G... | <python><jupyter-notebook><anaconda><out-of-memory><centos7> | 2023-01-04 00:13:15 | 1 | 1,938 | David Makovoz |
74,999,761 | 1,275,942 | Sqlalchemy many-to-many association proxy: silently reject duplicates | <p>I have a many to many association using association proxies as follows:</p>
<pre><code>import sqlalchemy.orm as orm
import sqlalchemy as sa
import sqlalchemy.ext.associationproxy as ap
class Asset(BaseModel):
__tablename__ = 'assets'
id = sa.Column(sa.Integer, primary_key=True)
name = sa.Column(sa.VARCH... | <python><sqlalchemy> | 2023-01-03 23:57:19 | 1 | 899 | Kaia |
74,999,752 | 5,750,741 | Executing parameterized BigQuery SQL inside the Python function | <p>I am trying to pass some parameters through a Python function. Inside the function, I am trying to execute BigQuery SQL and update an existing table(creating and replacing tables). I keep getting</p>
<pre><code>BadRequest: 400 1.2 - 1.118: Unrecognized token CREATE.
[Try using standard SQL (https://cloud.google.com/... | <python><google-bigquery> | 2023-01-03 23:55:02 | 1 | 1,459 | Piyush |
74,999,616 | 9,485,834 | shutil.copy() throwing up invalid argument error when repeating | <p>I'm seeing some very odd behavior with shutil's copy method.</p>
<p>Here is my basic code:</p>
<pre class="lang-py prettyprint-override"><code>def time_and_log(func):
def inner_function(*args,**kwargs):
times = np.array([])
repititions = kwargs.pop("repititions",1)
for i in rang... | <python><shutil><python-os> | 2023-01-03 23:23:26 | 0 | 600 | Jamalan |
74,999,514 | 12,713,678 | Can't bind a Python function to a QML button | <p>I've been struggling with binding QT Quick Application front-end and back-end. Here's my code. For a clear and short example the function prints "Hello from back-end" as an output without getting any arguments.</p>
<p><strong>main.py</strong></p>
<pre><code>from pathlib import Path
from PySide6.QtGui impor... | <python><qt><qml><pyside6> | 2023-01-03 23:06:28 | 1 | 347 | Philipp |
74,999,497 | 14,141,126 | Return key/value pairs from dict if values are found in list | <p>I have a list with several Active Directory codes. I also have a dictionary that is built from a live query of the AD, meaning this dictionary does not hold constant key/value pairs. I get a large number of AD events each time the server is queried, but I'm only interested in some of them. AD events are categorized ... | <python> | 2023-01-03 23:03:41 | 1 | 959 | Robin Sage |
74,999,450 | 4,262,057 | Fetch does not send body in POST request (request.get_json(silent=True) is empty) | <p>I am having the following custom component in which I am trying to send a HTTP post request to a server. The curl of this command is as follows:</p>
<pre><code>curl --location --request POST 'https://CLOUD-FUNCTION-HTTP-URL' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer foo' \
--heade... | <javascript><python><reactjs><fetch-api> | 2023-01-03 22:57:44 | 1 | 7,054 | WJA |
74,999,181 | 18,758,062 | How to cycle colors in Matplotlib PatchCollection? | <p>I am trying to automatically give each <code>Patch</code> in a <code>PatchCollection</code> a color from a color map like <code>tab20</code>.</p>
<pre><code>from matplotlib.collections import PatchCollection
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(5,5))
coords = [
(0, 0),
(1, 2),
... | <python><matplotlib> | 2023-01-03 22:15:58 | 2 | 1,623 | gameveloster |
74,999,093 | 3,103,957 | Are builtins like str() and int() functions or classes? | <p>In Python, when we call <code>str(<something>)</code>, are we calling the function, or are we calling the class constructor (the class being <code>str</code>)? Similarly, <code>int()</code>, <code>complex()</code> etc.</p>
| <python><function><class> | 2023-01-03 22:02:40 | 0 | 878 | user3103957 |
74,998,958 | 12,436,050 | Compare dataframes and add new rows in python | <p>I have two pandas dataframes.</p>
<pre><code>df1
col1 col2 col3 col4
A C0079731 s1 abc
A C0079731 s2 abc
</code></pre>
<pre><code>df2
col1 col2 col3
A C0079731 s1
A C0079731 s2
AA C0079731 s3
</code></pre>
<p>I would like to compare col2 and if any 'col3'... | <python><pandas> | 2023-01-03 21:47:44 | 1 | 1,495 | rshar |
74,998,947 | 12,603,110 | What's python's LOAD_FAST bytecode instruction fast at? | <p><a href="https://docs.python.org/3/library/dis.html#opcode-LOAD_FAST" rel="nofollow noreferrer">https://docs.python.org/3/library/dis.html#opcode-LOAD_FAST</a></p>
<p>I have been wondering, why is it specifically named fast and not just "load"?</p>
<p>What alternatives could be used instead that are "... | <python> | 2023-01-03 21:46:53 | 1 | 812 | Yorai Levi |
74,998,715 | 353,337 | Add multiple elements to pathlib path | <p>I have a Python pathlib <code>Path</code> and a list of strings, and I'd like to concatenate the strings to the path. This works</p>
<pre class="lang-py prettyprint-override"><code>from pathlib import Path
a = Path("a")
lst = ["b", "c", "d"]
for item in lst:
a = a / item... | <python><pathlib> | 2023-01-03 21:16:29 | 2 | 59,565 | Nico Schlömer |
74,998,706 | 3,672,883 | How can I add external python modules in runtime? | <p>I am trying to load a torch model, in order to do this, the model <code>.pt</code> needs two modules.</p>
<p>In my code I have the following structure:</p>
<pre><code>src
__init__.py
....
</code></pre>
<p>I am trying to add that two modules to src in runtime with <code>sys.path.insert(0, path)</code> but doesn'... | <python><pytorch> | 2023-01-03 21:14:59 | 0 | 5,342 | Tlaloc-ES |
74,998,629 | 443,836 | How to call a field of CFUNCTYPE? | <p>I have a DLL (<code>.dll</code> for Windows, <code>.so</code> for Linux) and this autogenerated C header file for that DLL (excerpt):</p>
<hr />
<p><strong>Edit notes</strong></p>
<p><strong>tl;dr:</strong> I have updated my header excerpt and Python code because I had left out too much.</p>
<p><strong>Details:</str... | <python><ctypes> | 2023-01-03 21:02:34 | 1 | 4,878 | Marco Eckstein |
74,998,540 | 5,832,020 | Filter list of rows based on a column value in PySpark | <p>I have a list of rows after using collect. How can I get the "num_samples" value where sample_label == 0? That is to say, how can I filter list of rows based on a column value?</p>
<pre><code>[Row(sample_label=1, num_samples=14398),
Row(sample_label=0, num_samples=12500),
Row(sample_label=2, num_samples=... | <python><pyspark> | 2023-01-03 20:51:11 | 2 | 483 | Salty Gold Fish |
74,998,392 | 12,574,341 | Python reverse() vs [::-1] slice performance | <p>Python provides two ways to reverse a list:</p>
<p>List slicing notation</p>
<pre class="lang-py prettyprint-override"><code>['a','b','c'][::-1] # ['c','b','a']
</code></pre>
<p>Built-in reversed() function</p>
<pre class="lang-py prettyprint-override"><code>reversed(['a','b','c']) # ['c','b','a']
</code></pre>
<p>A... | <python><performance> | 2023-01-03 20:32:22 | 1 | 1,459 | Michael Moreno |
74,998,328 | 20,803,947 | The mypy daemon executable ('dmpy') was not found | <p>I installed mypy with poetry and after that I installed the mypy extension in vs code, but the message :</p>
<p>The mypy daemon executable ('dmypy') was not found on your PATH. Please install mypy or adjust the mypy.dmypyExecutable setting.</p>
<p>when I run the command 'which mypy', I get the result:</p>
<p>/Users/... | <python><mypy> | 2023-01-03 20:25:32 | 4 | 309 | Louis |
74,998,294 | 5,212,614 | How to find number of months between two dates where datatype is datetime64[ns] | <p>I have two fields in a dataframe, both of which are <code>datetime64[ns]</code></p>
<p>I thought I could just do this...</p>
<pre><code>df_hist['MonthsBetween'] = (df_hist.Last_Date - df_hist.Begin_Time) / pd.Timedelta(months=1)
</code></pre>
<p>One field has only a data and one has a date/time, but both are of data... | <python><python-3.x><pandas> | 2023-01-03 20:21:07 | 1 | 20,492 | ASH |
74,998,079 | 4,586,180 | how to display python time.time() stored as a float in bigquery as a datetime? | <p>I am a bigquery newbie</p>
<p>we have a table that stores the output from time.time() as float. For example</p>
<pre><code>1671057937.23425
1670884516.891432
</code></pre>
<p>How can I select these values such that they are formated/displayed as date and time stamp.</p>
<p>I have tried casting to int64, using variou... | <python><time><google-bigquery> | 2023-01-03 19:54:18 | 2 | 968 | AEDWIP |
74,998,040 | 466,316 | Python: Crypto package error: "No module called '_number_new'" | <p>I have a software which installs its own local Python 3.9. Included in its python39/lib/site-packages is Crypto package, which causes errors and seems old and incompatible with Python 3.9. It includes long integers, like 1L, which I fixed by removing the "L". But I'm still getting the error below, even tho... | <python><package><cryptography> | 2023-01-03 19:50:20 | 1 | 639 | MrSparkly |
74,997,987 | 678,572 | Why does Scikit-Learn's DecisionTreeClassifier return zero weighted features after removing zero weighted features and refitting? | <p>Ive been trying to figure out why this is happening. I'm fitting a <code>DecisionTreeClassifier</code> and the model determines that a few features are not informative for the prediction. Fitting the same model with the same hyperparameters using all of the informative features (i.e., features that have a weight &... | <python><scikit-learn><classification><decision-tree><feature-selection> | 2023-01-03 19:44:40 | 1 | 30,977 | O.rka |
74,997,979 | 12,127,295 | Complex lambda with sqlalchemy filter query | <p>Consider an ORM class describing a <em>"Store"</em>:</p>
<pre class="lang-py prettyprint-override"><code>class Store(Base, AbstractSchema):
__tablename__ = 'store'
id = Column(Integer, primary_key=True)
...
s2_cell_id = Column(BigInteger, unique=False, nullable=True)
</code></pre>
<p... | <python><sqlalchemy><s2> | 2023-01-03 19:43:08 | 0 | 455 | John C. |
74,997,885 | 9,947,140 | How to specify a search path with SQL Alchemy and pg8000? | <p>I'm trying to connect to a postgres db using SQL Alchemy and the pg8000 driver. I'd like to specify a search path for this connection. With the Psycopg driver, I could do this by doing something like</p>
<pre><code>engine = create_engine(
'postgresql+psycopg2://dbuser@dbhost:5432/dbname',
connect_args={'opti... | <python><sqlalchemy><pg8000> | 2023-01-03 19:30:02 | 2 | 342 | randomrabbit |
74,997,732 | 4,645,982 | An expression attribute name used in the document path is not defined; attribute name: #buyer | <p>I am using reserve DynamoDB keywords live value,users, name. I have create entry in DynamoDB with</p>
<pre><code>{
"id":1
"poc_name": "ABC"
}
</code></pre>
<p>I want to update exiting records with</p>
<pre><code>{
"id": 1,
"poc_name": "ABC",
... | <python><python-3.x><amazon-dynamodb><boto3> | 2023-01-03 19:13:42 | 1 | 2,676 | Neelabh Singh |
74,997,433 | 991,076 | how to share code between python project and airflow? | <p>We have a python project structure as following, airflow is a new:</p>
<pre><code>├── python
│ ├── airflow
│ │ ├── airflow.cfg
│ │ ├── config
│ │ ├── dags
│ │ ├── logs
│ │ ├── requirements.txt
│ │ └── webserver_config.py
│ ├── shared_utils
│ │ ├── auth
│ │ ├── datadog
│ │ ├── ... | <python><airflow> | 2023-01-03 18:40:48 | 2 | 2,630 | seaguest |
74,997,386 | 3,278,050 | Offset parallel overlapping lines | <p>I am creating a step plot with matplotlib, but some parallel line sections overlap others (hiding those beneath).</p>
<pre class="lang-py prettyprint-override"><code>import matplotlib.pyplot as plt
x = [0, 1, 2, 3, 4, 5]
y1 = [12, 12, 8, 10, 12, 11]
y2 = [11, 11, 8, 9, 11, 11]
y3 = [11, 10, 7, 11, 11, 11]
for y in... | <python><matplotlib> | 2023-01-03 18:36:19 | 1 | 355 | onewhaleid |
74,996,835 | 5,489,190 | Problems with using C dll in python | <p>I'm trying to import my own made C dll to python code. The function in the dll accepts 10x1 vector of float, return 1 float as result. This is MWE how I try to use it:</p>
<pre><code>from ctypes import*
import numpy as np
mydll = cdll.LoadLibrary(".\Test.dll")
input=[18.1000, 1.1000, 0.2222, 0.2115, 0.0663... | <python><python-3.x><dll><ctypes><dllimport> | 2023-01-03 17:42:31 | 1 | 749 | Karls |
74,996,834 | 9,671,120 | Memory-efficient DataFrame.stack() | <p>If I <code>memray</code> the following code, <code>df.stack()</code> allocates 22MB, when the df is only 5MB.</p>
<pre><code>import numpy as np
import pandas as pd
columns = list('abcdefghijklmnopqrstuvwxyz')
df = pd.DataFrame(np.random.randint(0,100,size=(1000, 26*26)), columns=pd.MultiIndex.from_product([columns,... | <python><pandas><memory> | 2023-01-03 17:42:25 | 0 | 386 | C. Claudio |
74,996,702 | 11,853,066 | PIL/Numpy: enlarging white areas of black/white mask image | <p>I want to produce a Python algorithm which takes in a 'mask' RGB image comprised exclusively of black and white pixels. Basically, each mask is a black image with one or more white shapes on it (see below).</p>
<p><a href="https://i.sstatic.net/XlAiE.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/XlA... | <python><numpy><python-imaging-library><dilation> | 2023-01-03 17:29:49 | 2 | 355 | Ben123 |
74,996,648 | 925,913 | How to set a side_effect on an instance method of a class that's been patched? | <p>How do I get a method of a <code>@patch</code>'ed class to throw an Exception when called?</p>
<p><code>B</code> is just a class that you can call <code>go()</code> on, which in turn just prints that it happened:</p>
<pre><code># module_b.py
class B:
def __init__(self) -> None:
self.x = True
print(&quo... | <python><python-unittest.mock> | 2023-01-03 17:24:50 | 1 | 30,423 | Andrew Cheong |
74,996,476 | 20,920,790 | How to make user function (group_by().apply and def function with agg functions) | <p>friends!</p>
<p>I got this code:</p>
<pre><code>def agr_list(x):
f = {}
f['quantity'] = sum(x['quantity'])
f['revenue'] = sum(x['quantity']*x['price'])
return pd.Series(f, index=['quantity', 'revenue'])
z6_g = (
z6.
groupby('name', as_index=False).
apply(agr_list)
)
</code></pre>
<p>It's ... | <python><pandas> | 2023-01-03 17:08:33 | 1 | 402 | John Doe |
75,004,889 | 802,339 | Where is Qiskit's RepetitionCode class now? | <p>Now that Qiskit's <code>ignis</code> module has been deprecated, where does <code>qiskit.ignis.verification.topological_codes.RepetitionCode</code> or its equivalent reside now?</p>
| <qiskit><python> | 2023-01-03 16:57:48 | 1 | 1,398 | bisarch |
74,996,280 | 5,106,834 | Reducing number of repeated queries in Django when creating new objects in a loop | <p>I'm populating a database using Django from an Excel sheet. In the example below, the <code>purchases</code> list simulates the format of that sheet.</p>
<p>My problem is that I'm repeatedly using <code>Customer.objects.get</code> to retrieve the same <code>Customer</code> object when creating new <code>Purchase</co... | <python><django><performance> | 2023-01-03 16:51:48 | 2 | 607 | Andrew Plowright |
74,996,216 | 12,415,855 | Selecting value from dropdown-box is not possible with selenium? | <p>I try to select the value "Ukrainian Division" in the dropdown box of the following site:</p>
<p><a href="https://www.cyberarena.live/schedule-efootball" rel="nofollow noreferrer">https://www.cyberarena.live/schedule-efootball</a></p>
<p>with the following code:</p>
<pre><code>from selenium import webdrive... | <python><selenium><selenium-webdriver><xpath><webdriverwait> | 2023-01-03 16:45:21 | 1 | 1,515 | Rapid1898 |
74,996,170 | 4,724,240 | How to make a function switch with numba | <p>I have 3 jitted functions, <code>a(x)</code>, <code>b(x)</code> and <code>c(x)</code>.</p>
<p>I need a switch function that does this:</p>
<pre><code>@nb.njit
def switch(i, x):
if i == 0:
return a(x)
elif i == 1:
return b(x)
elif i == 2:
return c(c)
</code></pre>
<p>But I would li... | <python><numba> | 2023-01-03 16:40:37 | 1 | 1,334 | Axel Puig |
74,996,089 | 4,971,866 | Jupyter widgets: disable a button if input is empty else enable? | <pre class="lang-py prettyprint-override"><code>widgets.VBox([
widgets.Text(value=""),
widgets.Button(
description="Click",
disabled=# ???,
)
]
)
</code></pre>
<p>How could I make the button disable based on the input value?</p>
<p>Disable when input is <code>''</code>, e... | <python><jupyter-notebook><jupyter-lab> | 2023-01-03 16:32:45 | 1 | 2,687 | CSSer |
74,995,953 | 925,913 | Why is setting a method to have a side_effect causing construction of that method's class to throw? | <p>I'm trying to create an MVCE for another problem I'm having. But I ran into an intermediate problem. You should be able to see and run an MVCE <a href="https://trinket.io/python3/f5e6dfe9d9" rel="nofollow noreferrer">here</a>, but here it is laid out:</p>
<p><strong>B</strong> is just a class that you can call <stro... | <python><unit-testing><exception><mocking> | 2023-01-03 16:23:05 | 0 | 30,423 | Andrew Cheong |
74,995,951 | 3,482,266 | Slicing from a generator in blocks of specific size | <pre><code>list_values = [...]
gen = (
list_values[pos : pos + bucket_size]
for pos in range(0, len(list_values), bucket_size)
)
</code></pre>
<p>Is there a way to make this work if list_values is a generator instead?
My objective is to reduce RAM usage.</p>
<p>I know that I can use itertools.islice... | <python><generator> | 2023-01-03 16:23:01 | 1 | 1,608 | An old man in the sea. |
74,995,910 | 7,215,536 | how to add conditionals in html attribute | <p>I am using django 4.1.4 and I am new to it.</p>
<p>In a form I want to set the correct url based on the variable 'update'. If the variable is True, then the template is used for update (in this case a different url), else save new data.</p>
<p>I created something like this:</p>
<pre><code><form action="{% if... | <python><django> | 2023-01-03 16:18:20 | 1 | 1,021 | calin24 |
74,995,851 | 7,161,082 | Copy files from gridfs to another gridfs database | <p>I am searching for a way to copy files in gridfs. The idea is to keep all additional and metadata of the file, like the same "_id" etc.</p>
<p>The use case is to setup a testing database with fraction of files in gridfs and maintaining the references to other collections and documents that are copied.</p>
... | <python><pymongo><gridfs> | 2023-01-03 16:13:31 | 1 | 493 | samusa |
74,995,792 | 6,677,891 | Using statannot with split violin plot | <p>I'm plotting some data as split violin and using <code>statannot</code> library to do T-test. I managed to get the plot and the annotation but I would like to <strong>tune the horizontal offset</strong> of the annotation. I checked the <code>statannot</code> example on <a href="https://github.com/webermarcolivier/st... | <python><pandas><matplotlib><seaborn><violin-plot> | 2023-01-03 16:07:27 | 2 | 495 | gaya |
74,995,791 | 5,516,353 | Regex split but keep delimiter returning different than expected value | <p>I am trying to split a string that represents a simple mathematical equation over <code>+</code>, <code>-</code>, <code><<</code> and <code>>></code> while keeping the symbol. I can't find where the problem is.</p>
<pre><code>>>> re.split(r'( \+ )|( \<\< )|( \- )|( \>\> )', 'x - x')
... | <python><regex> | 2023-01-03 16:07:25 | 1 | 312 | Ziad Amerr |
74,995,719 | 6,758,739 | Identify the sql statements using python | <p>The task is to identify if the SQL statements is a DML / DDL or not.</p>
<p>So I had to use an array and push all the DML/DDL patterns into that and search for them by iterating.</p>
<p>Below is a simple code snippet where</p>
<ol>
<li>I am sending an SQL query as a parameter</li>
<li>Check if it has update, alter,... | <python><sql> | 2023-01-03 16:00:51 | 1 | 992 | LearningCpp |
74,995,609 | 11,611,246 | SPy error: "Axes don't match array" when calling .open_memmap() | <p>I have some <code>.bsq</code> files with corresponding header files (<code>.hdr</code>). I want to open and edit them in Python, using the <code>spectral</code> (<a href="https://www.spectralpython.net/" rel="nofollow noreferrer">SPy</a>) module.</p>
<p>Since I need to edit the files from within a Python Toolbox in ... | <python><numpy><spectral-python> | 2023-01-03 15:50:42 | 0 | 1,215 | Manuel Popp |
74,995,422 | 19,303,365 | Fetching the Max Payment from Group with Payer ID in pandas dataframe | <p>Existing Dataframe :</p>
<pre><code>Group Payer_ID status Payment_Amount
A 11 P 100
A 12 P 100
A 13 Q 50
A 14 P 100... | <python><pandas><dataframe> | 2023-01-03 15:33:31 | 0 | 365 | Roshankumar |
74,995,213 | 2,013,672 | backslashes in strings | <p>When printinga a string containing a backslash, I expect the backslash (<code>\</code>) to stay untouched.</p>
<pre><code>test1 = "This is a \ test String?"
print(test1)
'This is a \\ test String?'
test2 = "This is a '\' test String?"
print(test2)
"This is a '' test String?"
</code></p... | <python> | 2023-01-03 15:13:52 | 3 | 4,449 | Sadık |
74,994,991 | 1,139,541 | Select sub-packages inside a main package for build | <p>I have a folder structure where there is a main package (mypkg) holding inside several sub-packages (subpkg1, subpkg2, ..., subpkgN):</p>
<pre><code>project_root_directory
├── pyproject.toml
├── ...
└── mypkg/
├── __init__.py
├── subpkg1/
│ ├── __init__.py
│ ├── ...
│ └── module1.py
└──... | <python><setuptools> | 2023-01-03 14:52:53 | 1 | 852 | Ilya |
74,994,921 | 1,324,023 | python pandas generate pdf file from dataframe | <p>We can easily export pandas dataframe to csv file. Please find the code below:</p>
<pre><code>import pandas as pd
df = pd.read_csv('/Users/ashy/Downloads/weather_data.csv');
df.to_csv('/Users/ashy/Downloads/file1.csv');
</code></pre>
<p>Is there an easy way to generate pdf file from dataframe. There isn't any metho... | <python><pandas><pdf> | 2023-01-03 14:47:29 | 1 | 1,599 | Ashy Ashcsi |
74,994,907 | 11,894,831 | Complex Json parsing: key not found but seems there yet | <p>I have this "very nested" Json: <a href="https://textdoc.co/iWgRduZxl2JEkXU1" rel="nofollow noreferrer">https://textdoc.co/iWgRduZxl2JEkXU1</a> that i have to get through a webservice (no issue there) and then operate with Python (issue there).</p>
<p>I have used this online tools to create the python clas... | <python><json> | 2023-01-03 14:45:48 | 1 | 475 | 8oris |
74,994,901 | 10,430,394 | Can't set matplotlib.path.Path as clip_path in matplotlib. How to provide transform to patch? | <p>I'm trying to animate a patch in matplotlib. The patch is supposed to be filled incrementally with a stroke of black while using the patch as a clip path. Essentially, I am trying to make <a href="https://github.com/parsimonhi/animCJK/tree/master/svgsKana" rel="nofollow noreferrer">these</a> svg animations from the ... | <python><matplotlib><svg><clip> | 2023-01-03 14:45:05 | 0 | 534 | J.Doe |
74,994,857 | 15,406,157 | How to upgrade pip offline | <p>I have machine with CentOS 7.9 and pip version <code>pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)</code>.</p>
<p>I need to install on my machine <code>impacket</code>. But installation fails because pip is too old.
So I upgrade pip with command</p>
<p><code>pip3 install --upgrade pip</code> and after... | <python><python-3.x><pip><yum> | 2023-01-03 14:41:25 | 1 | 338 | Igor_M |
74,994,827 | 818,131 | Python/Django: setuptools/flit entry_point module path not found? | <p>I have a problem that I can't solve since days. I created a python module "medux_timetracker" packaged as <a href="https://gdaps.readthedocs.og" rel="nofollow noreferrer">GDAPS</a> plugin, details below, using an entry point. But the entry point is not recognized - and I'm stuck.
The module is installed us... | <python><django><entry-point><flit> | 2023-01-03 14:38:22 | 1 | 1,092 | nerdoc |
74,994,811 | 4,796,942 | Import all values in .bashrc as enviroment variables | <p>I have created a <code>.bashrc</code> file using:</p>
<pre><code>touch ~/.bashrc
</code></pre>
<p>and I am trying to get all the variables in it to be environment variables in my current environment. I saw online that you can source into it as <code>source ~/.bashrc</code> but nothing changed when I did this (I coul... | <python><bash><environment-variables> | 2023-01-03 14:37:11 | 2 | 1,587 | user4933 |
74,994,760 | 4,137,061 | Fuseki returns no results when called from Python vs curl or online | <p>I'm setting up Fuseki/Jena to host a persistent collection of rdf and I'd like to control uploads through a python interface using rdflib graph objects as a means of pre-filtering/mastering the content before it reaches the persistence layer.</p>
<p>I've started the server, and can access data via the online SPARQL ... | <python><fuseki><rdflib> | 2023-01-03 14:33:35 | 1 | 11,127 | Thomas Kimber |
74,994,614 | 720,877 | How to implement simple terminal line editing similar to input() but handling escape character | <p>How can I implement a Python function to run on Unix systems (minimally, just Linux) that is similar to builtin <code>input()</code>, but supports using the escape key to cancel inputting text? So:</p>
<ul>
<li>Enter a single line of text at the command line (multiple lines would be OK also)</li>
<li>with simple li... | <python><unix><terminal> | 2023-01-03 14:20:14 | 1 | 2,820 | Croad Langshan |
74,994,560 | 11,901,834 | Mock pandas read_csv using pytest | <p>I have a python function that takes a BigQuery bucket name & file path as inputs and does the following:</p>
<ul>
<li>Check if the bucket it exists</li>
<li>Check if the file is in the bucket</li>
<li>Read the file into a dataframe and return the dataframe</li>
</ul>
<p>The function looks something like this:</p... | <python><pytest> | 2023-01-03 14:15:45 | 0 | 1,579 | nimgwfc |
74,994,530 | 12,559,770 | pivot table in pandas | <p>I have a dataframe such as :</p>
<pre><code>Groups Species Value
G1 SP1 YES
G1 SP2 YES
G1 SP3 NO
G1 SP4 YES
G2 SP1 NO
G2 SP2 NO
G2 SP4 YES
G3 SP1 YES
G3 SP2 YES
G4 SP1 NO
</code></pre>
<p>And I would liek simply to pivot the table such ... | <python><pandas> | 2023-01-03 14:13:25 | 0 | 3,442 | chippycentra |
74,994,508 | 4,391,249 | How to safely use the file system as a sort of shared memory in Python? | <p>TLDR: Script A creates a directory and writes files in it. Script B periodically checks that directory. How does script B know when script A is done writing so that it can access the files?</p>
<p>I have a Python script (call it the render server) that receives requests to generate images and associated data. I need... | <python><multiprocessing> | 2023-01-03 14:11:51 | 1 | 3,347 | Alexander Soare |
74,994,477 | 5,852,692 | Checking the return value of API-Functions Python | <p>I am using an C++ API via Python using <code>ctypes.CDLL</code>:</p>
<pre><code>api = CDLL(f'{path}/dll_name.dll')
</code></pre>
<p>This api has functions like open, remove, delete, select, read, write, etc... Whenever I use these functions it returns something. When I call these api functions via debugger one by on... | <python><error-handling><ctypes> | 2023-01-03 14:09:53 | 1 | 1,588 | oakca |
74,994,476 | 2,196,409 | passing **kwargs to a de-referencing function | <p>Hope the title is conveying the correct information.</p>
<p>My problem is that I don't understand why call <code>kwarg_function(some_func, a=1, b=2, c=3)</code> fails. I would have thought that as 'c' isn't referenced with <code>some_func()</code> it would simply be ignored. Can anyone explain why 'c' isn't simply i... | <python><python-3.x> | 2023-01-03 14:09:49 | 2 | 1,173 | eklektek |
74,994,161 | 159,072 | Is it possible to use two separate event handler functions on the server side? | <p>In the supplied source code,</p>
<ol>
<li><p>The client-side has two event-handlers: <code>connect</code> and <code>server_to_client</code>. When the page loads for the first time, the <code>connect</code> emits texts: <code>hello!</code> and <code>world!</code>.</p>
</li>
<li><p>Then, on the server side, the functi... | <python><flask><flask-socketio> | 2023-01-03 13:40:16 | 1 | 17,446 | user366312 |
74,993,968 | 5,896,319 | How to check user is authorised or not in urls.py? | <p>I'm using a library for creating several calls in the front end but I have a problem. The library does not have authenticated user control, which is a severe problem, and also I cannot change the library for some reason.</p>
<p>Is there a way to control the user login in urls.py?</p>
<p><strong>urls.py</strong></p>
... | <python><django> | 2023-01-03 13:24:06 | 1 | 680 | edche |
74,993,877 | 6,485,881 | Different behavior of apply(str) and astype(str) for datetime64[ns] pandas columns | <p>I'm working with datetime information in pandas and wanted to convert a bunch of <code>datetime64[ns]</code> columns to <code>str</code>. I noticed a different behavior from the two approaches that I expected to yield the same result.</p>
<p>Here's a <a href="https://stackoverflow.com/help/minimal-reproducible-examp... | <python><pandas><datetime> | 2023-01-03 13:15:49 | 1 | 13,322 | Maurice |
74,993,869 | 2,263,683 | Nested curly brackets in Psycopg2 SQL Composition query | <p>I'm trying to create a query using <code>Pycopg2</code>'s <a href="https://www.psycopg.org/docs/sql.html" rel="nofollow noreferrer">SQL String Composition</a> which in I need to use a curly brackets inside my query to update a key value in a jsonb column. Something like this:</p>
<pre><code>update myschema.users set... | <python><postgresql><psycopg2> | 2023-01-03 13:15:09 | 2 | 15,775 | Ghasem |
74,993,391 | 1,806,392 | Use a list of filters within polars | <p>Is there a way to filter a polars DataFrame by multiple conditions?</p>
<p>This is my use case and how I currently solve it, but I wonder how to solve it, if my list of dates would be longer:</p>
<pre><code>dates = ["2018-03-25", "2019-03-31", "2020-03-29"]
timechange_forward = [(dateti... | <python><dataframe><python-polars> | 2023-01-03 12:29:10 | 3 | 2,314 | nik |
74,993,303 | 11,170,350 | How to remove box overlapping 90% with other bounding box | <p>I have list of bounding boxes. When I plot them, there are some boxes overlapping with other. How can I identify them?</p>
<p>Here is attached example</p>
<p><a href="https://i.sstatic.net/eSVv9.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/eSVv9.png" alt="enter image description here" /></a></p>
<p... | <python><numpy><opencv><non-maximum-suppression> | 2023-01-03 12:21:56 | 3 | 2,979 | Talha Anwar |
74,993,236 | 13,839,945 | Make function of class unusable after usage | <p>I want to create a one time usage method in my class. It should be possible to call the function one time, use a variable of the class, remove the variable and also remove the function. If the method is called afterwards it should raise an error that this method does not exist. If created a workaround which kind of ... | <python> | 2023-01-03 12:16:09 | 3 | 341 | JD. |
74,993,173 | 12,810,223 | The included URLconf does not appear to have any patterns in it. Error in Django | <pre><code>The included URLconf '<module 'myapp.urls' from 'C:\\Users\\Hp\\Desktop\\Python\\Django Projects\\myproject\\myapp\\urls.py'>' does not appear to have any patterns in it. If you see the 'urlpatterns' variable with valid patterns in the file then the issue is probably caused by a circular import.
</code... | <python><django> | 2023-01-03 12:09:24 | 1 | 1,874 | Shreyansh Sharma |
74,993,119 | 498,504 | keras always return same values in a Human horses CNN model example | <p>I'm working on a CNN model with Keras for Human vs Horses dataset to predict some images.</p>
<p>with following codes I build the model and save in a file:</p>
<pre><code>import tensorflow as tf
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from keras.optimizers import RMSprop
training_dir = '... | <python><tensorflow><keras> | 2023-01-03 12:03:36 | 1 | 6,614 | Ahmad Badpey |
74,992,979 | 1,987,258 | How to use an installed x509 Certificate as a Client certificate when programming a web request in python? | <p>I am working on a python script that is supposed to do web request using a client certificate from a store (so not from a file path). The certificate is already installed and the webrequest is already succeeding (when programmed in C# in a way similar to <a href="https://dotnetfiddle.net/1uAhSt" rel="nofollow norefe... | <python><x509certificate><x509><client-certificates> | 2023-01-03 11:49:52 | 0 | 3,058 | Daan |
74,992,948 | 10,035,978 | Get specific OID from SNMP | <p>I would like to get the sysUpTime from SNMP</p>
<p>It's my first time working on this so i am not sure how to make it work.
I downloaded the <strong>MIB Browser</strong> app and i get this:</p>
<p><a href="https://i.sstatic.net/cRGUE.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/cRGUE.png" alt="ente... | <python><snmp><pysnmp> | 2023-01-03 11:47:16 | 1 | 1,976 | Alex |
74,992,934 | 12,752,172 | How to create a setup file that run on hosted server python? | <p>I'm creating a python app to get details from a website. I'm using selenium and pyodbc to create my app. It is getting all the details and saves them into a SQL server database. It is working fine on my pycharm IDE. Now I need to use this app on a hosted server like Linux or ubuntu server. How can I create a .exe fi... | <python><selenium> | 2023-01-03 11:46:20 | 1 | 469 | Sidath |
74,992,915 | 9,827,719 | Panel for Python how to change Gauge colors and layout to be a semicircle | <p>I am using Panel framework from <a href="https://panel.holoviz.org" rel="nofollow noreferrer">https://panel.holoviz.org</a> in order to generate graphs in Python. I have generated a Gauge chart using the code form <a href="https://panel.holoviz.org/reference/panes/ECharts.html" rel="nofollow noreferrer">https://pane... | <python><panel> | 2023-01-03 11:44:25 | 1 | 1,400 | Europa |
74,992,739 | 906,704 | Dynamic change of selected value inside select tag in html page | <p>I'm a complete beginner in web development and I'm here to straight ask someone to create a javascript code to help my python flask app be a bit more user-friendly.</p>
<p>My HTML page consists of a table with several rows (it can be up to hundreds). and I want to allow the user to give rank to the most beautiful pl... | <javascript><python><html><flask> | 2023-01-03 11:28:13 | 1 | 533 | Carlos |
74,992,610 | 5,468,372 | Using Gunicorn with custom getMessage() logging --> logging error | <p>I'm using a custom <code>LogRecord</code> to handle an additional variable (<code>session_id</code>), each time a log is created</p>
<pre><code>class LogRecord(logging.LogRecord):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.session_id = None
def getMessage(sel... | <python><logging><gunicorn><plotly-dash> | 2023-01-03 11:15:28 | 1 | 401 | Luggie |
74,992,510 | 6,394,722 | Difference of writing jinja2 macro in one line V.S. writing macro in multiple lines? | <p>I have next jinja2 template:</p>
<p><strong>cfg.jinja2:</strong></p>
<pre><code>{% macro cfg() %}ABC{% endmacro %}
{% macro cfg2() %}
ABC
{% endmacro %}
resource:
{{ cfg()|indent(4) }}
{{ cfg2()|indent(4) }}
</code></pre>
<p>And, next python file:</p>
<p><strong>test.py:</strong></p>
<pre><code>import os
from jinja... | <python><jinja2> | 2023-01-03 11:07:31 | 1 | 32,101 | atline |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.