<jupyter_start><jupyter_text>Example Vignette - ny_artsy_dateThis vignette goes through some of the functionalities and installation instructions for the `ny_artsy_date` functions:  Installation  Make sure you use python 3.9, as this is part of the package dependency.<jupyter_code>#!python3.9 -m pip install -i https://test.pypi.org/pypi/ --extra-index-url https://pypi.org/simple/ ny_artsy_date
import sys
sys.path.append('/usr/local/lib/python3.9/site-packages/')
from ny_artsy_date import ny_artsy_date as nydate<jupyter_output><empty_output><jupyter_text>General Usage The functions within (in particular, `find_my_art_events` and `choose_my_art_date`) only work for locations in the New York Metro area.<jupyter_code>import os
API_KEY = os.getenv('POETRY_GMAPS_TOKEN')<jupyter_output><empty_output><jupyter_text>Each function also includes docstrings, which can be accessed through the use of the `help` function.<jupyter_code>help(nydate.find_my_art_events)<jupyter_output>Help on function find_my_art_events in module ny_artsy_date.ny_artsy_date:

find_my_art_events(my_location=None, google_maps_key=None, lat=None, lon=None, free_only=0, max_results=10, search_range='500m', mapping=False)
    Function to obtain art events data in the NY Metro area near a specified location (address OR latitude and longitude format), 
    using the NY ArtBeat API found at https://www.nyartbeat.com/resources/doc/api. Returns table with events matching a specified radius 
    from a specified location as well as map if requested. 
        
        Args
        ----
        Required: 
            my_location(str): Address starting point - Must be within NYC Metro Location
                Default: None
            google_maps_key (str): Google maps API key needed to geocode your location 
                To obtain a google maps API key, please refer to https://developers.google.com/maps
                Default: None, OR 
            lat(float): Latitude of starting point - Mu[...]<jupyter_text>Functions  This section includes a description, discusssion of input variables, and use case examples. **Unless specified otherwise, please follow the syntax within and make sure you are defining the parameters you are inputting** (e.g., `my_location = XYZ`)  The main functions used are `find_my_art_events`, `find_my_dinner`, and `choose_my_art_date`.   General Parameters The following are the default parameters that are needed for all three functions, as the package functions are primarily based on **location** and closeness.  * **my_location**: String data for the address of your starting point * **google_maps_key**: You will need to have a valid [google maps token](https://developers.google.com/maps) to access the full range of these functions, as this key allows us to:     * geocode our data (if you are using locational data)    * perform reverse geocoding functions      * return nearby restaurants with Google Places    * map the returned points for events * **lon** and **lat** data of your starting point (can sometimes be used in lieu of **my_location**)   `find_my_art_events` `find_my_art_events` finds art events within a radius of a starting location using [NY Art Beats API](https://www.nyartbeat.com/resources/doc/api). In order to run this function, you need **either** **my_location** (and **google_maps_key**) or **lat** and **lon**. Because you can choose one or the other (or both), these arguments have no default are not required parameters. **However, failure to input eiether of these parameters will prevent this function from working.**  Below are one basic use case with **my_location** and another with **lat and long**:<jupyter_code>df = nydate.find_my_art_events(my_location = 'Wall Street', google_maps_key = API_KEY)
df.head()
df = nydate.find_my_art_events(lat = 40.7425, lon = -74.0060)
df.head()<jupyter_output><empty_output><jupyter_text>You can also refine your search, filtering for **free_only**, **search_range**, or **max_results**.* **free_only**: Boolean logic specifying whether the user wants only to look at free events (incl. events with suggested donations). * **search_range**: Specifies how far from your starting point in meters (can be "500m","1000m","1500m","3000m", default at 500m). * **max_results**: Specifies maximum number of output you would want returned (can be 5,10,20,50, with default at 10).  For example, in the case of chelsea market, the default (with the location and key) is as shown below:<jupyter_code>df = nydate.find_my_art_events(my_location = 'Chelsea Market', google_maps_key = API_KEY)
df.tail()<jupyter_output><empty_output><jupyter_text>As we can see from the **Event_Price_Adult** and **Event_Price_Detailed** columns, specifying `free_only` as True or as 1 will filter out results that are not free.<jupyter_code>df = nydate.find_my_art_events(my_location = 'Chelsea Market', google_maps_key = API_KEY, free_only = 1)
df<jupyter_output><empty_output><jupyter_text>Meanwhile, we can see that the max number of results is actually much closer than 20 than 10 with the default radius and address - when setting the max results to 50, we can see far more rows iin the df.<jupyter_code>df = nydate.find_my_art_events(my_location = 'Chelsea Market', google_maps_key = API_KEY, max_results = 50)
df.tail()<jupyter_output><empty_output><jupyter_text>The number of observations often also increases as we increase the radius or the `search_range` parameter.<jupyter_code>df = nydate.find_my_art_events(my_location = 'Chelsea Market', google_maps_key = API_KEY, search_range = 1000, max_results=50)
df.tail()<jupyter_output><empty_output><jupyter_text>`find_my_dinner` This function can be used alone *or* in tandem with `find_my_art_events`. By inputting a starting point (either your home, a meeting place, or the art event the user went to earlier in the day), the user can return a data table with relevant information about dinner places within a specified search radius from [Google Places (Google Maps API)](https://developers.google.com/maps/documentation/places/web-service/overview)<jupyter_code>df = nydate.find_my_dinner(my_location = 'Met Museum', google_maps_key = API_KEY)
df.tail()<jupyter_output><empty_output><jupyter_text>This function is similar to the previous one in that one can filter for the search radius (also called the **search_range**); this search_range (if used alone) is less restrictive due to the scope of Google Places. However, one can also filter for the minimum rating of the restaurant (**min_rating**), which is on a five-star scale. The default **min_rating** is 4.3.<jupyter_code>df = nydate.find_my_dinner(my_location = 'Met Museum', google_maps_key = API_KEY, min_rating = 4.6)
df.tail()<jupyter_output><empty_output><jupyter_text>`choose_my_art_date` This function randomly chooses an 'artsy date' event-restaurant combo based on the user's starting point. The assumption of this function is that one will go to dinner *after* the date, and uses the event location to then reccomend a nearby restaurant.  To this point, the input parameters include **lat** and **lng** or **my_location**. Similar to the earlier functions, the user can also input **search_range** and **min_rating**. (Once more, **google_maps_key** is necessary).<jupyter_code>df = nydate.choose_my_art_date(my_location = 'H<NAME>', google_maps_key = API_KEY)
df<jupyter_output><empty_output><jupyter_text>As we can see, this function returns as a long table with all the information you may be interested in;  most of the fields returned are delineated by Event details and Restaurant details.  `mapping` parameter Within all three functions, one can toggle the **mapping** parameter. This parameter is input as a boolean response (True/False or 0/1) and returns an interactive google map[1](fn1) with places of interest. See below for a couple of use cases of mapping.<jupyter_code>df,maps = nydate.find_my_art_events(my_location = 'Met Museum', \
                                google_maps_key = API_KEY, mapping = 1)
maps
df,maps = nydate.choose_my_art_date(my_location = 'Chelsea Market', \
                                google_maps_key = API_KEY, search_range = 1000,mapping = 1)
maps<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08614186640710549, 'fraction_numerical': 0.009855213529626474, 'mean_word_length': 5.093402520385471, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 49, 'https://': 7, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '12', 'dir': 'jupyter-structured-clean-dedup', 'id': '343025', 'license': 'MIT', 'n_tokens_mistral': 2452, 'n_tokens_neox': 2342, 'n_words': 921, 'path': 'docs/.ipynb_checkpoints/vignette_example-checkpoint.ipynb', 'repo_name': 'connixu/ny_artsy_date', 'size': '8224'}