Minimum value (inclusive). Default is None (no minimum).
max_val:float | None=None
Maximum value (inclusive). Default is None (no maximum).
allowed:list[float] | None=None
List of allowed values (categorical constraint). When provided, values are sampled from this list.
nullable:bool=False
Whether the column can contain null values. Default is False.
null_probability:float=0.0
Probability of generating null when nullable=True. Default is 0.0.
unique:bool=False
Whether all values must be unique. Default is False.
generator:Callable[[], Any] | None=None
Custom callable that generates values. Overrides other settings.
dtype:str='Float64'
Float dtype. Default is "Float64". Options: "Float32", "Float64".
Returns
FloatField
A float field specification.
Examples
Define a schema with float fields and generate test data:
import pointblank as pb# Define a schema with float field specificationsschema = pb.Schema( price=pb.float_field(min_val=0.01, max_val=9999.99), probability=pb.float_field(min_val=0.0, max_val=1.0), temperature=pb.float_field(min_val=-40.0, max_val=50.0),)# Generate 100 rows of test datapb.preview(pb.generate_dataset(schema, n=100, seed=23))
PolarsRows100Columns3
price
Float64
probability
Float64
temperature
Float64
1
9248.64401895442
0.9248652516259452
43.23787264633508
2
9486.04880781621
0.9486057779931771
45.37452001938594
3
8924.325591818912
0.8924333440485793
40.31900096437214
4
835.5150972932996
0.08355067683068362
-32.48043908523847
5
5920.270428312815
0.5920272268857353
13.282450419716177
96
4446.926385790886
0.4446925279641446
0.022327516773010814
97
3427.7653590611476
0.3427762214585577
-9.150140068729808
98
8923.280842563525
0.8923288689140904
40.309598202268134
99
8137.5531808932155
0.8137559456012128
33.238035104109144
100
8951.80870117522
0.8951816604808429
40.56634944327587
Values are uniformly distributed across the specified ranges.