Skip to main content

All Questions

Tagged with
-1 votes
0 answers
170 views

Is there any advantage to use lazy tokenizer other than space & time efficiency?

Recently I tried to implement one tokenizer following this Python doc example for Software Design for Flexibility (SDF) exercise 5.7 (notice this is not one book teaching compiler specifically ...
An5Drama's user avatar
  • 747
4 votes
0 answers
55 views

Lazy evaluations for DataFrames

Let me provide quick demo which shows that second approach is 10x times slower than the first one. import pandas as pd from timeit import default_timer as timer r = range(1,int(1e7)) df = pd....
Slimboy Fat's user avatar
0 votes
1 answer
22 views

petl evaluation sequence possibly causing grief

In Python's petl library, according to the documentation, "This package makes extensive use of lazy evaluation and iterators. This means, generally, that a pipeline will not actually be executed ...
Steven Blyatman Chayka's user avatar
0 votes
1 answer
106 views

Is Python's map function evaluation lazy?

I've been solving LeetCode's 1331. Rank Transform of an Array challenge and came up with this one-line solution: class Solution: def arrayRankTransform(self): return map({e: i for i, e in ...
diduk001's user avatar
  • 218
2 votes
2 answers
161 views

Dataframes with Common Lazy Ancestor Means Repeated Computation?

Dependency DAG Description Pretty straight forward, basically, I am reading some parquet files from disk using polars which are the source of data. Doing some moderately heavy duty processing (a few ...
Della's user avatar
  • 1,668
1 vote
1 answer
125 views

Clean string column with messy data into numeric in polars

The following code has been given: import polars as pl import numpy as np # Set the random seed for reproducibility np.random.seed(0) # Define the sample size n = 35000000 # Define the possible ...
Vartholome's user avatar
0 votes
0 answers
39 views

Accesing python lists inside TensorFlow graph-traceable functions

I'm trying to access a python list inside a function that can be run in eager mode or graph mode as shown below: import tensorflow as tf import numpy as np class SlotGenerator: def __init__(self): ...
Naveen's user avatar
  • 469
1 vote
1 answer
332 views

Why does collecting a LazyFrame before joins in Polars solve my issue with index discrepancies?

Here is an example that is runnable and demonstrates the issue. Initial LazyFrame includes pairwise distances between points in a plane. Since A->B distance is equal to B->A distance I keep only ...
xaostheory's user avatar
0 votes
0 answers
62 views

Python logging: check if a log will print before doing f-string?

Suppose I have code I want to be able to run in production or verbose mode. In verbose, I want to print debug information that will slow the program down: import logging import time import sys logging....
Kaia's user avatar
  • 969
3 votes
1 answer
94 views

Polars timestamp synchronization lazy evaluation

I want to synchronize two numpy arrays of timestamps to each other using Polars LazyFrames. Let's assume that I have two numpy arrays of timestamps which are stored using LazyFrames: import polars as ...
jspieler's user avatar
  • 116
2 votes
1 answer
395 views

Replace pivot operation for use in lazy evaluation with polars

I have a set of events at timestamps, and for each timestamp I need the sum of the "last" values of each username. This can be done with a pivot table, but I would like to use LazyFrame, ...
sougonde's user avatar
  • 3,618
1 vote
0 answers
112 views

`torch.conj_physical` faster than `torch.conj` if full output is used?

conj docs torch.conj() performs a lazy conjugation, but the actual conjugated tensor can be materialized at any time using torch.resolve_conj() conj_physical docs This performs the conjugate ...
OverLordGoldDragon's user avatar
0 votes
0 answers
143 views

POLARS: pycharm exited with following error code : -1073741819 (0xC0000005) while converting lazyframes to polars dataframe using lf.collect()

I have a piece of code which is performing some computations on top of lazy frames. I have the output stored in form of lazy frames in a dictionary. At the end, I am converting the outputs to pandas ...
Surender Reddy Chitteddy's user avatar
-2 votes
2 answers
2k views

How to do lazy instantiation in python?

in the class below variables with str type are used but without declaring value from abc import ABC class User(ABC): first_name: str last_name: str is this lazy instantiation?
Gustavo Felipe's user avatar
2 votes
1 answer
80 views

How to avoid parametrization of a Pytest class when skipping it?

I have two Pytest classes: one test class is very fast and the other is slower, parametrizing itself with a function call and reusing that resource across multiple tests. My problem is that, when ...
dbrackbill's user avatar

15 30 50 per page
1
2 3 4 5
13