Calling on a class
Question: I'm using geopy and have a question on why an error is coming up.

This code sample is from the one provided at
[github](https://github.com/geopy/geopy#geocoding). It works as mentioned

    
    
    from geopy.geocoders import Nominatim
    
    geolocator = Nominatim()
    
    location = geo.geocode("NY")
    
    print((location.latitude, location.longitude))
    

How come the code below provides an error? What's the reason behind it?

    
    
    from geopy.geocoders import Nominatim as geo
    
    location = geo.geocode("NY")
    
    print((location.latitude, location.longitude))
    

The error provided by the second code is:

    
    
    Traceback (most recent call last):
      File "C:/Users/Leb/Desktop/Python/so2.py", line 5, in <module>
        location = geo.geocode("NY")
    TypeError: geocode() missing 1 required positional argument: 'query'
    


Answer: You need to instantiate class (create object)

    
    
    from geopy.geocoders import Nominatim as geo
    
    location = geo().geocode("NY")
    
    print((location.latitude, location.longitude))
    

