-1

I'm really stuck.

So in this exercise in Kaggle we're looking at a dataset of chicago taxi trips and we want to look at a particular table. The first step is to find the relevant table we'd like to investigate, so the learner is prompted to try and list the tables I presume to find it, but I just can't seem to list them for some reason.

Here is the initial setup code provided for the learner:

1

Here is my first attempt at viewing the tables in the dataset to find the relevant table name

2

Here is my second attempt

Please help me figure what I'm supposed to do here so I can finish the course.

Bill the Lizard
  • 398,270
  • 210
  • 566
  • 880

1 Answers1

1

In earlier tutorials in the course they show you how to list the tables for a given dataset. After the initial setup cell, you should have this cell to import bigquery and load the Chicago taxi trips dataset:

from google.cloud import bigquery

# Create a "Client" object
client = bigquery.Client()

# Construct a reference to the "chicago_taxi_trips" dataset
dataset_ref = client.dataset("chicago_taxi_trips", project="bigquery-public-data")

# API request - fetch the dataset
dataset = client.get_dataset(dataset_ref)

You can print all of the tables included in the dataset in a loop.

# Find the table name
tables = list(client.list_tables(dataset))
for table in tables:
    print(table.table_id)

In this case, there's only one table, so that's the value you put in the next cell to answer the exercise.

# Write the table name as a string below
table_name = _____  # replace the blank with the table name from above.

# Check your answer
q_1.check()

For future reference, there is a forum set aside on Kaggle for each of the Kaggle Learn Courses where you can ask questions about the tutorials and exercises. I often see feedback there from the course instructors themselves, as well as other Kaggle employees and community members.

Bill the Lizard
  • 398,270
  • 210
  • 566
  • 880
  • Yes I did post there over 2 weeks ago but nobody replied to me :(. Thanks! – Stifmeister106 Aug 17 '21 at 11:40
  • 1
    @Stifmeister106 Ok, just making sure you knew about it. The forums there aren't nearly as active as here, but the people there are more focused on ML and data science, and more likely to know the Kaggle Learn exercises. It's good to try there first, but as you found out, sometimes you don't get an answer at all. – Bill the Lizard Aug 17 '21 at 11:53