Skip to content

Commit e1717f6

Browse files
authored
Update II. Manipulating data.py
1 parent 897b267 commit e1717f6

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Introduction to PySpark/II. Manipulating data.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,16 @@
3939
#|
4040
#|
4141
### Filtering Data
42+
# Filter flights by passing a string
43+
long_flights1 = flights.filter("distance > 1000") # sql string
44+
45+
# Filter flights by passing a column of boolean values
46+
long_flights2 = flights.filter(flights.distance > 1000)
47+
48+
# Print the data to check they're equal
49+
long_flights1.show()
50+
long_flights2.show()
51+
#- same result
52+
#|
53+
#|
54+
### Selecting

0 commit comments

Comments
 (0)