### Sweetviz Natural Language Queries and MLOps Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/MODERNIZATION_SUMMARY.md Provides examples of using Sweetviz for natural language data exploration, including asking questions about the dataset and getting query suggestions. It also shows MLOps integrations for experiment tracking with MLflow and Weights & Biases, and enhanced AI insights like anomaly detection and data summarization. ```Python # Natural language data exploration result = sv.ask_question("What is the average salary?", df) result = sv.ask_question("How many missing values are in age?", df) suggestions = sv.get_query_suggestions() # MLOps integrations report = sv.analyze(df) mlflow_result = report.to_mlflow(experiment_name="customer_analysis") wandb_result = report.to_wandb(experiment_name="customer_analysis") # Enhanced AI insights ai_manager = sv.get_ai_manager() anomalies = ai_manager.detect_anomalies(df) # Multiple methods: IQR, Z-score, Modified Z-score summary = ai_manager.generate_data_summary(df) # Comprehensive analysis ``` -------------------------------- ### Sweetviz Installation Options Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/PHASE_COMPLETION_SUMMARY.md Provides instructions for installing Sweetviz with different feature sets using pip. Users can install core functionality, enhanced features, AI features, MLOps integrations, or all features. ```Bash pip install sweetviz ``` ```Bash # Interactive visualizations pip install sweetviz[enhanced] ``` ```Bash # AI features pip install sweetviz[ai] ``` ```Bash # MLOps integrations pip install sweetviz[mlops] ``` ```Bash # Everything pip install sweetviz[ai,mlops,enhanced] ``` -------------------------------- ### Modern Configuration in Sweetviz Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/README.md This example demonstrates the modern configuration system in Sweetviz, allowing users to customize themes, visualization engines, and enable AI features with API keys. ```Python # Modern Configuration (Phases 1-4) config = sv.ModernConfig() config.theme = sv.Theme.MODERN_DARK config.visualizations.engine = sv.VisualizationEngine.AUTO config.enable_ai_features(provider="openai", api_key="your-key") sv.set_config(config) ``` -------------------------------- ### Install Sweetviz using pip Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/README.md The recommended method for installing Sweetviz is through pip. This command fetches and installs the latest version of the library and its dependencies. ```bash pip install sweetviz ``` -------------------------------- ### Basic Sweetviz Analysis Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/MODERNIZATION_SUMMARY.md Demonstrates the fundamental usage of Sweetviz to analyze a Pandas DataFrame and display the report as an HTML file. This is the standard starting point for using the library. ```Python import sweetviz as sv import pandas as pd df = pd.read_csv("data.csv") report = sv.analyze(df) report.show_html() ``` -------------------------------- ### Sweetviz FeatureConfig example Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/README.md Provides an example of how to create a FeatureConfig object in Sweetviz to manage feature analysis. This includes skipping specific features and forcing others to be treated as text. ```Python feature_config = sv.FeatureConfig(skip="PassengerId", force_text=["Age"]) ``` -------------------------------- ### Natural Language Data Exploration with Sweetviz Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/PHASE_COMPLETION_SUMMARY.md Allows users to ask questions about their data in plain English using the Sweetviz library. It supports querying specific information and getting suggestions for further exploration. ```Python # Ask questions in plain English result = sv.ask_question("What is the average salary?", df) result = sv.ask_question("How many missing values are in age?", df) suggestions = sv.get_query_suggestions() ``` -------------------------------- ### Sweetviz compare_intra() function usage Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/README.md Demonstrates the use of the compare_intra() function in Sweetviz for comparing two subsets of the same dataframe, for example, male vs. female populations. It shows how to provide a boolean series for splitting and names for the resulting datasets. ```Python my_report = sv.compare_intra(my_dataframe, my_dataframe["Sex"] == "male", ["Male", "Female"], "Survived", feature_config) ``` -------------------------------- ### Configure Modern Features in Sweetviz Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/PHASE_COMPLETION_SUMMARY.md This snippet demonstrates how to configure modern features for Sweetviz, including setting a theme, visualization engine, enabling sampling, and integrating AI features with an OpenAI provider and API key. The configuration is then applied using `sv.set_config()`. ```Python config = sv.ModernConfig() config.theme = sv.Theme.MODERN_DARK config.visualizations.engine = sv.VisualizationEngine.AUTO config.performance.enable_sampling = True config.enable_ai_features(provider="openai", api_key="sk-...") # Optional sv.set_config(config) ``` -------------------------------- ### Configure Sweetviz with Modern Settings and AI Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/MODERNIZATION_SUMMARY.md This snippet demonstrates how to configure Sweetviz with modern settings, including theme, performance mode, visualization engine, and export formats. It also shows how to enable optional AI features by specifying the LLM provider and API key. ```Python config = sv.ModernConfig() config.theme = sv.Theme.MODERN_DARK config.performance_mode = sv.PerformanceMode.BALANCED config.visualizations.engine = sv.VisualizationEngine.AUTO config.export_formats = [sv.ExportFormat.HTML, sv.ExportFormat.JSON] # Enable AI features (optional) config.enable_ai_features( provider=sv.LLMProvider.OPENAI, api_key="your-api-key", generate_insights=True ) sv.set_config(config) ``` -------------------------------- ### Ask Questions About Data with Sweetviz Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/MODERNIZATION_SUMMARY.md Utilize the `sv.ask_question()` function to query your data using natural language. This feature leverages AI to provide insights based on your dataset. ```Python import sweetviz as sv # Assuming 'report' is a pre-generated Sweetviz report object # and 'my_dataset' is your pandas DataFrame # Example usage: # report = sv.analyze(my_dataset) # Ask a question about the data # response = sv.ask_question("What are the main correlations in the data?", report=report) # print(response) # Or directly if the function supports it without a pre-generated report # response = sv.ask_question("Show me the distribution of the 'age' column.") # print(response) ``` -------------------------------- ### Display Project Information Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/sweetviz/templates/dataframe_page.html Displays project version, links to updates, documentation, issue reporting, and credits for creators and designers, conditionally shown if 'show_logo' is true. ```HTML {% if layout.show_logo %} {{ version }} [Get updates, docs & report issues here](https://github.com/fbdesignpro/sweetviz) Created & maintained by [Francois Bertrand](https://www.fbdesignpro.com) Graphic design by [Jean-Francois Hains](https://www.fbdesignpro.com) {% endif %} ``` -------------------------------- ### Sweetviz Performance Configuration Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/MODERNIZATION_SUMMARY.md Demonstrates how to optimize Sweetviz for large datasets by enabling performance modes, such as fast processing and data sampling. This is crucial for handling big data efficiently. ```Python # Optimize for large datasets config = sv.ModernConfig() config.performance_mode = sv.PerformanceMode.FAST config.performance.enable_sampling = True config.performance.max_sample_size = 5000 sv.set_config(config) ``` -------------------------------- ### Backwards Compatibility of Sweetviz Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/PHASE_COMPLETION_SUMMARY.md Demonstrates that existing Sweetviz code for analyzing dataframes and comparing datasets continues to work unchanged after the v2 modernization. ```Python # This continues to work unchanged import sweetviz as sv report = sv.analyze(df) report.show_html() comparison = sv.compare([train_df, "Training"], [test_df, "Testing"]) comparison.show_html() ``` -------------------------------- ### Sweetviz Enhanced Visualization and Themes Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/MODERNIZATION_SUMMARY.md Shows how to configure Sweetviz with modern themes, such as a dark theme, and enable interactive, mobile-responsive charts using Plotly. This allows for more visually appealing and user-friendly reports. ```Python import sweetviz as sv # Configure modern dark theme with Plotly config = sv.ModernConfig() config.theme = sv.Theme.MODERN_DARK config.visualizations.engine = sv.VisualizationEngine.AUTO config.visualizations.interactive_charts = True config.visualizations.mobile_responsive = True sv.set_config(config) # Enhanced visualizations visualizer = sv.get_enhanced_visualizer() chart = visualizer.create_histogram(df['column'], title="Enhanced Chart") ``` -------------------------------- ### Log Sweetviz Reports to Weights & Biases Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/MODERNIZATION_SUMMARY.md Log your Sweetviz analysis results to Weights & Biases (WandB) for comprehensive ML experiment logging using the `report.to_wandb()` method. This facilitates tracking of dataset metrics and analysis outcomes. ```Python import sweetviz as sv import pandas as pd # Load your dataset data = pd.read_csv("your_dataset.csv") # Analyze the data and create a report report = sv.analyze(data) # Log the report to Weights & Biases # report.to_wandb() # Note: Ensure Weights & Biases is installed and configured for this to work. ``` -------------------------------- ### Performance Optimizations in Sweetviz Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/PHASE_COMPLETION_SUMMARY.md Configures Sweetviz for performance optimization by enabling smart sampling for large datasets and parallel processing. Users can set sample size limits and enable parallel execution. ```Python # Smart sampling for large datasets config = sv.ModernConfig() config.performance.enable_sampling = True config.performance.max_sample_size = 10000 config.performance.enable_parallel_processing = True sv.set_config(config) ``` -------------------------------- ### Utilize Sweetviz AI Manager for Data Analysis Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/MODERNIZATION_SUMMARY.md This code snippet illustrates how to use the Sweetviz AI manager once AI features are enabled. It covers generating a natural language data summary, detecting various types of anomalies (statistical and pattern-based), and obtaining AI-powered explanations for feature correlations. ```Python # Get AI manager ai_manager = sv.get_ai_manager() if ai_manager.is_available(): # Generate natural language summary summary = ai_manager.generate_data_summary(df) # Detect anomalies with multiple methods anomalies = ai_manager.detect_anomalies(df) statistical_outliers = anomalies['statistical_outliers'] # IQR, Z-score methods pattern_anomalies = anomalies['pattern_anomalies'] # Data quality issues recommendations = anomalies['recommendations'] # Actionable insights # Explain correlations with AI correlations = {"feature1_feature2": 0.85} explanation = ai_manager.explain_correlations(correlations) ``` -------------------------------- ### Sweetviz Multi-Format Export Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/MODERNIZATION_SUMMARY.md Illustrates how to export a Sweetviz report into various formats including HTML, JSON, and SVG. This provides flexibility in how the analysis results are shared and utilized. ```Python # Export to multiple formats exporter = sv.get_enhanced_exporter() results = exporter.export_report( report_data, "my_report", formats=[sv.ExportFormat.HTML, sv.ExportFormat.JSON, sv.ExportFormat.SVG] ) ``` -------------------------------- ### Log Sweetviz Reports to MLflow Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/MODERNIZATION_SUMMARY.md Integrate Sweetviz reports with MLflow for experiment tracking using the `report.to_mlflow()` method. This allows for automated logging of dataset metrics and analysis results within your MLflow experiments. ```Python import sweetviz as sv import pandas as pd # Load your dataset data = pd.read_csv("your_dataset.csv") # Analyze the data and create a report report = sv.analyze(data) # Log the report to MLflow # report.to_mlflow() # Note: Ensure MLflow is installed and configured for this to work. ``` -------------------------------- ### AI Insights with Sweetviz AI Manager Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/PHASE_COMPLETION_SUMMARY.md This code demonstrates how to leverage Sweetviz's AI capabilities. It retrieves an AI manager, checks its availability, and then uses it to detect anomalies and generate a data summary from a Pandas DataFrame `df`. ```Python ai_manager = sv.get_ai_manager() if ai_manager.is_available(): anomalies = ai_manager.detect_anomalies(df) summary = ai_manager.generate_data_summary(df) ``` -------------------------------- ### Sweetviz analyze() function signature Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/README.md Demonstrates the signature of the analyze() function in Sweetviz, highlighting its various optional arguments like source data, target feature, feature configuration, verbosity, and pairwise analysis settings. ```Python analyze(source: Union[pd.DataFrame, Tuple[pd.DataFrame, str]], target_feat: str = None, feat_cfg: FeatureConfig = None, pairwise_analysis: str = 'auto', verbosity: str = 'default'): ``` -------------------------------- ### Sweetviz show_html() function parameters Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/README.md Details the parameters available for the show_html() function in Sweetviz, used to display and save reports. It covers options for file path, automatic browser opening, layout (widescreen/vertical), and scaling. ```Python show_html( filepath='SWEETVIZ_REPORT.html', open_browser=True, layout='widescreen', scale=None) ``` -------------------------------- ### Render Feature HTML Summary and Detail Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/sweetviz/templates/dataframe_page.html Iterates through each feature and renders its HTML summary. If the page layout is 'vertical', it also renders the detailed HTML for each feature. ```HTML {% for item in dataframe._features.values() %} {{ item.html_summary }} {% if dataframe.page_layout == 'vertical': %} {{ item.html_detail }} {% endif %} {% endfor %} ``` -------------------------------- ### Interactive Visualizations and Modern Theming in Sweetviz Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/PHASE_COMPLETION_SUMMARY.md Configures Sweetviz to use modern themes and interactive Plotly charts. Users can customize the appearance and visualization engine for reports. ```Python # Modern dark theme with interactive Plotly charts config = sv.ModernConfig() config.theme = sv.Theme.MODERN_DARK config.visualizations.engine = sv.VisualizationEngine.AUTO sv.set_config(config) ``` -------------------------------- ### Natural Language Exploration with Sweetviz Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/PHASE_COMPLETION_SUMMARY.md This snippet illustrates how to use Sweetviz's natural language interface to query data. It demonstrates asking for the average age and the number of missing values in the 'salary' column from a Pandas DataFrame `df`. ```Python avg_age = sv.ask_question("mean of age", df) missing_data = sv.ask_question("missing values in salary", df) ``` -------------------------------- ### Render Target HTML Summary and Detail Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/sweetviz/templates/dataframe_page.html Renders the HTML summary for the target. If the page layout is 'vertical', it also renders the detailed HTML for the target. ```HTML {% if dataframe._target is not none: %} {{ dataframe._target.html_summary }} {% if dataframe.page_layout == 'vertical': %} {{ dataframe._target.html_detail }} {% endif %} {% endif %} ``` -------------------------------- ### Sweetviz compare() function usage Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/README.md Illustrates how to use the compare() function in Sweetviz to compare two datasets, such as training and test sets. It shows the recommended format for providing dataframes with names and specifies a target feature and feature configuration. ```Python my_report = sv.compare([my_dataframe, "Training Data"], [test_df, "Test Data"], "Survived", feature_config) ``` -------------------------------- ### MLOps Platform Integrations with Sweetviz Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/PHASE_COMPLETION_SUMMARY.md Enables exporting Sweetviz analysis reports to MLOps platforms like MLflow and Weights & Biases. This facilitates experiment tracking and model management. ```Python # Export to experiment tracking platforms report = sv.analyze(df) mlflow_result = report.to_mlflow(experiment_name="customer_analysis") wandb_result = report.to_wandb(experiment_name="customer_analysis") ``` -------------------------------- ### Natural Language Data Exploration with Sweetviz Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/README.md This snippet demonstrates how to use Sweetviz's new natural language querying feature to ask questions about your DataFrame. It allows for plain English queries to extract insights and suggest further queries. ```Python # Natural Language Data Exploration (NEW in Phase 5) import sweetviz as sv # Ask questions in plain English result = sv.ask_question("What is the average salary?", df) result = sv.ask_question("How many missing values are in age?", df) suggestions = sv.get_query_suggestions() ``` -------------------------------- ### Basic Sweetviz EDA Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/README.md This is the fundamental usage of Sweetviz for Exploratory Data Analysis. It generates a detailed HTML report with visualizations in just two lines of Python code. ```Python import sweetviz as sv # Analyze the dataframe report = sv.analyze(df) # Display the report report.show_html('Sweetviz_Report.html') ``` -------------------------------- ### Multi-Format Professional Export with Sweetviz Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/PHASE_COMPLETION_SUMMARY.md Provides an enhanced exporter for generating analysis reports in multiple professional formats, including HTML, JSON, SVG, and PDF. ```Python # Export to multiple professional formats exporter = sv.get_enhanced_exporter() results = exporter.export_report( report_data, "analysis_report", formats=[sv.ExportFormat.HTML, sv.ExportFormat.JSON, sv.ExportFormat.SVG, sv.ExportFormat.PDF] ) ``` -------------------------------- ### Advanced AI Insights with Sweetviz Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/PHASE_COMPLETION_SUMMARY.md Leverages AI for enhanced anomaly detection using multiple methods. Users can obtain an AI manager instance to detect anomalies in their data, receiving various outlier types and recommendations. ```Python # Enhanced anomaly detection with multiple methods ai_manager = sv.get_ai_manager() anomalies = ai_manager.detect_anomalies(df) # Returns: IQR outliers, Z-score outliers, pattern anomalies, recommendations ``` -------------------------------- ### Render DataFrame Summary HTML Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/sweetviz/templates/dataframe_page.html Renders the HTML summary of the dataframe. ```HTML {{ dataframe.dataframe_summary_html }} ``` -------------------------------- ### Export Sweetviz Reports to Various Formats Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/MODERNIZATION_SUMMARY.md Export your Sweetviz analysis reports into multiple formats including HTML, JSON, SVG, and PDF. The JSON export provides machine-readable data for downstream integrations, while SVG offers publication-quality graphics. ```Python import sweetviz as sv import pandas as pd # Load your dataset data = pd.read_csv("your_dataset.csv") # Analyze the data and create a report report = sv.analyze(data) # Export to HTML (default) # report.show_html('report.html') # Export to JSON # report.to_json('report.json') # Export to SVG # report.to_svg('report.svg') # Export to PDF (requires weasyprint) # report.to_pdf('report.pdf') ``` -------------------------------- ### Export Sweetviz Report in Multiple Formats Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/PHASE_COMPLETION_SUMMARY.md This code demonstrates exporting a Sweetviz report in multiple formats (HTML, JSON, PDF) using the enhanced exporter. It retrieves the data from the report and specifies the desired formats. ```Python exporter = sv.get_enhanced_exporter() exports = exporter.export_report( report.get_data(), "my_analysis", formats=[sv.ExportFormat.HTML, sv.ExportFormat.JSON, sv.ExportFormat.PDF] ) ``` -------------------------------- ### Enhanced AI Insights with Sweetviz Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/README.md This snippet illustrates how to leverage Sweetviz's advanced AI features for data analysis, including anomaly detection using multiple methods and generating comprehensive data summaries. ```Python # Enhanced AI Insights (Phase 5) ai_manager = sv.get_ai_manager() anomalies = ai_manager.detect_anomalies(df) # Multi-method detection summary = ai_manager.generate_data_summary(df) # Comprehensive analysis ``` -------------------------------- ### Show Sweetviz Report in HTML Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/PHASE_COMPLETION_SUMMARY.md This is a traditional method to display the generated Sweetviz report directly in an HTML format. ```Python report.show_html() ``` -------------------------------- ### Show Sweetviz Report in Notebook Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/README.md Embeds a Sweetviz report directly within a notebook environment (like Jupyter or Google Colab) using an IFRAME. Allows customization of width, height, and layout for optimal display in constrained notebook environments. Dependencies include the Sweetviz library. ```Python import sweetviz as sv # Example usage with custom parameters report = sv.analyze(my_dataframe) report.show_notebook(w=900, h=700, scale=0.9, layout='widescreen') ``` -------------------------------- ### Override Sweetviz Configuration Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/README.md Allows customization of Sweetviz's default behavior by reading an INI configuration file. This is crucial for setting report defaults like layout, size, and verbosity, or enabling features like CJK font support and removing the logo. It's recommended to load overrides before any other Sweetviz commands. ```Python import sweetviz as sv # Load custom configuration from an INI file sv.config_parser.read("Override.ini") # Example Override.ini content: # [Output_Defaults] # notebook_layout = vertical # notebook_scale = 0.9 # notebook_width = 100%% # # [General] # use_cjk_font = 1 # default_verbosity = off # # [Layout] # show_logo = 0 ``` -------------------------------- ### Analyze a single DataFrame with Sweetviz Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/README.md This Python code snippet demonstrates the basic usage of Sweetviz to analyze a single Pandas DataFrame. It imports the library, creates a report using the `analyze` function, and then displays the report as an HTML file. ```python import sweetviz as sv my_report = sv.analyze(my_dataframe) my_report.show_html() # Default arguments will generate to "SWEETVIZ_REPORT.html" ``` -------------------------------- ### Configure Comet.ml Report Parameters in Sweetviz Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/README.md Customize the appearance of Sweetviz reports within Comet.ml by overriding default settings in a configuration file. This allows users to specify layout (e.g., 'vertical') and scaling factors for their reports. ```INI [comet_ml_defaults] html_layout = vertical html_scale = 0.85 ``` -------------------------------- ### Render Widescreen Detail HTML Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/sweetviz/templates/dataframe_page.html Renders detailed HTML content for the target and features when the page layout is 'widescreen'. Also includes association HTML sources and comparisons if available. ```HTML {% if dataframe.page_layout == 'widescreen': %} {% if dataframe._target is not none: %} {{ dataframe._target.html_detail }} {% endif %} {% if dataframe.associations_html_source is not none: %} {{ dataframe.associations_html_source }} {% endif %} {% if dataframe.associations_html_compare is not none: %} {{ dataframe.associations_html_compare }} {% endif %} {% if dataframe._target is not none: %} {{ dataframe._target.html_detail }} {% endif %} {% for item in dataframe._features.values() %} {{ item.html_detail }} {% endfor %} {% endif %} ``` -------------------------------- ### Analyze Data with Sweetviz Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/PHASE_COMPLETION_SUMMARY.md This code snippet shows the basic usage of Sweetviz for data analysis. It takes a Pandas DataFrame `df` as input and generates a report using `sv.analyze(df)`. ```Python report = sv.analyze(df) ``` -------------------------------- ### MLOps Integration with Sweetviz Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/README.md This code shows how to integrate Sweetviz reports with MLOps platforms like MLflow and Weights & Biases. After analyzing a DataFrame, the report can be exported for experiment tracking. ```Python # MLOps Integration (NEW in Phase 5) report = sv.analyze(df) mlflow_result = report.to_mlflow(experiment_name="analysis") wandb_result = report.to_wandb(experiment_name="analysis") ``` -------------------------------- ### Embed Graph Legend and Set Global Variables Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/sweetviz/templates/dataframe_page.html Embeds the base64 encoded PNG image for the graph legend into a CSS pseudo-element and sets global JavaScript variables for page height and scale. ```CSS span.graph-legend { content: url(data:image/png;base64,{{ dataframe.graph_legend.graph_base64.decode('ascii') }}); } g_height = {{ dataframe.page_height }}; g_scale = {{ dataframe.scale }}; ``` -------------------------------- ### Embed Feature Minigraphs and Detail Graphs Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/sweetviz/templates/dataframe_page.html Embeds base64 encoded PNG images for feature minigraphs and detail graphs into CSS pseudo-elements. This is done by iterating through each feature and checking for the presence of minigraphs or detail graphs. ```CSS {% for item in dataframe._features.values() %} {% if "minigraph" in item.keys(): %} span.minigraph-f{{ item.order_index }}::before { content: url(data:image/png;base64,{{ item.minigraph.graph_base64.decode('ascii') }}); } {% endif %} {% if "detail_graphs" in item.keys(): %} {% for detail_graph in item.detail_graphs %} span.detail_graph-f{{ item.order_index }}-{{ detail_graph.index_for_css }}::before { content: url(data:image/png;base64,{{ detail_graph.graph_base64.decode('ascii') }}); } {% endfor %} {% endif %} {% endfor %} ``` -------------------------------- ### Embed Target Minigraph and Detail Graphs Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/sweetviz/templates/dataframe_page.html Embeds base64 encoded PNG images for the target's minigraph and detail graphs into CSS pseudo-elements. This is done conditionally if the target data and detail graphs exist. ```CSS span.minigraph-target::before { content: url(data:image/png;base64,{{ dataframe._target.minigraph.graph_base64.decode('ascii') }}); } {% if "detail_graphs" in dataframe._target.keys(): %} {% for detail_graph in dataframe._target.detail_graphs %} span.detail_graph-f{{ dataframe._target.order_index }}-{{ detail_graph.index_for_css }}::before { content: url(data:image/png;base64,{{ detail_graph.graph_base64.decode('ascii') }}); } {% endfor %} {% endif %} ``` -------------------------------- ### Include Sweetviz JavaScript and CSS Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/sweetviz/templates/dataframe_page.html Conditionally includes the main Sweetviz JavaScript file ('sweetviz.js' or 'sweetviz_vertical.js') and CSS files based on the page layout and test mode. Also includes jQuery. ```HTML {% if not dataframe.test_mode: %} {% include 'js/jquery-3.7.1.min.js' %} {% if dataframe.page_layout == 'widescreen': %} {% include 'js/sweetviz.js' %} {% else %} {% include 'js/sweetviz_vertical.js' %} {% endif %} {% include 'sv_assets.css' %} {% else %} {% if dataframe.page_layout == 'widescreen': %} {% else %} {% endif %} {% endif %} {% include 'sweetviz.css' %} ``` -------------------------------- ### Export Sweetviz Report to MLOps Platforms Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/PHASE_COMPLETION_SUMMARY.md This snippet shows how to export a Sweetviz analysis report to MLOps platforms like MLflow and Weights & Biases. It uses the `to_mlflow()` and `to_wandb()` methods of the report object, specifying an experiment name. ```Python mlflow_result = report.to_mlflow(experiment_name="data_analysis") wandb_result = report.to_wandb(experiment_name="data_analysis") ``` -------------------------------- ### Embed Association Graphs Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/sweetviz/templates/dataframe_page.html Embeds base64 encoded PNG images for association graphs (source and compare) into CSS pseudo-elements. This is done conditionally if association data exists. ```CSS {% if dataframe._associations is not none: %} span.association-graph-source::before { content: url(data:image/png;base64,{{ dataframe._association_graphs.all.graph_base64.decode('ascii') }}); } {% endif %} {% if dataframe._associations_compare is not none: %} span.association-graph-compare::before { content: url(data:image/png;base64,{{ dataframe._association_graphs_compare.all.graph_base64.decode('ascii') }}); } {% endif %} ``` -------------------------------- ### Render Vertical Association HTML Source: https://github.com/pedrodicati/sweetviz-v2/blob/master/sweetviz/templates/dataframe_page.html Conditionally renders the HTML source and comparison for association graphs when the page layout is set to 'vertical'. ```HTML {% if dataframe.page_layout == 'vertical': %} {% if dataframe.associations_html_source is not none: %} {{ dataframe.associations_html_source }} {% endif %} {% if dataframe.associations_html_compare is not none: %} {{ dataframe.associations_html_compare }} {% endif %} {% endif %} ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.