Python Forum
Functions to get all latitudes given a list of listing_ids
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Functions to get all latitudes given a list of listing_ids
#1
Hi all! Would really appreciate some help here. This is part of my homework (and I am still super new to Python so I need some help). So I have a set of data, and I'm supposed to get all altitudes given a list of listing. Here's my code so far but I have no idea what I'm doing wrong so would appreciate some help!

I was given the following hints and I did my code shown after that.
Hint

Create a results list
Extract the latitude and listing id of each row
Check listing id exists within the all listings
If true, append the latitude into the results list
Return results list

Input: airbnb_data as data, a list of listing_ids

Return: A list of latitudes

def get_all_latitude(airbnb_data):
    results = []
    for row in range(airbnb_data):
        listing_id = row[1]
        latitude = row[17]
        if listing_id in airbnb_data:
            results.append(row)
    return results
Reply


Messages In This Thread
Functions to get all latitudes given a list of listing_ids - by Rae - Jun-14-2019, 11:50 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Functions returns content of dictionary as sorted list kyletremblay15 1 2,044 Nov-21-2019, 10:06 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020