### Install whylogs Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/basic/Getting_Started.ipynb Installs the whylogs Python package using pip. It's recommended to restart the kernel after installation if you are in an environment like Jupyter Notebook. ```python # Note: you may need to restart the kernel to use updated packages. %pip install whylogs ``` -------------------------------- ### Install whylogs Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/basic/Getting_Started_with_UDFs.ipynb Installs the whylogs library with a minimum version of 1.5.0. ```python %pip install 'whylogs>=1.5.0' ``` -------------------------------- ### Install whylogs Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/integrations/writers/Getting_Started_with_WhyLabsV1.ipynb Installs the whylogs library with version 1.5.0 or higher. This is a prerequisite for using the WhyLabs Platform integration. ```python # Note: you may need to restart the kernel to use updated packages. ### The following WhyLabs Platform integration example requires the latest whylogs version: %pip install 'whylogs>=1.5.0' ``` -------------------------------- ### Install whylogs Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/basic/Constraints_Suite.ipynb Installs the whylogs library with visualization capabilities. ```bash %pip install 'whylogs[viz]' ``` -------------------------------- ### Install whylogs Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/basic/Logging_Different_Data.ipynb Installs the whylogs library using pip. This is a prerequisite for running the subsequent examples. ```python # Note: you may need to restart the kernel to use updated packages. %pip install whylogs ``` -------------------------------- ### Basic whylogs Profile Operations Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/basic/Getting_Started.ipynb Examples covering fundamental whylogs functionalities such as visualizing profiles, logging data in various formats, inspecting generated metrics, configuring schema for tracking, setting data constraints, and merging profiles. ```python # Visualizing Profiles # Compare profiles to detect distribution shifts, visualize histograms and bar charts and explore your data # from whylogs.viz import ProfileVisualizer # ... (code to load and visualize profiles) ``` ```python # Logging Data # See the different ways you can log your data with whylogs # from whylogs import Profile, log_pandas # ... (code to log data) ``` ```python # Inspecting Profiles # A deeper dive on the metrics generated by whylogs # from whylogs import Profile # ... (code to inspect profile metrics) ``` ```python # Schema Configuration for Tracking Metrics # Configure tracking metrics according to data type or column features # from whylogs import Profile, Schema # ... (code to configure schema) ``` ```python # Data Constraints # Set constraints to your data to ensure its quality # from whylogs import Profile, validate # ... (code to set and validate constraints) ``` ```python # Merging Profiles # Merge your profiles logged across different computing instances, time periods or data segments # from whylogs import Profile # ... (code to merge profiles) ``` -------------------------------- ### whylogs Integrations with External Tools Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/basic/Getting_Started.ipynb Examples demonstrating how to integrate whylogs with various external tools and platforms, including WhyLabs, PySpark, MLflow, BigQuery, and feature stores. ```python # WhyLabs Integration # Monitor your profiles continuously with the WhyLabs Observability Platform # from whylogs.api import Logger # logger = Logger() # ... (code to log and send to WhyLabs) ``` ```python # PySpark Integration # Use whylogs with pyspark # from whylogs.api import log_spark # ... (code to profile PySpark DataFrames) ``` ```python # Writing Profiles # See different ways and locations to output your profiles # from whylogs import Profile # ... (code to write profiles to files or other destinations) ``` ```python # Flask Integration # Create a Flask app with whylogs and WhyLabs integration # from flask import Flask # from whylogs.api import Logger # app = Flask(__name__) # logger = Logger() # ... (code for Flask app with whylogs) ``` ```python # Feature Stores Integration # Log features from your Feature Store with feast and whylogs # import feast # from whylogs.api import Logger # ... (code to integrate with feature stores) ``` ```python # BigQuery Integration # Profile data queried from a Google BigQuery table # from whylogs.api import Logger # ... (code to profile BigQuery data) ``` ```python # MLflow Integration # Log your whylogs profiles to an MLflow environment # import mlflow # from whylogs.api import Logger # ... (code to log profiles with MLflow) ``` -------------------------------- ### Load Example Data with Pandas Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/integrations/writers/Getting_Started_with_WhyLabsV1.ipynb Loads example data from a public S3 bucket into pandas DataFrames. It iterates through a series of URLs to fetch CSV files and stores them in a list. ```python import pandas as pd pdfs = [] for i in range(1, 8): path = f"https://whylabs-public.s3.us-west-2.amazonaws.com/demo_batches/input_batch_{i}.csv" print(f"Loading data from {path}") df = pd.read_csv(path) pdfs.append(df) ``` -------------------------------- ### Install whylogs and dependencies Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/integrations/BigQuery_Example.ipynb Installs the whylogs library with visualization capabilities, pandas-gbq for BigQuery interaction, and tqdm for progress bars. ```python # Note: you may need to restart the kernel to use updated packages. %pip install 'whylogs[viz]' %pip install pandas-gbq %pip install tqdm ``` -------------------------------- ### Install whylogs Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/basic/Constraints_Suite.ipynb Provides the command to install the whylogs library using pip. ```python pip install whylogs ``` -------------------------------- ### Write Profile to Disk Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/basic/Getting_Started.ipynb Saves the generated whylogs profile to a binary file named 'profile.bin' on the local filesystem. ```python why.write(profile, "profile.bin") ``` -------------------------------- ### Install whylogs datasets module Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/datasets/ecommerce.ipynb Installs the whylogs library with the datasets extra, which is necessary for loading and using datasets like Ecommerce. ```python # Note: you may need to restart the kernel to use updated packages. %pip install 'whylogs[datasets]' ``` -------------------------------- ### Install Whylogs and Dependencies Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/experimental/NLP_Summarization.ipynb Installs necessary Python packages for the document summarization example, including whylogs with embedding support, NLTK, and BeautifulSoup. ```python %pip install nltk %pip install bs4 %pip install whylogs[embeddings] ``` -------------------------------- ### Initialize whylogs from Command Line Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/integrations/writers/Getting_Started_with_WhyLabsV1.ipynb Initializes whylogs from the command line, which can be used to set up the configuration for the WhyLabs Platform integration or reset existing configurations. ```bash python -m whylogs.api.whylabs.session.why_init ``` -------------------------------- ### Install whylogs and datasets Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/advanced/Image_Logging_Udf_Metric.ipynb Installs the whylogs library with all extras and the datasets library using pip. ```python %pip install 'whylogs[all]' datasets -q ``` -------------------------------- ### Install whylogs Datasets Module Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/datasets/weather.ipynb Installs the whylogs library with the datasets extra, which is necessary for loading and using the Weather Forecast Dataset. A kernel restart might be required after installation. ```python # Note: you may need to restart the kernel to use updated packages. %pip install 'whylogs[datasets]' ``` -------------------------------- ### Install whylogs Datasets Module Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/datasets/employee.ipynb Installs the whylogs library with the datasets extra, which is necessary for using dataset modules like Employee. A kernel restart might be required after installation. ```python # Note: you may need to restart the kernel to use updated packages. %pip install 'whylogs[datasets]' ``` -------------------------------- ### Load Pandas DataFrame Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/basic/Getting_Started.ipynb Creates a sample Pandas DataFrame with 'animal', 'legs', and 'weight' columns to demonstrate whylogs profiling. ```python import pandas as pd data = { "animal": ["cat", "hawk", "snake", "cat"], "legs": [4, 2, 0, 4], "weight": [4.3, 1.8, 1.3, 4.1], } df = pd.DataFrame(data) ``` -------------------------------- ### Read Profile from Disk Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/basic/Getting_Started.ipynb Loads a whylogs profile from a binary file ('profile.bin'). The loaded object is a Profile View, suitable for visualization and merging, but not for further tracking. ```python n_prof = why.read("profile.bin") ``` -------------------------------- ### Profile DataFrame with whylogs Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/basic/Getting_Started.ipynb Logs a Pandas DataFrame using whylogs and retrieves the generated profile object. This profile contains statistical summaries of the data. ```python import whylogs as why results = why.log(df) profile = results.profile() ``` -------------------------------- ### Initialize whylogs for WhyLabs Platform Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/integrations/writers/Getting_Started_with_WhyLabsV1.ipynb Initializes the whylogs library for logging to the WhyLabs Platform. It enables uploading statistics upon logging and requires an organization ID and access token. ```python import whylogs as why # Create a model in the dashboard and use that model id as the default dataset id in the prompt here. It will be # saved in your whylogs conifg for future use. You can optionally supply reinit=True to reset your conifg. why.init(upload_on_log=True) ``` -------------------------------- ### Install whylogs Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/integrations/writers/Writing_Profiles.ipynb Installs the whylogs library using pip. A kernel restart might be necessary after installation. ```python import shutil %pip install whylogs ``` -------------------------------- ### Get Production Data by Number of Batches Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/datasets/employee.ipynb Retrieves a specified number of production data batches starting from a given date. This method allows for processing data over a period. ```python import whylogs as why batches = dataset.get_production_data(number_batches=5) for batch in batches: print("logging batch of size {} for {}".format(len(batch.data),batch.timestamp)) profile = why.log(batch.data).profile() profile.set_dataset_timestamp(batch.timestamp) profile.view().write("batch_{}".format(batch.timestamp)) ``` -------------------------------- ### Python Data Logging with whylogs Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/advanced/Basics_of_Custom_Performance_Metrics.ipynb Demonstrates basic data logging using whylogs in Python. This snippet shows how to create a logger, log data, and view the results. It's a fundamental example for getting started with whylogs. ```python from whylogs import Log # Create a logger instance logger = Log() # Log a dictionary of data data = { "name": "Alice", "age": 30, "city": "New York" } logger.log(data) # Log another record data2 = { "name": "Bob", "age": 25, "city": "Los Angeles" } logger.log(data2) # View the logged data (e.g., print a summary) print(logger.view().to_summary()) ``` -------------------------------- ### whylogs Configuration and Initialization Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/advanced/Basics_of_Custom_Performance_Metrics.ipynb Demonstrates how to configure and initialize whylogs, including setting up logging destinations and custom configurations. ```python from whylogs import Profile, logger from whylogs.core.config import YamlConfig # Load configuration from a YAML file config = YamlConfig.load('whylogs_config.yaml') # Initialize logger with custom configuration logger = logger.init(config=config) # Create a profile using the initialized logger profile = logger.profile() profile.log_data(data={'col1': 1}) print(profile.view().get_column('col1').get_statistics()) ``` -------------------------------- ### whylogs Configuration and Initialization Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/advanced/Basics_of_Custom_Performance_Metrics.ipynb Shows how to configure and initialize whylogs, including setting up custom configurations and integrating with different backends. ```python from whylogs import Log from whylogs.core.config import YamlConfigLoader # Load configuration from a YAML file config_loader = YamlConfigLoader() config = config_loader.load_config("path/to/your/whylogs.yaml") # Initialize Log with custom configuration log_with_config = Log(config=config) log_with_config.log_data(value=20, name='configured_metric') print(f"Configured Log JSON: {log_with_config.to_json()}") ``` -------------------------------- ### Basic whylogs Usage Source: https://github.com/whylabs/whylogs/blob/mainline/python/docs/examples.md Demonstrates the fundamental steps of initializing whylogs, creating a dataset profile, and logging data. ```python from whylogs import Log # Initialize whylogs log = Log() # Create a dataset profile profile = log.profile() # Log data profile.log_data(data={'col1': 1, 'col2': 'a'}) profile.log_data(data={'col1': 2, 'col2': 'b'}) # View the profile print(profile.view_profile()) ``` -------------------------------- ### Install whylogs Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/advanced/Basics_of_Custom_Performance_Metrics.ipynb Installs the whylogs library using pip. This is the first step before using any whylogs functionalities. ```python %pip install whylogs ``` -------------------------------- ### Set up Kaggle and Download Dataset Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/experimental/whylogs_Audio_examples.ipynb Installs the Kaggle CLI, uploads Kaggle credentials, and downloads the Free Spoken Digit Dataset (FSDD) from Kaggle. This dataset is used for audio sample data. ```shell ! pip install -q kaggle from google.colab import files files.upload() ``` ```shell ! kaggle datasets download -d joserzapata/free-spoken-digit-dataset-fsdd ``` ```shell !unzip -q /content/free-spoken-digit-dataset-fsdd.zip -d . ``` -------------------------------- ### Install MLflow and supporting libraries Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/integrations/Mlflow_Logging.ipynb Installs MLflow and other essential libraries like pandas, scikit-learn, and matplotlib. These are used for data manipulation, model training, and visualization in the example. ```python %pip install -q scikit-learn matplotlib pandas mlflow-skinny ``` -------------------------------- ### Get Feast Version Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/integrations/Feature_Stores_and_whylogs.ipynb Prints the installed version of the Feast library. ```python import feast feast.__version__ ``` -------------------------------- ### Install whylogs with WhyLabs extra Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/integrations/writers/Writing_Reference_Profiles_to_WhyLabs.ipynb Installs the whylogs library, including the necessary components for interacting with the WhyLabs platform. ```python # Note: you may need to restart the kernel to use updated packages. %pip install whylogs ``` -------------------------------- ### whylogs Configuration and Initialization Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/advanced/Basics_of_Custom_Performance_Metrics.ipynb This snippet illustrates how to configure and initialize whylogs, including setting up custom configurations and integrating with other systems. It highlights the flexibility in setting up the logging environment. ```python from whylogs import Log from whylogs.core.config import YamlConfig # Load configuration from a YAML file config = YamlConfig('whylogs_config.yaml') # Initialize whylogs with custom configuration log = Log(config=config) # Log data using the configured logger data = { "user_id": 123, "event": "click" } log.log(data) ``` -------------------------------- ### Get Baseline Timestamp Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/datasets/weather.ipynb Retrieves the baseline timestamp from a dataset object. ```python baseline = dataset.get_baseline() baseline.timestamp ``` -------------------------------- ### Describe DataFrame Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/integrations/writers/Getting_Started_with_WhyLabsV1.ipynb Generates descriptive statistics for the first DataFrame in the loaded list using the .describe() method. ```python pdfs[0].describe() ``` -------------------------------- ### Install Feast and whylogs Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/integrations/Feature_Stores_and_whylogs.ipynb Installs the necessary packages for the tutorial, including Feast and whylogs with visualization capabilities. It's recommended to restart the kernel after installation. ```python # Note: you may need to restart the kernel to use updated packages. %pip install --upgrade pip -qq ``` ```python %pip install feast==0.22.4 Pygments 'whylogs[viz]' -qqU ``` -------------------------------- ### Install whylogs Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/advanced/Transaction_Examples.ipynb Installs the whylogs library using pip. ```python !pip install whylogs ``` -------------------------------- ### Whylogs: Value Counts Example Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/tutorials/Data_Validation_Tutorial.ipynb Demonstrates how to get value counts for a column in a Pandas DataFrame using Whylogs. ```python df_reference['room_type'].value_counts() ``` -------------------------------- ### OpenAI Model Initialization Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/advanced/Basics_of_Custom_Performance_Metrics.ipynb Demonstrates the initialization of an OpenAI model, specifying the model name and optionally the provider. ```python OpenAIModel: __init__(model_name: str, provider: str = 'openai') model_name: The name of the OpenAI model to use provider: The provider to use (defaults to 'openai') ``` -------------------------------- ### Access Baseline Timestamp Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/datasets/employee.ipynb Accesses the timestamp attribute of the baseline data object, which indicates the start time of the batch. ```python baseline.timestamp ``` -------------------------------- ### Install whylogs Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/experimental/whylogs_UDF_examples.ipynb Installs the whylogs library using pip. This is the first step to using whylogs and its UDF features. ```python %pip install whylogs ``` -------------------------------- ### Get Baseline After Setting Parameters Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/datasets/ecommerce.ipynb Retrieves the baseline data again after setting parameters, reflecting the updated timestamp configuration. ```python baseline = dataset.get_baseline() baseline.timestamp ``` -------------------------------- ### Get Inference Data by Date Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/datasets/weather.ipynb Retrieves a single inference data batch for a specific target date. ```python batch = dataset.get_inference_data(target_date=now) # Accessing batch attributes: batch.timestamp batch.data batch.prediction.head() ``` -------------------------------- ### Access Baseline Timestamp Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/datasets/ecommerce.ipynb Accesses the timestamp attribute of the baseline object, indicating the start time of the baseline batch. ```python baseline.timestamp ``` -------------------------------- ### Load Pandas DataFrame Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/basic/Getting_Started_with_UDFs.ipynb Creates a sample Pandas DataFrame with 'animal', 'legs', and 'weight' columns to be used for whylogs profiling. ```python import pandas as pd data = { "animal": ["cat", "hawk", "clam", "cat", "mongoose", "octopus"], "legs": [4, 2, 1, 4, 4, 8], "weight": [4.3, 1.8, 1.3, 4.1, 5.4, 3.2], } df = pd.DataFrame(data) ``` -------------------------------- ### Install whylogs with Datasets and WhyLabs extras Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/integrations/writers/Writing_Regression_Performance_Metrics_to_WhyLabs.ipynb Installs the whylogs library with the necessary extras for datasets and WhyLabs integration. This command ensures all required dependencies are available for the tutorial. ```python # Note: you may need to restart the kernel to use updated packages. %pip install 'whylogs[datasets]' ``` -------------------------------- ### Install Dependencies Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/experimental/whylogs_Audio_examples.ipynb Installs the necessary Python packages: whylogs, pyAudioAnalysis, eyed3, and pydub. This is a prerequisite for running the subsequent code. ```python # Note: you may need to restart the kernel to use updated packages. %pip install whylogs pyAudioAnalysis eyed3 pydub ``` -------------------------------- ### Custom Metrics Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/README.md Guides on creating your own custom metrics and metric components. This allows for highly specific data analysis tailored to unique requirements. ```python from whylogs.core.metrics import Metric, Metrics from whylogs.core.metrics.number import NumberType # Example usage (actual code would be in the linked notebook) class MyCustomMetric(Metric): def __init__(self): super().__init__(NumberType.INT) def merge(self, other: Metric) -> Metric: # Implementation for merging custom metrics pass def serialize(self) -> dict: # Implementation for serializing custom metrics pass # ... register and use custom metric ... # Metrics.register_metric("my_custom_metric", MyCustomMetric) # profile.add_metric("my_custom_metric", MyCustomMetric()) ``` -------------------------------- ### Install whylogs and kafka-python Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/integrations/kafka-example/Kafka_Example.ipynb Installs the necessary Python packages for whylogs and Kafka integration. ```python # Note: you may need to restart the kernel to use updated packages. %pip install whylogs %pip install kafka-python ``` -------------------------------- ### Log Data and Get Profile View Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/basic/Constraints_Suite.ipynb Logs a Pandas DataFrame using whylogs and retrieves a profile view for constraint building. ```python import whylogs as why import pandas as pd data = { "animal": ["cat", "hawk", "snake", "cat", "mosquito"], "legs": [4, 2, 0, 4, 6], "weight": [4.3, 1.8, 1.3, 4.1, 5.5e-6], } results = why.log(pd.DataFrame(data)) profile_view = results.view() ``` -------------------------------- ### Initialize whylogs Logger Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/experimental/NLP_Summarization.ipynb Initializes a PersistentLogger with a DeclarativeSchema for processing text data. This setup is used for logging article and summary data. ```python schema = DeclarativeSchema(resolvers) why = PersistentLogger(schema=schema) ``` -------------------------------- ### OpenAI Model Initialization Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/advanced/Basics_of_Custom_Performance_Metrics.ipynb Demonstrates how to initialize an OpenAI model using its name and an optional provider. This is a fundamental step for utilizing OpenAI's services. ```python OpenAIModel: __init__(model_name: str, provider: str = 'openai') model_name: The name of the OpenAI model to use. provider: The provider to use (defaults to 'openai'). ``` -------------------------------- ### Install Dependencies Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/integrations/sagemaker_whylabs_example/WhyLabs_Sagemaker-PyTorch.ipynb Installs the necessary libraries: sagemaker, whylogs, and torch. ```python %pip install sagemaker whylogs torch torchvision ``` -------------------------------- ### Install whylogs Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/experimental/performance_estimation.ipynb Installs the whylogs library along with necessary extras for dataset operations. A kernel restart might be required after installation. ```python import sys # Note: you may need to restart the kernel to use updated packages. if sys.version_info >= (3, 11): # Use tomllib for Python 3.11+ import tomllib else: # Use tomli for older Python versions import tomli as tomllib # Example of how to use tomllib or tomli if needed for configuration parsing # with open("pyproject.toml", "rb") as f: # data = tomllib.load(f) %pip install 'whylogs[datasets]' ``` -------------------------------- ### Prepare Requirements File for SageMaker Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/integrations/sagemaker_whylabs_example/WhyLabs_Sagemaker-PyTorch.ipynb Creates a requirements.txt file with whylogs installed, suitable for SageMaker deployment. It uses a temporary virtual environment. ```bash ! mkdir -p code ! bash -c "virtualenv ./code/.venv && source ./code/.venv/bin/activate && pip install whylogs[image,proc]==1.3.8 && pip freeze > code/requirements.txt" ! rm -rf ./code/.venv ``` -------------------------------- ### Whylogs Configuration and Initialization Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/advanced/Basics_of_Custom_Performance_Metrics.ipynb Shows how to configure and initialize whylogs, including setting up logging destinations and custom configurations. This is crucial for directing where and how logs are stored. ```python import whylogs # Initialize whylogs with default configuration whylogs.init() # Initialize with custom configuration (e.g., specifying a logger) # from whylogs.core.config import WhylogsConfig # config = WhylogsConfig(log_level='INFO', log_destination='file') # whylogs.init(config=config) ``` -------------------------------- ### Access Baseline Timestamp Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/datasets/weather.ipynb Accesses the timestamp associated with the baseline data batch. This timestamp indicates the start time of the data batch. ```python baseline.timestamp ``` -------------------------------- ### Analyze and View Profile Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/basic/Getting_Started.ipynb Converts the whylogs profile into a Profile View and then into a Pandas DataFrame for easy inspection of statistics like counters, inferred types, and distribution metrics. ```python prof_view = profile.view() prof_df = prof_view.to_pandas() prof_df ``` -------------------------------- ### Profile DataFrame with Metric UDF Source: https://github.com/whylabs/whylogs/blob/mainline/python/examples/basic/Getting_Started_with_UDFs.ipynb Initializes whylogs and logs the DataFrame using the custom schema containing the metric UDF. The results are then viewed as a Pandas DataFrame. ```python import whylogs as why why.init(force_local=True) results = why.log(df, name="udf_demo", schema=custom_schema) results.view().to_pandas() ```