<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Validation Playground
Watch a short tutorial video or read the written tutorial
This notebook assumes that you created at least one expectation suite in your project.
Here you will learn how to validate data loaded into a Pandas DataFrame against an expectation suite.
We'd love it if you reach out for help on the Great Expectations Slack Channel
Step1:  1. Get a DataContext
This represents your project that you just created using great_expectations init.
Step2:  2. Choose an Expectation Suite
List expectation suites that you created in your project
Step3:  3. Load a batch of data you want to validate
To learn more about get_batch, see this tutorial
Step5:  4. Validate the batch with Validation Operators
Validation Operators provide a convenient way to bundle the validation of
multiple expectation suites and the actions that should be taken after validation.
When deploying Great Expectations in a real data pipeline, you will typically discover these needs
Step6:  5. View the Validation Results in Data Docs
Let's now build and look at your Data Docs. These will now include an data quality report built from the ValidationResults you just created that helps you communicate about your data with both machines and humans.
Read more about Data Docs in the tutorial
<ASSISTANT_TASK:>
Python Code:
import json
import great_expectations as ge
import great_expectations.jupyter_ux
from great_expectations.datasource.types import BatchKwargs
import datetime
Explanation: Validation Playground
Watch a short tutorial video or read the written tutorial
This notebook assumes that you created at least one expectation suite in your project.
Here you will learn how to validate data loaded into a Pandas DataFrame against an expectation suite.
We'd love it if you reach out for help on the Great Expectations Slack Channel
End of explanation
context = ge.data_context.DataContext()
Explanation: 1. Get a DataContext
This represents your project that you just created using great_expectations init.
End of explanation
context.list_expectation_suite_names()
expectation_suite_name =  # TODO: set to a name from the list above
Explanation: 2. Choose an Expectation Suite
List expectation suites that you created in your project
End of explanation
# list datasources of the type PandasDatasource in your project
[datasource['name'] for datasource in context.list_datasources() if datasource['class_name'] == 'PandasDatasource']
datasource_name = # TODO: set to a datasource name from above
# If you would like to validate a file on a filesystem:
batch_kwargs = {'path': "YOUR_FILE_PATH", 'datasource': datasource_name}
# If you already loaded the data into a Pandas Data Frame:
batch_kwargs = {'dataset': "YOUR_DATAFRAME", 'datasource': datasource_name}
batch = context.get_batch(batch_kwargs, expectation_suite_name)
batch.head()
Explanation: 3. Load a batch of data you want to validate
To learn more about get_batch, see this tutorial
End of explanation
# This is an example of invoking a validation operator that is configured by default in the great_expectations.yml file
Create a run_id. The run_id must be of type RunIdentifier, with optional run_name and run_time instantiation
arguments (or a dictionary with these keys). The run_name can be any string (this could come from your pipeline
runner, e.g. Airflow run id). The run_time can be either a dateutil parsable string or a datetime object.
Note - any provided datetime will be assumed to be a UTC time. If no instantiation arguments are given, run_name will
be None and run_time will default to the current UTC datetime.
run_id = {
  "run_name": "some_string_that_uniquely_identifies_this_run",  # insert your own run_name here
  "run_time": datetime.datetime.now(datetime.timezone.utc)
}
results = context.run_validation_operator(
    "action_list_operator",
    assets_to_validate=[batch],
    run_id=run_id)
Explanation: 4. Validate the batch with Validation Operators
Validation Operators provide a convenient way to bundle the validation of
multiple expectation suites and the actions that should be taken after validation.
When deploying Great Expectations in a real data pipeline, you will typically discover these needs:
validating a group of batches that are logically related
validating a batch against several expectation suites such as using a tiered pattern like warning and failure
doing something with the validation results (e.g., saving them for a later review, sending notifications in case of failures, etc.).
Read more about Validation Operators in the tutorial
End of explanation
context.open_data_docs()
Explanation: 5. View the Validation Results in Data Docs
Let's now build and look at your Data Docs. These will now include an data quality report built from the ValidationResults you just created that helps you communicate about your data with both machines and humans.
Read more about Data Docs in the tutorial
End of explanation
<END_TASK>