Data Engineering Zoomcamp 2025

Homework 6: Streaming Statistics

Distribution of scores and reported study time for this homework.

Submissions

228

Median total score

6

Average total score

7

Score distribution

All values are points.

Questions score

Min
6
Median
6.0
Max
6
Q1
6.0
Avg
6.0
Q3
6.0

Learning in public score

Min
-
Median
0.0
Max
7
Q1
0.0
Avg
0.8
Q3
0.0

Total score

Min
6
Median
6.0
Max
14
Q1
6.0
Avg
6.9
Q3
6.0

Time distribution

All values are hours reported by students.

Lectures

Min
1.5
Median
5.0
Max
48.0
Q1
3.0
Avg
8.0
Q3
10.0

Homework

Min
1.0
Median
6.0
Max
30000000000000.0
Q1
3.0
Avg
394736842113.0
Q3
10.0

Question breakdown

Correctness and answer distribution per question.

1. Version of Red Panda

228 / 228 correct (100.0%)

Answer Count
v24.2.18 87
rpk version v24.2.18 (rev f9a22d4430) 44
24.2.18 22
Version: v24.2.18 Git ref: f9a22d4430 Build date: 2025-02-14T12:52:55Z OS/Arch: linux/amd64 Go version: go1.23.1 Redpanda Cluster node-1 v24.2.18 - f9a22d443087b824803638623d6b7492ec8221f9 10
v24.2.18 (rev f9a22d4430) 10
rpk version v24.2.18 6
Version: v24.2.18 6
Version: v24.2.18 Git ref: f9a22d4430 Build date: 2025-02-14T12:59:41Z OS/Arch: linux/arm64 Go version: go1.23.1 Redpanda Cluster node-1 v24.2.18 - f9a22d443087b824803638623d6b7492ec8221f9 4
v24.2.18 - f9a22d443087b824803638623d6b7492ec8221f9 3
24.3.7 2
v22.3.5 1
rpk --version; rpk version v24.2.18 (rev f9a22d4430) 1
$ rpk version Version: v24.2.18 Git ref: f9a22d4430 Build date: 2025-02-14T12:59:41Z OS/Arch: linux/arm64 Go version: go1.23.1 Redpanda Cluster node-1 v24.2.18 - f9a22d443087b824803638623d6b7492ec8221f9 1
Version: v24.2.18 Git ref: f9a22d4430 Build date: 2025-02-14T12:52:55Z OS/Arch: linux/amd64 Go version: go1.23.1 1
node-1 v24.2.18 - f9a22d443087b824803638623d6b7492ec8221f9 1
Redpanda Cluster node-0 v24.3.7 - 58938b05ee4c3016e917c0b008e2126c941be111 1
v23.3.1 (rev 9b3fd92) 1
v22.3.1 (commit abc123) 1
Version: v24.2.18 Git ref: f9a22d4430 Build date: 2025-02-14T12:52:55Z OS/Arch: linux/amd64 Go version: go1.23.1 1
$ rpk version Version: v24.2.18 Git ref: f9a22d4430 Build date: 2025-02-14T12:52:55Z OS/Arch: linux/amd64 Go version: go1.23.1 Redpanda Cluster node-1 v24.2.18 - f9a22d443087b824803638623d6b7492ec8221f9 1
v22.1.1 1
Redpanda version: v23.2.2 (rev c7fbb9f2) 1
Version: v24.2.18 Git ref: f9a22d4430 Build date: 2025-02-14T12:52:55Z OS/Arch: linux/amd64 Go version: go1.23.1 Redpanda Cluster node-1 v24.2.18 - f9a22d443087b824803638623d6b7492ec8221f9 1
Redpanda Cluster node-1 v24.2.18 - f9a22d443087b824803638623d6b7492ec8221f9 1
v24.3.7 1
redpanda@31a8a4db22b3:/$ rpk version Version: v24.2.18 Git ref: f9a22d4430 Build date: 2025-02-14T12:52:55Z OS/Arch: linux/amd64 Go version: go1.23.1 Redpanda Cluster node-1 v24.2.18 - f9a22d443087b824803638623d6b7492ec8221f9 1
Version: v24.2.18 Git ref: f9a22d4430 Build date: 2025-02-14T12:59:41Z 1
Redpanda version: v23.3.10 1
23.2.2 1
v22.3.21 (rev 13c8ffe) 1
v24.2.18(rev f9a22d4430) 1
21.11.8 1
time="2025-03-10T23:14:12+03:00" level=warning msg="C:\\Users\\User\\Desktop\\de-hw\\pyflink\\docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion" Version: v24.2.18 Git ref: f9a22d4430 Build date: 2025-02-14T12:52:55Z OS/Arch: linux/amd64 Go version: go1.23.1 Redpanda Cluster node-1 v24.2.18 - f9a22d443087b824803638623d6b7492ec8221f9 1
v22.3.5 (rev 28b2443) 1
V24.2.18 1
Version: v24.2.18 Git ref: f9a22d4430 Build date: 2025-02-14T12:59:41Z OS/Arch: linux/arm64 Go version: go1.23.1 1
v21.10.2 1
pk version Version: v24.2.18 Git ref: f9a22d4430 Build date: 2025-02-14T12:52:55Z OS/Arch: linux/amd64 Go version: go1.23.1 Redpanda Cluster node-1 v24.2.18 - f9a22d443087b824803638623d6b7492ec8221f9 1

2. Creating a topic

228 / 228 correct (100.0%)

Answer Count
TOPIC STATUS green-trips OK 105
green-trips OK 16
TOPIC STATUS green-trips OK 9
rpk topic create green-trips 6
Status OK 3
TOPIC STATUS green-trips OK 2
$ rpk topic create green-trips TOPIC STATUS green-trips OK 2
TOPIC STATUS green-trips OK 2
TOPIC STATUS green-taxi OK 2
redpanda@123fe502e80a:/$ rpk topic create green-trips TOPIC STATUS green-trips OK 2
TOPIC STATUS green-trips OK 2
TOPIC STATUS test-topic OK 2
Created topic 'test-topic' successfully 1
done 1
green-trips 1 1 1
TOPIC: green-trips; STATUS: OK 1
TOPIC - green-trips; STATUS - OK 1
rpk topic create green_trips; TOPIC STATUS green_trips OK 1
producer.send('green-trips', value=row) 1
* NAME PARTITIONS REPLICAS * green-trips 1 1 1
docker exec -it redpanda-1 rpk topic create green-trips 1
redpanda@af7f92881943:/$ rpk topic create green-trips TOPIC STATUS green-trips OK 1
TOPIC green-trips; STATUS OK 1
redpanda@31a8a4db22b3:/$ rpk topic create green-trips TOPIC STATUS green-trips OK 1
redpanda@74fea1b3257f:/$ rpk topic create green-topic 1
docker exec redpanda-1 rpk topic create greenTaxi-10-2019-topic 1
docker compose exec redpanda-1 rpk topic create green-trips 1
time="2025-03-15T10:07:45Z" level=warning msg="D:\\datacamp\\data-engineering-zoomcamp-main\\data-engineering-zoomcamp-main\\flink-training-main\\flink-training-main\\docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion" TOPIC STATUS green-trips OK 1
redpanda@0432a10de985:/$ rpk topic create green-trips TOPIC STATUS green-trips OK 1
TOPIC green-trips CREATED 1
TOPIC STATUS green-trips Created 1
TOPIC STATUS green_trips OK 1
TOPIC green-trips STATUS OK 1
TOPIC STATUS green-trips CREATED 1
redpanda@66d11f40366b:/$ rpk topic create green-trips TOPIC STATUS green-trips OK 1
TOPIC STATUS green-trips TOPIC_ALREADY_EXISTS: The topic has already been created 1
OK 1
TOPIC STATUS \ green-trips OK 1
redpanda@7b9c470eef41:/$ rpk topic create green-trips TOPIC STATUS green-trips OK 1
TOPIC STATUS green-trips OK 1
TOPIC: green-trips STATUS: OK 1
topic status green-trips OK 1
TOPIC STATUS green_trips OK What's next: Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug redpanda-1 Learn more at https://docs.docker.com/go/debug-cli/ 1
redpanda@3c976472f32a:/$ rpk topic create green-trips TOPIC STATUS green-trips OK redpanda@3c976472f32a:/$ 1
TOPIC green-trips STATUS OK 1
TOPIC STATUS green-trips OK 1
TOPIC STATUS green-trips OK 1
TOPIC green-trips STATUS OK 1
docker exec redpanda-1 rpk topic create green-trips TOPIC STATUS green-trips OK 1
The topic green-trips was created successfully. 1
docker exec -it redpanda-1 rpk topic create green-trips TOPIC STATUS green-trips OK 1
green-trips 1
TOPIC STATUS test_1 OK 1
yes 1
Created topic 'green-trips'. 1
green-trips, status ok 1
PS C:\Users\karee> docker exec -it redpanda-1 rpk topic create green-trips TOPIC STATUS green-trips OK 1
green_trips 1
TOPIC STATUS / green-trips OK 1
!docker exec -it redpanda-1 rpk topic create green-trips 1
Created topic 'green-trips' 1
TOPIC STATUS okay OK 1
time="2025-03-10T22:16:50+03:00" level=warning msg="C:\\Users\\User\\Desktop\\de-hw\\pyflink\\docker-compose.yml: the attribute version is obsolete, it will be ignored, please remove it to avoid potential confusion" TOPIC STATUS green-trips OK 1
TOPIC STATUS green-trips OK 1
TOPIC STATUS green-trips OK 1
docker exec -it redpanda-1 rpk topic create green-trips TOPIC STATUS green-trips OK 1
TOPIC|STATUS \n green-trips|OK 1
TOPIC STATUS green-trips OK 1
docker exec redpanda-1 rpk topic create green-trips 1
TOPIC STATUS green-trips OK 1
TOPIC STATUS green_trips OK 1
TOPIC STATUS greenTaxi-10-2019-topic OK 1
rpk topic create green-trips TOPIC STATUS green-trips OK 1
Created topic green-trips 1
TOPIC: greenTaxi-10-2019-topic, STATUS: OK 1
TOPIC STATUS green-trips OK What's next: Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug 129c9e61745c Learn more at https://docs.docker.com/go/debug-cli/ 1
docker compose exec redpanda-1 rpk topic create green-trips --partitions 3 --replicas 1 1
docker-compose exec redpanda-1 rpk topic create green-trips TOPIC green-trips STATUS OK 1
TOPIC green-trips STATUS OK 1
TOPIC STATUS\green-trips OK 1

3. Connecting to the Kafka server

228 / 228 correct (100.0%)

Answer Count
True 199
done 1
producer.bootstrap_connected() returns True 1
The output of tle last command is True 1
Spark and Java environment variables exported. 1
it will connect to kafka and print noithing 1
kafka_connection.ipynb 1
TRUE 1
The output is "True" 1
pip install kafka-python from kafka import KafkaProducer server = 'localhost:9092' producer = KafkaProducer(bootstrap_servers=[server]) print(producer.bootstrap_connected()) 1
Connected to Kafka server! 1
import json from kafka import KafkaProducer def json_serializer(data): return json.dumps(data).encode('utf-8') server = 'localhost:9092' producer = KafkaProducer( bootstrap_servers=[server], value_serializer=json_serializer ) producer.bootstrap_connected() True 1
producer.bootstrap_connected() 1
yes 1
Connection result: True 1
import json from kafka import KafkaProducer def json_serializer(data): return json.dumps(data).encode('utf-8') server = 'localhost:9092' producer = KafkaProducer( bootstrap_servers=[server], value_serializer=json_serializer ) print(producer.bootstrap_connected()) True 1
localhost:9092 1
took 50.05 seconds 1
True, if you use print(producer.bootstrap_connected()) 1
true 1
```bash True ``` 1
Producer connected: True 1

4. Time to send the Trip data

228 / 228 correct (100.0%)

Answer Count
It took 62.78 seconds to send the entire dataset and flush 2
27 2
Sent 476386 messages in 68.43 seconds. 2
82.79738593101501 2
Sent 476386 messages. Time taken: 101.46 seconds 2
26.44 1
115.72 seconds 1
~15.8 seconds 1
36.16264081001282 1
51.34 1
45.66 seconds 1
40.95s 1
17.557073831558228 1
31.2 seconds 1
39.05 1
950.9719321727753 seconds 1
562.27 (approximately 9 minutes) 1
478.3734929561615 1
1.199784278869629 1
46.41 1
33.34 seconds 1
23 1
62.06 seconds 1
1771s 1
took 70.47 seconds 1
52.51 seconds 1
94 seconds 1
21.81 seconds 1
Time taken: 36.93 seconds 1
0.54 seconds, Both took approximately the same amount of time 1
Output: 84.33631014823914 1
48.47 seconds 1
70 1
320 1
73.89 1
It takes 32.49498391151428 seconds to send the entire dataset and flush 1
22.0463650226593 1
Total time taken: 51.73 seconds 1
128.09 1
34.51 1
Took 76.68 seconds to send 476386 messages 1
77.78 seconds 1
42.42489814758301 1
40 1
66.08s 1
101.90 Seconds 1
237.18239450454712 1
17.37230110168457 seconds (M3 Mac) 1
22.28 seconds 1
Time taken to send all messages and flush: 67.15 seconds Question 5: Build a Sessionization Window 1
366.76 1
27.4289 1
33.7 seconds 1
Time taken to send and flush data: 41.76 seconds 1
164.44 1
79.71121907234192 1
took 50.01 seconds 1
took 98.06 seconds 1
34.57912492752075 1
0.0030012130737304688 1
45.07 seconds 1
49.22 seconds 1
42 1
22 1
47.16 seconds 1
35.15s 1
about 85 seconds 1
36.71 seconds 1
Total time to send and flush the dataset: 71.18 seconds 1
52.54 1
57.95 seconds 1
Sent 476386 messages. Time taken: 101 seconds 1
79.46 seconds 1
84.16 1
52.33 1
Time taken to send dataset: 214.62 seconds 1
29,535.93 seconds 1
23.47s 1
136.4128942489624 1
Took 24.18 seconds to send data and flush 1
~238.19 seconds (~4 minutes) 1
15.8 seconds 1
120.12 seconds 1
139.7020947933197 1
42.85 seconds 1
96.71 seconds 1
Tiempo total: 12.345 segundos 1
53.65874791145325 1
Time taken : 101.46 seconds 1
18.409027814865112 1
1010 1
Time taken: 154.36993169784546 seconds 1
36.80 seconds 1
36.1 s 1
33.35 seconds 1
24.77s 1
Total time taken: 160.17 seconds 1
1791.1940927505493 (seconds) 1
21.99 seconds 1
30.67 seconds 1
47.51 1
25.822190046310425 1
92.98 seconds 1
11.86 seconds 1
101.46 1
83.65 seconds 1
13.678 1
51.368 1
31.11 seconds 1
111.50013470649719 seconds 1
Sent all messages in 30.82 seconds 1
101.9 1
Took 30.75 seconds to send and flush the entire dataset. 1
54.81 seconds 1
698.33 seconds 1
Took 74.5 seconds 1
124.35 1
15.678 1
42.05 seconds 1
46.74533987045288 1
39.53789710998535 1
142.47897291183472 seconds 1
Took 152.06 seconds 1
65 seconds 1
44.40 1
399.16 seconds 1
22.28430938720703 1
35.17482042312622 1
42.25 sec 1
79.85 seconds 1
277.59 seconds 1
Total time taken: 68.96 seconds 1
Finished sending 476386 messages. Took 55.01 seconds 1
24.48 seconds 1
yes 1
92.22276258468628 1
50.1757025718689 1
19.84 seconds 1
Execution completed in 58.01 seconds. 1
21.18958044052124 1
239.42 seconds 1
53.96 1
39.05 seconds 1
36.465951442718506 seconds 1
72.55 seconds 1
34.57 seconds 1
66.19 seconds 1
Time taken 91.34 seconds 1
236.33 seconds 1
61 seconds 1
12.34 1
93.45 1
took 28.76 seconds 1
took 105.29 seconds 1
224 seconds 1
36.06628751754761 1
69 1
56.23364019393921 1
31.84 seconds. 1
15.22 seconds 1
56.02 seconds 1
39.281256 1
took 75.06 seconds 1
time taken : 59.39699578285217 1
118.29s 1
20.35 1
56.00370764732361 1
53.9525146484375 1
37.75 1
took 19.14 seconds 1
took = 52.997456312179565 1
38.96453237533569 1
51.75 sec 1
101.46 seconds 1
33.14477205276489 1
75.43 seconds 1
63.42 sec 1
58.62 1
40.07 seconds 1
98.53475165367126 1
25.5 sec 1
21.97557783126831 1
25.5 s 1
0.56 seconds 1
21.71297574043274 1
102.36246490478516 1
0.9398140907287598 1
took 20.16 seconds 1
24 1
90.65492963790894 1
20.66 1
71.52 seconds 1
152.06 1
74.69355630874634 1
64.26 1
28.096701860427856 1
took 85.90 seconds 1
73.45 seconds 1
Data sent successfully in 51.30 seconds. 1
31.95323085784912 1
Time taken to send the entire dataset and flush: 30.25 seconds 1
81.63 1
70 seconds 1
53 seconds. 1
[SUCCESS] All data successfully sent to Kafka topic 'green-trips' in 92 seconds. 1
573 1
19.76529288291931 1
21s 1

5. The longest unbroken streak of taxi trips

228 / 228 correct (100.0%)

Answer Count
44 6
- 4
East Harlem South to East New York with a streak of 19 consecutive trips. 3
East Harlem South to East New York 2
44 Trip Counts (PULocationID: 95, DOLocationID: 95) 2
pickup location ID = 7 and drop off location ID = 264 has 9 unbroken streak 2
docker compose exec jobmanager ./bin/flink run -py /opt/src/job/session_job.py --pyFiles /opt/src/job -d 2
NA 2
LocationIDs are 74 and 75 (Manhattan East Harlem North & South) 2
{'PULocationID': 82, 'DOLocationID': 138, 'streak_length': 129} 1
PULocationID: 161, DOLocationID: 141 1
22 1
Forest Hills(95) to Forest Hills(95): 44 trips 1
Pickup: 74, Dropoff: 75 1
PULocationID = 75, DOLocationID = 74 1
7 7 1
Pickup ID 7 -> DropOff ID -> 7 1
9 1
95, 95 1
the longest streak is for pu location 74 and do location 75, lasting 01:10:32 1
PULocationID=95, DOLocationID=95, streak=44 1
The pickup and drop off location 'Forest Hills'(locationid=95) have the longest unbroken streak of taxi trips. +--------------+--------------+---------------------+---------------------+----------+ | pulocationid | dolocationid | session_start | session_end | num_hits | |--------------+--------------+---------------------+---------------------+----------| | 95 | 95 | 2019-10-16 18:18:42 | 2019-10-16 19:21:16 | 44 | 1
PU, DO : Bensonhurst West 1
1 1
LocationID of 95 (borough = "Queens", zone = "Forest Hills") with 44 unbroken streak of taxi trips 1
74 & 151 1
Elmhurst LaGuardia Airport 1
The longest streak is 44, with the pickup location ID and dropoff location ID both being 95 1
pulocationid = 82 and dolocationid = 138 1
82,138 1
East Harlem South, East Harlem North 1
Location ID 193 (Queens : Queensbridge/Ravenswood : Boro Zone) has the longest both To & From i.e., 193 to 193 1
pulocationid:82 and dolocationid:138 1
PULocationId = 82; DOLocationId = 138; Longest_Trip_Distance = 124.88 1
142 (East Harlem South to East Harlem North - longest unbroken streak 142) 1
Pick up loc - 22 (Brooklyn, Bensonhurst West); drop off loc - 22 --> 6 trips; Pick up loc - 129 (Queens, Jackson Heights) drop off loc - 129 --> 6 trips 1
75,74 1
i couldnt do it 1
Pick-up: East Harlem North Drop-off: East Harlem South 1
93 1
From PULocationID: 95 "Forest Hills" To DOLocationID: 95 "Forest Hills", The Streak is 44 trips 1
Pickup Location: 75, East Harlem South Dropoff Location: 74, East Harlem North 1
https://github.com/Mohamedelrokh/week6_stream 1
Pickup location ID=95, Dropoff location ID=95 1
PULocationID: 82 to DOLocationID: 138 with a streak of 23 trips. 1
74,75 1
90 kms 1
I failed 1
PULocationID: 75 / DOLocationID: 74 / Streak length: 3,490 trips 1
PULocationID: 237, DOLocationID: 161, trip_streak: 128 1
pickup location 74 and dropoff location 75 had the longest unbroken streak of taxi trips. This streak lasted for 70.53 minutes (from 2019-10-21 08:48:10 to 2019-10-21 09:58:42) and included 31 trips. 1
11 1
East Harlem South to East New York : 19 consecutive trips 1
PULocationID: 22, PULocationID: 22, longest_streak: 8 1
Pickup Location: 75, Dropoff Location: 74 1
Pickup Location ID: 75, Drop-off Location ID: 74, Count: 1,478 trips 1
PULocationID=DOLocationID 95 has 44 unbroken trips 1
from Jackson Heights (LocationID 129) to Woodside (LocationID 260), both in Queens, with a maximum streak of 10 trips within a 5-minute session window. 1
Forest Hills 1
74, 138 1
74, 75 1
Pickup Location ID: 75, Drop-off Location ID: 74 1
East Harlem South to East New York with a streak of 19 consecutive trips 1
\ 1
from pyflink.datastream import StreamExecutionEnvironment from pyflink.table import EnvironmentSettings, DataTypes, TableEnvironment, StreamTableEnvironment from pyflink.common.watermark_strategy import WatermarkStrategy from pyflink.common.time import Duration def create_taxi_trips_sink(t_env): table_name = 'taxi_trips_streaks' sink_ddl = f""" CREATE TABLE {table_name} ( PULocationID INT, DOLocationID INT, streak_length BIGINT, streak_start_time TIMESTAMP(3), streak_end_time TIMESTAMP(3), PRIMARY KEY (PULocationID, DOLocationID) NOT ENFORCED ) WITH ( 'connector' = 'jdbc', 'url' = 'jdbc:postgresql://postgres:5432/postgres', 'table-name' = '{table_name}', 'username' = 'postgres', 'password' = 'postgres', 'driver' = 'org.postgresql.Driver' ); """ t_env.execute_sql(sink_ddl) return table_name def create_green_trips_source_kafka(t_env): table_name = "green_trips" source_ddl = f""" CREATE TABLE {table_name} ( lpep_pickup_datetime TIMESTAMP(3), lpep_dropoff_datetime TIMESTAMP(3), PULocationID INT, DOLocationID INT, passenger_count INT, trip_distance DOUBLE, tip_amount DOUBLE, event_watermark AS lpep_dropoff_datetime, WATERMARK FOR event_watermark AS event_watermark - INTERVAL '5' SECOND ) WITH ( 'connector' = 'kafka', 'properties.bootstrap.servers' = 'redpanda-1:29092', 'topic' = 'green-trips', 'scan.startup.mode' = 'earliest-offset', 'properties.auto.offset.reset' = 'earliest', 'format' = 'json' ); """ t_env.execute_sql(source_ddl) return table_name def analyze_taxi_trips(): # Set up the execution environment env = StreamExecutionEnvironment.get_execution_environment() env.enable_checkpointing(10 * 1000) env.set_parallelism(3) # Set up the table environment settings = EnvironmentSettings.new_instance().in_streaming_mode().build() t_env = StreamTableEnvironment.create(env, environment_settings=settings) try: # Create tables source_table = create_green_trips_source_kafka(t_env) sink_table = create_taxi_trips_sink(t_env) # Create a view for session window analysis t_env.execute_sql(f""" CREATE VIEW session_trips AS SELECT PULocationID, DOLocationID, SESSION_START(event_watermark, INTERVAL '5' MINUTES) AS session_start, SESSION_END(event_watermark, INTERVAL '5' MINUTES) AS session_end, COUNT(*) AS trip_count FROM {source_table} GROUP BY PULocationID, DOLocationID, SESSION(event_watermark, INTERVAL '5' MINUTES) """) # Find the longest unbroken streak for each pickup and dropoff location pair t_env.execute_sql(f""" CREATE VIEW location_streaks AS SELECT PULocationID, DOLocationID, COUNT(*) AS streak_length, MIN(session_start) AS streak_start_time, MAX(session_end) AS streak_end_time FROM session_trips GROUP BY PULocationID, DOLocationID """) # Insert results into the sink table t_env.execute_sql(f""" INSERT INTO {sink_table} SELECT PULocationID, DOLocationID, streak_length, streak_start_time, streak_end_time FROM ( SELECT PULocationID, DOLocationID, streak_length, streak_start_time, streak_end_time, ROW_NUMBER() OVER (ORDER BY streak_length DESC) AS row_num FROM location_streaks ) WHERE row_num = 1 """).wait() except Exception as e: print("Analyzing taxi trips failed:", str(e)) if __name__ == '__main__': analyze_taxi_trips() 1
https://github.com/MakGulati/zoomcamp-practice-DE/blob/main/module06/homework.md 1
pickup location 95 and drop off location 95 1
74 and 75 1
((74, 234), 12) 1
The pickup and drop off locations have the longest unbroken streak of taxi trips: lpep_pickup_datetime: 2019-10-31 23:23:41 pep_dropoff_datetime: 2019-11-01 13:01:07 pulocationid: 129 dolocationid: 265 trip_distance: 515.90 1
74(Manhattan-East Harlem North) 75(Manhattan-East Harlem South) 9 taxi trips 1
Longest unbroken streak: (34, 77, 159) 1
74 and 75 (Manhattan East Harlem North & South) 1
5742 1
PULocationID - 74, DOLocationID - 75, longest_streak_duration - 01:10:32 1
129-129 1
34 1
Pickup location 95 (Forest Hills, Queens) | Drop off location 95 (Forest Hills, Queens) - With the longest unbroken streak of 44 trips. 1
yes 1
locations 74 (East Harlem North) and 75 (East Harlem South) 1
95, Location 95 (Forest Hills, Queens) pickup and drop-off locations with the longest unbroken streak of taxi trips 1
PULocationID: 95 "Forest Hills" to DOLocationID: 95 "Forest Hills" 1
"pulocationid":74, "dolocationid":75 1
pulocationid = 75, dolocationid=74 1
PULocationID: 162 DOLocationID: 233 1
74 (East Harlem North) pickup to 75 (East Harlem South) dropoff 1
The route from PULocationID 132 to DOLocationID 148 had the longest unbroken streak of 56 trips in October 2019. 1
pulocationid 74 dolocationid 75 trips_count 7 1
PULocationID: 132, DOLocationID: 265 1
The result was: "pulocationid"/"dolocationid" = 95 with "longest_streak" = 44 1
"East Harlem South" to "East Harlem North" with 5683 1
19 consecutive trips - East Harlem South to East New York 1
4 1
58.91 seconds 1
PULocationID : 95, DOLocationID : 95, Streak:44 1
pulocationid: 7, dolocationid: 264, longest_streak: 10 1
74, 74 1
placeholder 1
pulocationid=223 | dolocationid=223 | streak_length=102 1
147 1
Bronx, Unknown 1
63 1
95 1
pu_location_id = 75 and do_location_id = 74 with streak count as 48. 75 location id is Manhatten borough and East Harlem South zone. 74 location id is Manhatten borough and East Harlem North zone. 1
PULocationID 75 and DOLocationID 74 has the longest unbroken streak of taxi trips of 25 1
48 1
Manhattan Beach, Brighton Beach 1
75, 74 East Harlem North, East Harlem South 1
48: East Harlem North and East Harlem South 1
PickupLocationID: 1, DropoffLocationID: 2, Number of Trips: 50 PickupLocationID: 3, DropoffLocationID: 4, Number of Trips: 48 ... 1
pulocationid: 74, dolocationid: 75 1
The pair of pickup location 95 and drop-off location 95 has the longest unbroken streak of taxi trips, totaling 44. 1
95 "Forest Hills" to DOLocationID: 95 "Forest Hills" with a streak of 44 trips 1
44 (window_start: 2019-10-16 18:18:42.00, window_end; 2019-10-16 19:26:16.000, PULocationID: 95, DOLocationID:95) 1

Calculated: 25 March 2025, 13:56