<jupyter_start><jupyter_text>**Note**: Click on "*Kernel*" > "*Restart Kernel and Run All*" in [JupyterLab](https://jupyterlab.readthedocs.io/en/stable/) *after* finishing the exercises to ensure that your solution runs top to bottom *without* any errors. If you cannot run this file on your machine, you may want to open it [in the cloud ](https://mybinder.org/v2/gh/webartifex/intro-to-data-science/main?urlpath=lab/tree/01_scientific_stack/03_exercises_simple_queries.ipynb).  Chapter 0: Python's Scientific Stack (Coding Exercises) The exercises below assume that you have read the preceeding content sections.The `...`'s in the code cells indicate where you need to fill in code snippets. The number of `...`'s within a code cell give you a rough idea of how many lines of code are needed to solve the task. You should not need to create any additional code cells for your final solution. However, you may want to use temporary code cells to try out some ideas.  Simple Queries<jupyter_code>import pandas as pd<jupyter_output><empty_output><jupyter_text>The [pd.read_csv() ](https://pandas.pydata.org/docs/reference/api/pandas.read_csv.htmlpandas.read_csv) function is very customizable. For example, it takes `dtype` and `parse_dates` inputs, which allows us to parse the timestamp and "cancelled" columns correctly right away.<jupyter_code>df = pd.read_csv(
    "orders.csv",
    index_col="order_id",
    dtype={"cancelled": bool},
    parse_dates=["placed_at", "pickup_at", "delivery_at"]
)
df.info()<jupyter_output><empty_output><jupyter_text>**Q1**: Write a filter to pull out orders of the restaurant with the name "Funky Burger" only!<jupyter_code>funky_burger = ...

df[funky_burger].head()<jupyter_output><empty_output><jupyter_text>**Q2**: Ensure that there is only one restaurant by this name!Hint: While several restaurants may share the same name, their ID is still different<jupyter_code>...<jupyter_output><empty_output><jupyter_text>**Q3**: How many orders did "Funky Burger" *receive* in the target horizon?<jupyter_code>len(df.loc[...])<jupyter_output><empty_output><jupyter_text>**Q4**: How many orders did "Funky Burger" *deliver* in the target horizon?Hint: "deliver" implies that an order must not be cancelled<jupyter_code>len(...)<jupyter_output><empty_output><jupyter_text>**Q5**: How much revenue did "Funky Burger" make?<jupyter_code>...
    ... & ...,
    "..."
...<jupyter_output><empty_output><jupyter_text>**Q6**: What was the average order's total at "Funky Burger"?<jupyter_code>...
    ...
    ...
...<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12329832749902761, 'fraction_numerical': 0.004667444574095682, 'mean_word_length': 5.413965087281795, 'pattern_counts': {'":': 1, '<': 33, '<?xml version=': 0, '>': 34, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, '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': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '538650', 'license': 'MIT', 'n_tokens_mistral': 860, 'n_tokens_neox': 838, 'n_words': 263, 'path': '01_scientific_stack/03_exercises_simple_queries.ipynb', 'repo_name': 'webartifex/cscm-workshop-intro-machine-learning', 'size': '2571'}