<jupyter_start><jupyter_text>Author Expectations [**Watch a short tutorial video**](https://docs.greatexpectations.io/en/latest/getting_started/create_expectations.html?utm_source=notebook&utm_medium=create_expectationsvideo)[**Read more in the tutorial**](https://docs.greatexpectations.io/en/latest/getting_started/create_expectations.html?utm_source=notebook&utm_medium=create_expectations)**Reach out for help on** [**Great Expectations Slack**](https://tinyurl.com/great-expectations-slack)  Get a DataContext object[Read more in the tutorial](https://great-expectations.readthedocs.io/en/latest/getting_started/create_expectations.html?utm_source=notebook&utm_medium=create_expectationsget-datacontext-object)<jupyter_code>context = ge.data_context.DataContext()<jupyter_output><empty_output><jupyter_text>List data assets in your project[Read more in the tutorial](https://docs.greatexpectations.io/en/latest/getting_started/create_expectations.html?utm_source=notebook&utm_medium=create_expectationsdata-assets)<jupyter_code>great_expectations.jupyter_ux.list_available_data_asset_names(context)<jupyter_output><empty_output><jupyter_text>Load a batch of data from the data asset you want to validateLearn about `get_batch` in [this tutorial](https://docs.greatexpectations.io/en/latest/getting_started/create_expectations.html?utm_source=notebook&utm_medium=create_expectationsget-batch)__Quick Guide:__ If you want to validate data in Pandas Dataframes or in Spark Dataframes:* A. If GE listed and profiled your files correctly:```data_asset_name = CHOOSE FROM THE LIST ABOVEbatch = context.get_batch(data_asset_name,                           expectation_suite_name)```* B. Otherwise (you want to control the logic of reading the data):```df = load the data into a dataframe, e.g., df = SparkDFDataset(spark.read.csv... or pd.read_csv(...data_asset_name = COME UP WITH A NAME - THIS WILL CREATE A NEW DATA ASSET.batch = context.get_batch(data_asset_name,                           expectation_suite_name,                           df)``` If you want to validate data in a database:* A. To validate an existing table:```data_asset_name = 'CHOOSE THE NAME OF YOUR TABLE FROM THE LIST OF DATA ASSETS ABOVE'df = context.get_batch(data_asset_name,                         expectation_suite_name='my_suite') ```* B. To validate a query result set:```data_asset_name = 'NAME YOUR QUERY (E.G., daily_users_query) - THIS WILL CREATE A NEW DATA ASSET'df = context.get_batch(data_asset_name,                         expectation_suite_name='my_suite',                        query='SQL FOR YOUR QUERY')```<jupyter_code>df = context.get_batch(COPY THE APPROPPRIATE CODE SNIPPET FROM THE CELL ABOVE
df.head()<jupyter_output><empty_output><jupyter_text>Optionally, customize options used to read your data (e.g., separators, header, etc) by setting reader options in `get_batch`[Read more in the tutorial](https://docs.greatexpectations.io/en/latest/getting_started/create_expectations.html?utm_source=notebook&utm_medium=create_expectationsreader-options)<jupyter_code># this is how you can see which data batch was loaded
df._batch_kwargs<jupyter_output><empty_output><jupyter_text>Author Expectations[Read more in the tutorial](https://docs.greatexpectations.io/en/latest/getting_started/create_expectations.html?utm_source=notebook&utm_medium=create_expectationscreate-expectations)See available expectations in the [expectation glossary](https://docs.greatexpectations.io/en/latest/glossary.html?utm_source=notebook&utm_medium=create_expectations)<jupyter_code>#example:

column_name = df.get_table_columns()[0]
df.expect_column_values_to_not_be_null(column_name)

# add more expectations here

# add more expectations here

# add more expectations here<jupyter_output><empty_output><jupyter_text>Review the expectationsExpectations that were true on this data batch were added. To view all the expectations you added so far about this data asset, do:<jupyter_code>df.get_expectation_suite()<jupyter_output><empty_output><jupyter_text>If you decide not to save some expectations that you created, use [remove_expectaton method](https://docs.greatexpectations.io/en/latest/module_docs/data_asset_module.html?highlight=remove_expectation&utm_source=notebook&utm_medium=create_expectationsgreat_expectations.data_asset.data_asset.DataAsset.remove_expectation)The following call will save the expectation suite as a JSON file in great_expectations/expectations directory of your project:<jupyter_code>df.save_expectation_suite()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09198682766190999, 'fraction_numerical': 0.0002195389681668496, 'mean_word_length': 6.481116584564861, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 10, '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': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '558128', 'license': 'Apache-2.0', 'n_tokens_mistral': 1426, 'n_tokens_neox': 1370, 'n_words': 300, 'path': 'great_expectations/init_notebooks/create_expectations.ipynb', 'repo_name': 'ncsu-las/great_expectations', 'size': '4555'}