<jupyter_start><jupyter_text>Part 1: Join the Duet Server the Data Owner connected to<jupyter_code>duet = sy.join_duet(loopback=True)<jupyter_output><empty_output><jupyter_text>Checkpoint 0 : Now STOP and run the Data Owner notebook until Checkpoint 1.  Part 2: Search for Available Data<jupyter_code># The data scientist can check the list of pointable data in Data Owner's duet store
duet.store.pandas
# Data Scientist likes the age data. (S)He needs a pointer to it.

data_ptr = duet.store[0]

# data_ptr is a reference to the age dataset remotely available on data owner's server
print(data_ptr)<jupyter_output><empty_output><jupyter_text>Part 3: Perform some basic analysis on the dataNow the data scientist can perform analysis on the data that is in the Data Owner's duet server, without the owner having to share his/her data.  Get average age<jupyter_code>average_age = data_ptr.float().mean()
# Now the Data Scientist wants to download the result.

try:
    average_age.get()
except Exception as e:
    print(e)
# Looks like the Data Scientist does not have permission to download this result! He/she needs
# to make a request to the Data Owner.

average_age.request(reason="Please approve!")<jupyter_output><empty_output><jupyter_text>Checkpoint 1 : Now STOP and run the Data Owner notebook until Checkpoint 2.<jupyter_code>try:
    average_age.get()
except Exception as e:
    print(e)
duet.requests.pandas
average_age.request(
    reason="I am data scientist and I need to know the average age for my analysis."
)
duet.requests.pandas<jupyter_output><empty_output><jupyter_text>Checkpoint 2 : Now STOP and run the Data Owner notebook until the next checkpoint.<jupyter_code># Once the request disappears - the data scientist can download the result!
avg = average_age.get()
assert round(avg.item(), 4) == 46.8333<jupyter_output><empty_output><jupyter_text>Get min and max age<jupyter_code>duet.torch
max_age = data_ptr.float().amax()
min_age = data_ptr.float().amin()
max_age_result = max_age.get(
    request_block=True,
    reason="download the maximum age",
    timeout_secs=10,
)

assert round(max_age_result.item()) == 88
max_age_result
min_age_result = min_age.get(
    request_block=True,
    reason="download the minimum age",
    timeout_secs=10,
)

assert round(min_age_result.item()) == 22
min_age_result<jupyter_output><empty_output><jupyter_text>Let's cheat!<jupyter_code>age_data = data_ptr.get(request_block=True, delete_obj=False)

assert age_data.tolist() == [25, 32, 49, 65, 88, 22]
print(age_data)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09026963657678781, 'fraction_numerical': 0.01406799531066823, 'mean_word_length': 5.7191601049868765, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '425619', 'license': 'Apache-2.0', 'n_tokens_mistral': 889, 'n_tokens_neox': 836, 'n_words': 263, 'path': 'examples/private-ai-series/duet_basics/Duet_Basics_Data_Scientist.ipynb', 'repo_name': 'Bhuvan-21/PySyft', 'size': '2559'}