File tree Expand file tree Collapse file tree 1 file changed +2
-8
lines changed
Expand file tree Collapse file tree 1 file changed +2
-8
lines changed Original file line number Diff line number Diff line change @@ -35,16 +35,12 @@ print(f"Total rows in table: {row_count}")
3535Count rows matching specific conditions:
3636
3737``` python
38- from pyiceberg.expressions import GreaterThan, EqualTo, And
39-
4038# Count rows with population > 1,000,000
4139large_cities = table.scan().filter(" population > 1000000" ).count()
4240print (f " Large cities: { large_cities} " )
4341
4442# Count rows with specific country and population criteria
45- filtered_count = table.scan().filter(
46- And(EqualTo(" country" , " Netherlands" ), GreaterThan(" population" , 100000 ))
47- ).count()
43+ filtered_count = table.scan().filter(" country = 'Netherlands' AND population > 100000" ).count()
4844print (f " Dutch cities with population > 100k: { filtered_count} " )
4945```
5046
@@ -62,9 +58,7 @@ limited_count = table.scan().count(limit=10000)
6258print (f " Row count (max 10k): { limited_count} " )
6359
6460# Combine limit with filters for efficient targeted counting
65- recent_orders_sample = table.scan().filter(
66- GreaterThan(" order_date" , " 2023-01-01" )
67- ).count(limit = 5000 )
61+ recent_orders_sample = table.scan().filter(" order_date > '2023-01-01'" ).count(limit = 5000 )
6862print (f " Recent orders (up to 5000): { recent_orders_sample} " )
6963```
7064
You can’t perform that action at this time.
0 commit comments