136, Data Cleaning Walkthrough

my problem is
*I wrote that code in the slide number 14 and I tried to submit the answer but there is message says “your code does not pass our checks” *
`
import re
def get_long(Location):
coordinates = re.findall("(.+)", Location)
long=coordinates[0].split(",")[1].replace(")","").strip()
return long

data[“hs_directory”][“long”] = data[“hs_directory”][“Location 1”].apply(get_long)
#data[“hs_directory”][“long”].head()

data[“hs_directory”][“lat”]=pd.to_numeric(data[“hs_directory”][“lat”], errors = “coerce”)

data[“hs_directory”][“long”]=pd.to_numeric(data[“hs_directory”][“long”], errors = “coerce”)

print(data[“hs_directory”].head())
`

###the link is
https://app.dataquest.io/m/136/data-cleaning-walkthrough/14/extracting-the-longitude

Not sure if this is the issue, but it might have a problem with the column being named 'long' instead of 'lon' for error-checking.

1 Like