<jupyter_start><jupyter_text>What is a notebook？ In the notebook, you can write and execute `Python code`, move the **data analysis work on the personal computer to the browser**, and at the same time:- No need to deploy environment, and use stronger server resources than personal computer configuration- Data query and notebook get through, no need to turn data multiple times- Use Pandas, Matplotlib, TenSorFlow to complete data analysis and machine learning - Project collaboration: the same project includes data exploration, data development, and process modelingWhether you are a **Python beginner**, **data analyst** or **data scientist**, notebook can help you complete data analysis tasks more easily. You can read the **Data Platform Help Document** for details, or check the getting started guide below!  Getting startedThe document you are reading is not a static web page, but an interactive environment that allows you to **write and execute code**, called **notebook**.For example, the following `Code Cell` will output today's date, just like operating in the Python IDE.<jupyter_code>import time
today = time.strftime("%Y%m%d", time.localtime())
print(today)<jupyter_output>20200605<jupyter_text>To execute the code in the above cell, click the run button on the left (shortcut key `Shift+Enter`).Of course, you can complete a simple calculation, such as approximately how many days in a lifetime<jupyter_code>days_in_a_life= 365 * 80

days_in_a_life<jupyter_output><empty_output><jupyter_text>About how many hours in a lifetime> In the same notebook, you can reference variables<jupyter_code>hours_in_a_life = 24 * days_in_a_life

hours_in_a_life<jupyter_output><empty_output><jupyter_text>You can combine **executable code**, **rich text**, and **images**, **HTML**, **LaTeX**, etc., into one document.You can use your notebook for data exploration under your personal, or you can edit your notebook under the project and collaborate with project members.The notebook are based on the [Jupyter](https://www.jupyter.org/) solution.Next, let's look at how to load the data of the result data table in the notebook.  Retrieve data Use SQL query in cell> Support to refer to the `variable` defined by the previous `Cell` in `Cell`<jupyter_code>%%bksql 
SELECT status, body_bytes_sent, http_referer, method, URI, dtEventTime
       FROM 591_demo_nginx_access_log
       WHERE thedate={today}
    ORDER BY dtEventTime DESC LIMIT 3<jupyter_output><empty_output><jupyter_text>Quoting query resultsAfter executing the query statement, the query result set supports assignment to custom variables<jupyter_code>result = _<jupyter_output><empty_output><jupyter_text>The custom variable `result` contains methods such as `dicts`, `DataFrame`, etc. to facilitate secondary processing of the result set<jupyter_code>for line in result.data:
  print(line)
df = result.DataFrame()
df.columns<jupyter_output><empty_output><jupyter_text>Of course, you can use `single-row SQL query` to assign the query result to a variable.<jupyter_code>uri_group_result = %bksql SELECT URI, COUNT(*) AS cnt FROM 591_demo_nginx_access_log.hdfs WHERE thedate=current_date() GROUP BY URI ORDER BY cnt DESC LIMIT 10 

uri_group_result<jupyter_output><empty_output><jupyter_text>Reference query result set in data explorationThe query result set of the data exploration query task can be used directly in the notebook, method: datasets('query_task_name')<jupyter_code>day_pv_last_week = datasets('query_1')

day_pv_last_week<jupyter_output><empty_output><jupyter_text>Data scienceWith the help of notebook, you can take advantage of the power of commonly used Python libraries to analyze and visualize data. The following `Code Cell` uses `NumPy` to generate some random data, and uses `Matplotlib` to visualize these data. To modify the code, just click on `Cell` and start to modify.<jupyter_code>import numpy as np
from matplotlib import pyplot as plt

ys = 100 + np.random.randn(100)
x = [x for x in range(len(ys))]

plt.plot(x, ys, '-')
plt.fill_between(x, ys, 95, where=(ys > 95), facecolor='g', alpha=0.6)

plt.title("Visualization Demo")
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.07895368370530358, 'fraction_numerical': 0.008879289656827454, 'mean_word_length': 6.136986301369863, 'pattern_counts': {'":': 0, '<': 36, '<?xml version=': 0, '>': 39, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, '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': '9', 'dir': 'jupyter-structured-clean-dedup', 'id': '404068', 'license': 'MIT', 'n_tokens_mistral': 1229, 'n_tokens_neox': 1176, 'n_words': 501, 'path': 'src/datalab/notebook/dockerfiles/notebooks/example_en.ipynb', 'repo_name': 'Chromico/bk-base', 'size': '4167'}