snowpark-connect 0.20.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of snowpark-connect might be problematic. Click here for more details.
- snowflake/snowpark_connect/__init__.py +23 -0
- snowflake/snowpark_connect/analyze_plan/__init__.py +3 -0
- snowflake/snowpark_connect/analyze_plan/map_tree_string.py +38 -0
- snowflake/snowpark_connect/column_name_handler.py +735 -0
- snowflake/snowpark_connect/config.py +576 -0
- snowflake/snowpark_connect/constants.py +47 -0
- snowflake/snowpark_connect/control_server.py +52 -0
- snowflake/snowpark_connect/dataframe_name_handler.py +54 -0
- snowflake/snowpark_connect/date_time_format_mapping.py +399 -0
- snowflake/snowpark_connect/empty_dataframe.py +18 -0
- snowflake/snowpark_connect/error/__init__.py +11 -0
- snowflake/snowpark_connect/error/error_mapping.py +6174 -0
- snowflake/snowpark_connect/error/error_utils.py +321 -0
- snowflake/snowpark_connect/error/exceptions.py +24 -0
- snowflake/snowpark_connect/execute_plan/__init__.py +3 -0
- snowflake/snowpark_connect/execute_plan/map_execution_command.py +204 -0
- snowflake/snowpark_connect/execute_plan/map_execution_root.py +173 -0
- snowflake/snowpark_connect/execute_plan/utils.py +183 -0
- snowflake/snowpark_connect/expression/__init__.py +3 -0
- snowflake/snowpark_connect/expression/literal.py +90 -0
- snowflake/snowpark_connect/expression/map_cast.py +343 -0
- snowflake/snowpark_connect/expression/map_expression.py +293 -0
- snowflake/snowpark_connect/expression/map_extension.py +104 -0
- snowflake/snowpark_connect/expression/map_sql_expression.py +633 -0
- snowflake/snowpark_connect/expression/map_udf.py +142 -0
- snowflake/snowpark_connect/expression/map_unresolved_attribute.py +241 -0
- snowflake/snowpark_connect/expression/map_unresolved_extract_value.py +85 -0
- snowflake/snowpark_connect/expression/map_unresolved_function.py +9450 -0
- snowflake/snowpark_connect/expression/map_unresolved_star.py +218 -0
- snowflake/snowpark_connect/expression/map_update_fields.py +164 -0
- snowflake/snowpark_connect/expression/map_window_function.py +258 -0
- snowflake/snowpark_connect/expression/typer.py +125 -0
- snowflake/snowpark_connect/includes/__init__.py +0 -0
- snowflake/snowpark_connect/includes/jars/antlr4-runtime-4.9.3.jar +0 -0
- snowflake/snowpark_connect/includes/jars/commons-cli-1.5.0.jar +0 -0
- snowflake/snowpark_connect/includes/jars/commons-codec-1.16.1.jar +0 -0
- snowflake/snowpark_connect/includes/jars/commons-collections-3.2.2.jar +0 -0
- snowflake/snowpark_connect/includes/jars/commons-collections4-4.4.jar +0 -0
- snowflake/snowpark_connect/includes/jars/commons-compiler-3.1.9.jar +0 -0
- snowflake/snowpark_connect/includes/jars/commons-compress-1.26.0.jar +0 -0
- snowflake/snowpark_connect/includes/jars/commons-crypto-1.1.0.jar +0 -0
- snowflake/snowpark_connect/includes/jars/commons-dbcp-1.4.jar +0 -0
- snowflake/snowpark_connect/includes/jars/commons-io-2.16.1.jar +0 -0
- snowflake/snowpark_connect/includes/jars/commons-lang-2.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/commons-lang3-3.12.0.jar +0 -0
- snowflake/snowpark_connect/includes/jars/commons-logging-1.1.3.jar +0 -0
- snowflake/snowpark_connect/includes/jars/commons-math3-3.6.1.jar +0 -0
- snowflake/snowpark_connect/includes/jars/commons-pool-1.5.4.jar +0 -0
- snowflake/snowpark_connect/includes/jars/commons-text-1.10.0.jar +0 -0
- snowflake/snowpark_connect/includes/jars/hadoop-client-api-3.3.4.jar +0 -0
- snowflake/snowpark_connect/includes/jars/jackson-annotations-2.15.2.jar +0 -0
- snowflake/snowpark_connect/includes/jars/jackson-core-2.15.2.jar +0 -0
- snowflake/snowpark_connect/includes/jars/jackson-core-asl-1.9.13.jar +0 -0
- snowflake/snowpark_connect/includes/jars/jackson-databind-2.15.2.jar +0 -0
- snowflake/snowpark_connect/includes/jars/jackson-dataformat-yaml-2.15.2.jar +0 -0
- snowflake/snowpark_connect/includes/jars/jackson-datatype-jsr310-2.15.2.jar +0 -0
- snowflake/snowpark_connect/includes/jars/jackson-mapper-asl-1.9.13.jar +0 -0
- snowflake/snowpark_connect/includes/jars/jackson-module-scala_2.12-2.15.2.jar +0 -0
- snowflake/snowpark_connect/includes/jars/json4s-ast_2.12-3.7.0-M11.jar +0 -0
- snowflake/snowpark_connect/includes/jars/json4s-core_2.12-3.7.0-M11.jar +0 -0
- snowflake/snowpark_connect/includes/jars/json4s-jackson_2.12-3.7.0-M11.jar +0 -0
- snowflake/snowpark_connect/includes/jars/json4s-scalap_2.12-3.7.0-M11.jar +0 -0
- snowflake/snowpark_connect/includes/jars/kryo-shaded-4.0.2.jar +0 -0
- snowflake/snowpark_connect/includes/jars/log4j-1.2-api-2.20.0.jar +0 -0
- snowflake/snowpark_connect/includes/jars/log4j-api-2.20.0.jar +0 -0
- snowflake/snowpark_connect/includes/jars/log4j-core-2.20.0.jar +0 -0
- snowflake/snowpark_connect/includes/jars/log4j-slf4j2-impl-2.20.0.jar +0 -0
- snowflake/snowpark_connect/includes/jars/paranamer-2.8.jar +0 -0
- snowflake/snowpark_connect/includes/jars/scala-collection-compat_2.12-2.7.0.jar +0 -0
- snowflake/snowpark_connect/includes/jars/scala-compiler-2.12.18.jar +0 -0
- snowflake/snowpark_connect/includes/jars/scala-library-2.12.18.jar +0 -0
- snowflake/snowpark_connect/includes/jars/scala-parser-combinators_2.12-2.3.0.jar +0 -0
- snowflake/snowpark_connect/includes/jars/scala-reflect-2.12.18.jar +0 -0
- snowflake/snowpark_connect/includes/jars/scala-xml_2.12-2.1.0.jar +0 -0
- snowflake/snowpark_connect/includes/jars/slf4j-api-2.0.7.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-catalyst_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-common-utils_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-core_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-graphx_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-hive-thriftserver_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-hive_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-kubernetes_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-kvstore_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-launcher_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-mesos_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-mllib-local_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-mllib_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-network-common_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-network-shuffle_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-repl_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-sketch_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-sql-api_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-sql_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-streaming_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-tags_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-unsafe_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/jars/spark-yarn_2.12-3.5.6.jar +0 -0
- snowflake/snowpark_connect/includes/python/__init__.py +21 -0
- snowflake/snowpark_connect/includes/python/pyspark/__init__.py +173 -0
- snowflake/snowpark_connect/includes/python/pyspark/_globals.py +71 -0
- snowflake/snowpark_connect/includes/python/pyspark/_typing.pyi +43 -0
- snowflake/snowpark_connect/includes/python/pyspark/accumulators.py +341 -0
- snowflake/snowpark_connect/includes/python/pyspark/broadcast.py +383 -0
- snowflake/snowpark_connect/includes/python/pyspark/cloudpickle/__init__.py +8 -0
- snowflake/snowpark_connect/includes/python/pyspark/cloudpickle/cloudpickle.py +948 -0
- snowflake/snowpark_connect/includes/python/pyspark/cloudpickle/cloudpickle_fast.py +844 -0
- snowflake/snowpark_connect/includes/python/pyspark/cloudpickle/compat.py +18 -0
- snowflake/snowpark_connect/includes/python/pyspark/conf.py +276 -0
- snowflake/snowpark_connect/includes/python/pyspark/context.py +2601 -0
- snowflake/snowpark_connect/includes/python/pyspark/daemon.py +218 -0
- snowflake/snowpark_connect/includes/python/pyspark/errors/__init__.py +70 -0
- snowflake/snowpark_connect/includes/python/pyspark/errors/error_classes.py +889 -0
- snowflake/snowpark_connect/includes/python/pyspark/errors/exceptions/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/errors/exceptions/base.py +228 -0
- snowflake/snowpark_connect/includes/python/pyspark/errors/exceptions/captured.py +307 -0
- snowflake/snowpark_connect/includes/python/pyspark/errors/exceptions/connect.py +190 -0
- snowflake/snowpark_connect/includes/python/pyspark/errors/tests/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/errors/tests/test_errors.py +60 -0
- snowflake/snowpark_connect/includes/python/pyspark/errors/utils.py +116 -0
- snowflake/snowpark_connect/includes/python/pyspark/files.py +165 -0
- snowflake/snowpark_connect/includes/python/pyspark/find_spark_home.py +95 -0
- snowflake/snowpark_connect/includes/python/pyspark/install.py +203 -0
- snowflake/snowpark_connect/includes/python/pyspark/instrumentation_utils.py +190 -0
- snowflake/snowpark_connect/includes/python/pyspark/java_gateway.py +248 -0
- snowflake/snowpark_connect/includes/python/pyspark/join.py +118 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/__init__.py +71 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/_typing.pyi +84 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/base.py +414 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/classification.py +4332 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/clustering.py +2188 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/common.py +146 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/connect/__init__.py +44 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/connect/base.py +346 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/connect/classification.py +382 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/connect/evaluation.py +291 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/connect/feature.py +258 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/connect/functions.py +77 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/connect/io_utils.py +335 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/connect/pipeline.py +262 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/connect/summarizer.py +120 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/connect/tuning.py +579 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/connect/util.py +173 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/deepspeed/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/deepspeed/deepspeed_distributor.py +165 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/deepspeed/tests/test_deepspeed_distributor.py +306 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/dl_util.py +150 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/evaluation.py +1166 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/feature.py +7474 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/fpm.py +543 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/functions.py +842 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/image.py +271 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/linalg/__init__.py +1382 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/model_cache.py +55 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/param/__init__.py +602 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/param/_shared_params_code_gen.py +368 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/param/shared.py +878 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/pipeline.py +451 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/recommendation.py +748 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/regression.py +3335 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/stat.py +523 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_connect_classification.py +53 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_connect_evaluation.py +50 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_connect_feature.py +43 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_connect_function.py +114 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_connect_pipeline.py +47 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_connect_summarizer.py +43 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_connect_tuning.py +46 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_legacy_mode_classification.py +238 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_legacy_mode_evaluation.py +194 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_legacy_mode_feature.py +156 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_legacy_mode_pipeline.py +184 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_legacy_mode_summarizer.py +78 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_legacy_mode_tuning.py +292 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_parity_torch_data_loader.py +50 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/connect/test_parity_torch_distributor.py +152 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_algorithms.py +456 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_base.py +96 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_dl_util.py +186 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_evaluation.py +77 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_feature.py +401 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_functions.py +528 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_image.py +82 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_linalg.py +409 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_model_cache.py +55 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_param.py +441 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_persistence.py +546 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_pipeline.py +71 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_stat.py +52 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_training_summary.py +494 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_util.py +85 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/test_wrapper.py +138 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/tuning/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/tuning/test_cv_io_basic.py +151 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/tuning/test_cv_io_nested.py +97 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/tuning/test_cv_io_pipeline.py +143 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/tuning/test_tuning.py +551 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/tuning/test_tvs_io_basic.py +137 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/tuning/test_tvs_io_nested.py +96 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tests/tuning/test_tvs_io_pipeline.py +142 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/torch/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/torch/data.py +100 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/torch/distributor.py +1133 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/torch/log_communication.py +198 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/torch/tests/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/torch/tests/test_data_loader.py +137 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/torch/tests/test_distributor.py +561 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/torch/tests/test_log_communication.py +172 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/torch/torch_run_process_wrapper.py +83 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tree.py +434 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/tuning.py +1741 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/util.py +749 -0
- snowflake/snowpark_connect/includes/python/pyspark/ml/wrapper.py +465 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/__init__.py +44 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/_typing.pyi +33 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/classification.py +989 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/clustering.py +1318 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/common.py +174 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/evaluation.py +691 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/feature.py +1085 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/fpm.py +233 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/linalg/__init__.py +1653 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/linalg/distributed.py +1662 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/random.py +698 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/recommendation.py +389 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/regression.py +1067 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/stat/KernelDensity.py +59 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/stat/__init__.py +34 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/stat/_statistics.py +409 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/stat/distribution.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/stat/test.py +86 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/tests/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/tests/test_algorithms.py +353 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/tests/test_feature.py +192 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/tests/test_linalg.py +680 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/tests/test_stat.py +206 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/tests/test_streaming_algorithms.py +471 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/tests/test_util.py +108 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/tree.py +888 -0
- snowflake/snowpark_connect/includes/python/pyspark/mllib/util.py +659 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/__init__.py +165 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/_typing.py +52 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/accessors.py +989 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/base.py +1804 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/categorical.py +822 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/config.py +539 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/correlation.py +262 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/data_type_ops/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/data_type_ops/base.py +519 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/data_type_ops/binary_ops.py +98 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/data_type_ops/boolean_ops.py +426 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/data_type_ops/categorical_ops.py +141 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/data_type_ops/complex_ops.py +145 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/data_type_ops/date_ops.py +127 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/data_type_ops/datetime_ops.py +171 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/data_type_ops/null_ops.py +83 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/data_type_ops/num_ops.py +588 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/data_type_ops/string_ops.py +154 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/data_type_ops/timedelta_ops.py +101 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/data_type_ops/udt_ops.py +29 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/datetimes.py +891 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/exceptions.py +150 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/extensions.py +388 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/frame.py +13738 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/generic.py +3560 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/groupby.py +4448 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/indexes/__init__.py +21 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/indexes/base.py +2783 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/indexes/category.py +773 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/indexes/datetimes.py +843 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/indexes/multi.py +1323 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/indexes/numeric.py +210 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/indexes/timedelta.py +197 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/indexing.py +1862 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/internal.py +1680 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/missing/__init__.py +48 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/missing/common.py +76 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/missing/frame.py +63 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/missing/general_functions.py +43 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/missing/groupby.py +93 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/missing/indexes.py +184 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/missing/resample.py +101 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/missing/scalars.py +29 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/missing/series.py +69 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/missing/window.py +168 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/mlflow.py +238 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/namespace.py +3807 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/numpy_compat.py +260 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/plot/__init__.py +17 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/plot/core.py +1213 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/plot/matplotlib.py +928 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/plot/plotly.py +261 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/resample.py +816 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/series.py +7440 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/sql_formatter.py +308 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/sql_processor.py +394 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/strings.py +2371 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/supported_api_gen.py +378 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_any_all.py +177 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_apply_func.py +575 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_binary_ops.py +235 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_combine.py +653 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_compute.py +463 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_corrwith.py +86 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_cov.py +151 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_cumulative.py +139 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_describe.py +458 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_eval.py +86 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_melt.py +202 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_missing_data.py +520 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/computation/test_pivot.py +361 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_any_all.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_apply_func.py +42 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_binary_ops.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_combine.py +37 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_compute.py +60 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_corrwith.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_cov.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_cumulative.py +90 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_describe.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_eval.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_melt.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_missing_data.py +42 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/computation/test_parity_pivot.py +37 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_base.py +36 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_binary_ops.py +42 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_boolean_ops.py +47 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_categorical_ops.py +55 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_complex_ops.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_date_ops.py +47 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_datetime_ops.py +47 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_null_ops.py +42 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_num_arithmetic.py +43 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_num_ops.py +47 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_num_reverse.py +43 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_string_ops.py +47 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_timedelta_ops.py +47 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/test_parity_udt_ops.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/data_type_ops/testing_utils.py +226 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/diff_frames_ops/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/diff_frames_ops/test_parity_align.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/diff_frames_ops/test_parity_basic_slow.py +55 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/diff_frames_ops/test_parity_cov_corrwith.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/diff_frames_ops/test_parity_dot_frame.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/diff_frames_ops/test_parity_dot_series.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/diff_frames_ops/test_parity_index.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/diff_frames_ops/test_parity_series.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/diff_frames_ops/test_parity_setitem_frame.py +43 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/diff_frames_ops/test_parity_setitem_series.py +43 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/frame/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/frame/test_parity_attrs.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/frame/test_parity_constructor.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/frame/test_parity_conversion.py +42 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/frame/test_parity_reindexing.py +42 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/frame/test_parity_reshaping.py +37 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/frame/test_parity_spark.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/frame/test_parity_take.py +42 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/frame/test_parity_time_series.py +48 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/frame/test_parity_truncate.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/groupby/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/groupby/test_parity_aggregate.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/groupby/test_parity_apply_func.py +41 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/groupby/test_parity_cumulative.py +67 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/groupby/test_parity_describe.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/groupby/test_parity_groupby.py +55 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/groupby/test_parity_head_tail.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/groupby/test_parity_index.py +38 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/groupby/test_parity_missing_data.py +55 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/groupby/test_parity_split_apply.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/groupby/test_parity_stat.py +38 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/indexes/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/indexes/test_parity_align.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/indexes/test_parity_base.py +50 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/indexes/test_parity_category.py +73 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/indexes/test_parity_datetime.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/indexes/test_parity_indexing.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/indexes/test_parity_reindex.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/indexes/test_parity_rename.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/indexes/test_parity_reset_index.py +48 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/indexes/test_parity_timedelta.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/io/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/io/test_parity_io.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/plot/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/plot/test_parity_frame_plot.py +45 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/plot/test_parity_frame_plot_matplotlib.py +45 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/plot/test_parity_frame_plot_plotly.py +49 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/plot/test_parity_series_plot.py +37 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/plot/test_parity_series_plot_matplotlib.py +53 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/plot/test_parity_series_plot_plotly.py +45 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/test_parity_all_any.py +38 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/test_parity_arg_ops.py +37 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/test_parity_as_of.py +37 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/test_parity_as_type.py +38 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/test_parity_compute.py +37 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/test_parity_conversion.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/test_parity_cumulative.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/test_parity_index.py +38 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/test_parity_missing_data.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/test_parity_series.py +37 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/test_parity_sort.py +38 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/series/test_parity_stat.py +38 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_categorical.py +66 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_config.py +37 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_csv.py +37 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_dataframe_conversion.py +42 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_dataframe_spark_io.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_default_index.py +49 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_ewm.py +37 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_expanding.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_extension.py +49 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_frame_spark.py +53 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_generic_functions.py +43 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_indexing.py +49 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_indexops_spark.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_internal.py +41 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_namespace.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_numpy_compat.py +60 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_ops_on_diff_frames.py +48 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_ops_on_diff_frames_groupby.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_ops_on_diff_frames_groupby_expanding.py +44 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_ops_on_diff_frames_groupby_rolling.py +84 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_repr.py +37 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_resample.py +45 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_reshape.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_rolling.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_scalars.py +37 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_series_conversion.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_series_datetime.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_series_string.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_spark_functions.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_sql.py +43 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_stats.py +37 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_typedef.py +36 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_utils.py +37 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/connect/test_parity_window.py +39 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_base.py +107 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_binary_ops.py +224 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_boolean_ops.py +825 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_categorical_ops.py +562 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_complex_ops.py +368 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_date_ops.py +257 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_datetime_ops.py +260 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_null_ops.py +178 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_num_arithmetic.py +184 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_num_ops.py +497 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_num_reverse.py +140 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_string_ops.py +354 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_timedelta_ops.py +219 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/test_udt_ops.py +192 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/data_type_ops/testing_utils.py +228 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/diff_frames_ops/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/diff_frames_ops/test_align.py +118 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/diff_frames_ops/test_basic_slow.py +198 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/diff_frames_ops/test_cov_corrwith.py +181 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/diff_frames_ops/test_dot_frame.py +103 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/diff_frames_ops/test_dot_series.py +141 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/diff_frames_ops/test_index.py +109 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/diff_frames_ops/test_series.py +136 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/diff_frames_ops/test_setitem_frame.py +125 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/diff_frames_ops/test_setitem_series.py +217 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/frame/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/frame/test_attrs.py +384 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/frame/test_constructor.py +598 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/frame/test_conversion.py +73 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/frame/test_reindexing.py +869 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/frame/test_reshaping.py +487 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/frame/test_spark.py +309 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/frame/test_take.py +156 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/frame/test_time_series.py +149 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/frame/test_truncate.py +163 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/groupby/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/groupby/test_aggregate.py +311 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/groupby/test_apply_func.py +524 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/groupby/test_cumulative.py +419 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/groupby/test_describe.py +144 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/groupby/test_groupby.py +979 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/groupby/test_head_tail.py +234 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/groupby/test_index.py +206 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/groupby/test_missing_data.py +421 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/groupby/test_split_apply.py +187 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/groupby/test_stat.py +397 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/indexes/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/indexes/test_align.py +100 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/indexes/test_base.py +2743 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/indexes/test_category.py +484 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/indexes/test_datetime.py +276 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/indexes/test_indexing.py +432 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/indexes/test_reindex.py +310 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/indexes/test_rename.py +257 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/indexes/test_reset_index.py +160 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/indexes/test_timedelta.py +128 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/io/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/io/test_io.py +137 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/plot/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/plot/test_frame_plot.py +170 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/plot/test_frame_plot_matplotlib.py +547 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/plot/test_frame_plot_plotly.py +285 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/plot/test_series_plot.py +106 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/plot/test_series_plot_matplotlib.py +409 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/plot/test_series_plot_plotly.py +247 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/test_all_any.py +105 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/test_arg_ops.py +197 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/test_as_of.py +137 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/test_as_type.py +227 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/test_compute.py +634 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/test_conversion.py +88 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/test_cumulative.py +139 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/test_index.py +475 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/test_missing_data.py +265 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/test_series.py +818 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/test_sort.py +162 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/series/test_stat.py +780 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_categorical.py +741 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_config.py +160 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_csv.py +453 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_dataframe_conversion.py +281 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_dataframe_spark_io.py +487 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_default_index.py +109 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_ewm.py +434 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_expanding.py +253 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_extension.py +152 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_frame_spark.py +162 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_generic_functions.py +234 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_indexing.py +1339 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_indexops_spark.py +82 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_internal.py +124 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_namespace.py +638 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_numpy_compat.py +200 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_ops_on_diff_frames.py +1355 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_ops_on_diff_frames_groupby.py +655 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_ops_on_diff_frames_groupby_expanding.py +113 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_ops_on_diff_frames_groupby_rolling.py +118 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_repr.py +192 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_resample.py +346 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_reshape.py +495 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_rolling.py +263 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_scalars.py +59 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_series_conversion.py +85 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_series_datetime.py +364 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_series_string.py +362 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_spark_functions.py +46 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_sql.py +123 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_stats.py +581 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_typedef.py +447 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_utils.py +301 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/tests/test_window.py +465 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/typedef/__init__.py +18 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/typedef/typehints.py +874 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/usage_logging/__init__.py +143 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/usage_logging/usage_logger.py +132 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/utils.py +1063 -0
- snowflake/snowpark_connect/includes/python/pyspark/pandas/window.py +2702 -0
- snowflake/snowpark_connect/includes/python/pyspark/profiler.py +489 -0
- snowflake/snowpark_connect/includes/python/pyspark/py.typed +1 -0
- snowflake/snowpark_connect/includes/python/pyspark/python/pyspark/shell.py +123 -0
- snowflake/snowpark_connect/includes/python/pyspark/rdd.py +5518 -0
- snowflake/snowpark_connect/includes/python/pyspark/rddsampler.py +115 -0
- snowflake/snowpark_connect/includes/python/pyspark/resource/__init__.py +38 -0
- snowflake/snowpark_connect/includes/python/pyspark/resource/information.py +69 -0
- snowflake/snowpark_connect/includes/python/pyspark/resource/profile.py +317 -0
- snowflake/snowpark_connect/includes/python/pyspark/resource/requests.py +539 -0
- snowflake/snowpark_connect/includes/python/pyspark/resource/tests/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/resource/tests/test_resources.py +83 -0
- snowflake/snowpark_connect/includes/python/pyspark/resultiterable.py +45 -0
- snowflake/snowpark_connect/includes/python/pyspark/serializers.py +681 -0
- snowflake/snowpark_connect/includes/python/pyspark/shell.py +123 -0
- snowflake/snowpark_connect/includes/python/pyspark/shuffle.py +854 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/__init__.py +75 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/_typing.pyi +80 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/avro/__init__.py +18 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/avro/functions.py +188 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/catalog.py +1270 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/column.py +1431 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/conf.py +99 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/__init__.py +18 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/_typing.py +90 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/avro/__init__.py +18 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/avro/functions.py +107 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/catalog.py +356 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/client/__init__.py +22 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/client/artifact.py +412 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/client/core.py +1689 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/client/reattach.py +340 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/column.py +514 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/conf.py +128 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/conversion.py +490 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/dataframe.py +2172 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/expressions.py +1056 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/functions.py +3937 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/group.py +418 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/plan.py +2289 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/proto/__init__.py +25 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/proto/base_pb2.py +203 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/proto/base_pb2.pyi +2718 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/proto/base_pb2_grpc.py +423 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/proto/catalog_pb2.py +109 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/proto/catalog_pb2.pyi +1130 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/proto/commands_pb2.py +141 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/proto/commands_pb2.pyi +1766 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/proto/common_pb2.py +47 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/proto/common_pb2.pyi +123 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/proto/example_plugins_pb2.py +53 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/proto/example_plugins_pb2.pyi +112 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/proto/expressions_pb2.py +107 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/proto/expressions_pb2.pyi +1507 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/proto/relations_pb2.py +195 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/proto/relations_pb2.pyi +3613 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/proto/types_pb2.py +95 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/proto/types_pb2.pyi +980 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/protobuf/__init__.py +18 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/protobuf/functions.py +166 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/readwriter.py +861 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/session.py +952 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/streaming/__init__.py +22 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/streaming/query.py +295 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/streaming/readwriter.py +618 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/streaming/worker/__init__.py +18 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/streaming/worker/foreach_batch_worker.py +87 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/streaming/worker/listener_worker.py +100 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/types.py +301 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/udf.py +296 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/udtf.py +200 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/utils.py +58 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/connect/window.py +266 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/context.py +818 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/dataframe.py +5973 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/functions.py +15889 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/group.py +547 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/observation.py +152 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/pandas/__init__.py +21 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/pandas/_typing/__init__.pyi +344 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/pandas/_typing/protocols/__init__.pyi +17 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/pandas/_typing/protocols/frame.pyi +20 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/pandas/_typing/protocols/series.pyi +20 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/pandas/conversion.py +671 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/pandas/functions.py +480 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/pandas/functions.pyi +132 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/pandas/group_ops.py +523 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/pandas/map_ops.py +216 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/pandas/serializers.py +1019 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/pandas/typehints.py +172 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/pandas/types.py +972 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/pandas/utils.py +86 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/protobuf/__init__.py +18 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/protobuf/functions.py +334 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/readwriter.py +2159 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/session.py +2088 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/sql_formatter.py +84 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/streaming/__init__.py +21 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/streaming/listener.py +1050 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/streaming/query.py +746 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/streaming/readwriter.py +1652 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/streaming/state.py +288 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/client/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/client/test_artifact.py +420 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/client/test_client.py +358 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/streaming/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/streaming/test_parity_foreach.py +36 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/streaming/test_parity_foreach_batch.py +44 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/streaming/test_parity_listener.py +116 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/streaming/test_parity_streaming.py +35 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_connect_basic.py +3612 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_connect_column.py +1042 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_connect_function.py +2381 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_connect_plan.py +1060 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_arrow.py +163 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_arrow_map.py +38 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_arrow_python_udf.py +48 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_catalog.py +36 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_column.py +55 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_conf.py +36 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_dataframe.py +96 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_datasources.py +44 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_errors.py +36 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_functions.py +59 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_group.py +36 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_pandas_cogrouped_map.py +59 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_pandas_grouped_map.py +74 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_pandas_grouped_map_with_state.py +62 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_pandas_map.py +58 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_pandas_udf.py +70 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_pandas_udf_grouped_agg.py +50 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_pandas_udf_scalar.py +68 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_pandas_udf_window.py +40 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_readwriter.py +46 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_serde.py +44 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_types.py +100 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_udf.py +100 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_parity_udtf.py +163 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_session.py +181 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/connect/test_utils.py +42 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/pandas/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/pandas/test_pandas_cogrouped_map.py +623 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/pandas/test_pandas_grouped_map.py +869 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/pandas/test_pandas_grouped_map_with_state.py +342 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/pandas/test_pandas_map.py +436 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/pandas/test_pandas_udf.py +363 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/pandas/test_pandas_udf_grouped_agg.py +592 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/pandas/test_pandas_udf_scalar.py +1503 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/pandas/test_pandas_udf_typehints.py +392 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/pandas/test_pandas_udf_typehints_with_future_annotations.py +375 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/pandas/test_pandas_udf_window.py +411 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/streaming/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/streaming/test_streaming.py +401 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/streaming/test_streaming_foreach.py +295 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/streaming/test_streaming_foreach_batch.py +106 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/streaming/test_streaming_listener.py +558 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_arrow.py +1346 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_arrow_map.py +182 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_arrow_python_udf.py +202 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_catalog.py +503 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_column.py +225 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_conf.py +83 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_context.py +201 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_dataframe.py +1931 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_datasources.py +256 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_errors.py +69 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_functions.py +1349 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_group.py +53 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_pandas_sqlmetrics.py +68 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_readwriter.py +283 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_serde.py +155 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_session.py +412 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_types.py +1581 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_udf.py +961 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_udf_profiler.py +165 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_udtf.py +1456 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/tests/test_utils.py +1686 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/types.py +2558 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/udf.py +714 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/udtf.py +325 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/utils.py +339 -0
- snowflake/snowpark_connect/includes/python/pyspark/sql/window.py +492 -0
- snowflake/snowpark_connect/includes/python/pyspark/statcounter.py +165 -0
- snowflake/snowpark_connect/includes/python/pyspark/status.py +112 -0
- snowflake/snowpark_connect/includes/python/pyspark/storagelevel.py +97 -0
- snowflake/snowpark_connect/includes/python/pyspark/streaming/__init__.py +22 -0
- snowflake/snowpark_connect/includes/python/pyspark/streaming/context.py +471 -0
- snowflake/snowpark_connect/includes/python/pyspark/streaming/dstream.py +933 -0
- snowflake/snowpark_connect/includes/python/pyspark/streaming/kinesis.py +205 -0
- snowflake/snowpark_connect/includes/python/pyspark/streaming/listener.py +83 -0
- snowflake/snowpark_connect/includes/python/pyspark/streaming/tests/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/streaming/tests/test_context.py +184 -0
- snowflake/snowpark_connect/includes/python/pyspark/streaming/tests/test_dstream.py +706 -0
- snowflake/snowpark_connect/includes/python/pyspark/streaming/tests/test_kinesis.py +118 -0
- snowflake/snowpark_connect/includes/python/pyspark/streaming/tests/test_listener.py +160 -0
- snowflake/snowpark_connect/includes/python/pyspark/streaming/util.py +168 -0
- snowflake/snowpark_connect/includes/python/pyspark/taskcontext.py +502 -0
- snowflake/snowpark_connect/includes/python/pyspark/testing/__init__.py +21 -0
- snowflake/snowpark_connect/includes/python/pyspark/testing/connectutils.py +199 -0
- snowflake/snowpark_connect/includes/python/pyspark/testing/mllibutils.py +30 -0
- snowflake/snowpark_connect/includes/python/pyspark/testing/mlutils.py +275 -0
- snowflake/snowpark_connect/includes/python/pyspark/testing/objects.py +121 -0
- snowflake/snowpark_connect/includes/python/pyspark/testing/pandasutils.py +714 -0
- snowflake/snowpark_connect/includes/python/pyspark/testing/sqlutils.py +168 -0
- snowflake/snowpark_connect/includes/python/pyspark/testing/streamingutils.py +178 -0
- snowflake/snowpark_connect/includes/python/pyspark/testing/utils.py +636 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/__init__.py +16 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_appsubmit.py +306 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_broadcast.py +196 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_conf.py +44 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_context.py +346 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_daemon.py +89 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_install_spark.py +124 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_join.py +69 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_memory_profiler.py +167 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_pin_thread.py +194 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_profiler.py +168 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_rdd.py +939 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_rddbarrier.py +52 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_rddsampler.py +66 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_readwrite.py +368 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_serializers.py +257 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_shuffle.py +267 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_stage_sched.py +153 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_statcounter.py +130 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_taskcontext.py +350 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_util.py +97 -0
- snowflake/snowpark_connect/includes/python/pyspark/tests/test_worker.py +271 -0
- snowflake/snowpark_connect/includes/python/pyspark/traceback_utils.py +81 -0
- snowflake/snowpark_connect/includes/python/pyspark/util.py +416 -0
- snowflake/snowpark_connect/includes/python/pyspark/version.py +19 -0
- snowflake/snowpark_connect/includes/python/pyspark/worker.py +1307 -0
- snowflake/snowpark_connect/includes/python/pyspark/worker_util.py +46 -0
- snowflake/snowpark_connect/proto/__init__.py +10 -0
- snowflake/snowpark_connect/proto/control_pb2.py +35 -0
- snowflake/snowpark_connect/proto/control_pb2.pyi +38 -0
- snowflake/snowpark_connect/proto/control_pb2_grpc.py +183 -0
- snowflake/snowpark_connect/proto/snowflake_expression_ext_pb2.py +35 -0
- snowflake/snowpark_connect/proto/snowflake_expression_ext_pb2.pyi +53 -0
- snowflake/snowpark_connect/proto/snowflake_rdd_pb2.pyi +39 -0
- snowflake/snowpark_connect/proto/snowflake_relation_ext_pb2.py +47 -0
- snowflake/snowpark_connect/proto/snowflake_relation_ext_pb2.pyi +111 -0
- snowflake/snowpark_connect/relation/__init__.py +3 -0
- snowflake/snowpark_connect/relation/catalogs/__init__.py +12 -0
- snowflake/snowpark_connect/relation/catalogs/abstract_spark_catalog.py +287 -0
- snowflake/snowpark_connect/relation/catalogs/snowflake_catalog.py +467 -0
- snowflake/snowpark_connect/relation/catalogs/utils.py +51 -0
- snowflake/snowpark_connect/relation/io_utils.py +76 -0
- snowflake/snowpark_connect/relation/map_aggregate.py +322 -0
- snowflake/snowpark_connect/relation/map_catalog.py +151 -0
- snowflake/snowpark_connect/relation/map_column_ops.py +1068 -0
- snowflake/snowpark_connect/relation/map_crosstab.py +48 -0
- snowflake/snowpark_connect/relation/map_extension.py +412 -0
- snowflake/snowpark_connect/relation/map_join.py +341 -0
- snowflake/snowpark_connect/relation/map_local_relation.py +326 -0
- snowflake/snowpark_connect/relation/map_map_partitions.py +146 -0
- snowflake/snowpark_connect/relation/map_relation.py +253 -0
- snowflake/snowpark_connect/relation/map_row_ops.py +716 -0
- snowflake/snowpark_connect/relation/map_sample_by.py +35 -0
- snowflake/snowpark_connect/relation/map_show_string.py +50 -0
- snowflake/snowpark_connect/relation/map_sql.py +1874 -0
- snowflake/snowpark_connect/relation/map_stats.py +324 -0
- snowflake/snowpark_connect/relation/map_subquery_alias.py +32 -0
- snowflake/snowpark_connect/relation/map_udtf.py +288 -0
- snowflake/snowpark_connect/relation/read/__init__.py +7 -0
- snowflake/snowpark_connect/relation/read/jdbc_read_dbapi.py +668 -0
- snowflake/snowpark_connect/relation/read/map_read.py +367 -0
- snowflake/snowpark_connect/relation/read/map_read_csv.py +142 -0
- snowflake/snowpark_connect/relation/read/map_read_jdbc.py +108 -0
- snowflake/snowpark_connect/relation/read/map_read_json.py +344 -0
- snowflake/snowpark_connect/relation/read/map_read_parquet.py +194 -0
- snowflake/snowpark_connect/relation/read/map_read_socket.py +59 -0
- snowflake/snowpark_connect/relation/read/map_read_table.py +109 -0
- snowflake/snowpark_connect/relation/read/map_read_text.py +106 -0
- snowflake/snowpark_connect/relation/read/reader_config.py +399 -0
- snowflake/snowpark_connect/relation/read/utils.py +155 -0
- snowflake/snowpark_connect/relation/stage_locator.py +161 -0
- snowflake/snowpark_connect/relation/utils.py +219 -0
- snowflake/snowpark_connect/relation/write/__init__.py +3 -0
- snowflake/snowpark_connect/relation/write/jdbc_write_dbapi.py +339 -0
- snowflake/snowpark_connect/relation/write/map_write.py +436 -0
- snowflake/snowpark_connect/relation/write/map_write_jdbc.py +48 -0
- snowflake/snowpark_connect/resources/java_udfs-1.0-SNAPSHOT.jar +0 -0
- snowflake/snowpark_connect/resources_initializer.py +75 -0
- snowflake/snowpark_connect/server.py +1136 -0
- snowflake/snowpark_connect/start_server.py +32 -0
- snowflake/snowpark_connect/tcm.py +8 -0
- snowflake/snowpark_connect/type_mapping.py +1003 -0
- snowflake/snowpark_connect/typed_column.py +94 -0
- snowflake/snowpark_connect/utils/__init__.py +3 -0
- snowflake/snowpark_connect/utils/artifacts.py +48 -0
- snowflake/snowpark_connect/utils/attribute_handling.py +72 -0
- snowflake/snowpark_connect/utils/cache.py +84 -0
- snowflake/snowpark_connect/utils/concurrent.py +124 -0
- snowflake/snowpark_connect/utils/context.py +390 -0
- snowflake/snowpark_connect/utils/describe_query_cache.py +231 -0
- snowflake/snowpark_connect/utils/interrupt.py +85 -0
- snowflake/snowpark_connect/utils/io_utils.py +35 -0
- snowflake/snowpark_connect/utils/pandas_udtf_utils.py +117 -0
- snowflake/snowpark_connect/utils/profiling.py +47 -0
- snowflake/snowpark_connect/utils/session.py +180 -0
- snowflake/snowpark_connect/utils/snowpark_connect_logging.py +38 -0
- snowflake/snowpark_connect/utils/telemetry.py +513 -0
- snowflake/snowpark_connect/utils/udf_cache.py +392 -0
- snowflake/snowpark_connect/utils/udf_helper.py +328 -0
- snowflake/snowpark_connect/utils/udf_utils.py +310 -0
- snowflake/snowpark_connect/utils/udtf_helper.py +420 -0
- snowflake/snowpark_connect/utils/udtf_utils.py +799 -0
- snowflake/snowpark_connect/utils/xxhash64.py +247 -0
- snowflake/snowpark_connect/version.py +6 -0
- snowpark_connect-0.20.2.data/scripts/snowpark-connect +71 -0
- snowpark_connect-0.20.2.data/scripts/snowpark-session +11 -0
- snowpark_connect-0.20.2.data/scripts/snowpark-submit +354 -0
- snowpark_connect-0.20.2.dist-info/METADATA +37 -0
- snowpark_connect-0.20.2.dist-info/RECORD +879 -0
- snowpark_connect-0.20.2.dist-info/WHEEL +5 -0
- snowpark_connect-0.20.2.dist-info/licenses/LICENSE.txt +202 -0
- snowpark_connect-0.20.2.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,1323 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
3
|
+
# contributor license agreements. See the NOTICE file distributed with
|
|
4
|
+
# this work for additional information regarding copyright ownership.
|
|
5
|
+
# The ASF licenses this file to You under the Apache License, Version 2.0
|
|
6
|
+
# (the "License"); you may not use this file except in compliance with
|
|
7
|
+
# the License. You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
#
|
|
17
|
+
|
|
18
|
+
from functools import partial, reduce
|
|
19
|
+
from typing import Any, Callable, Iterator, List, Optional, Tuple, Union, cast, no_type_check
|
|
20
|
+
|
|
21
|
+
import pandas as pd
|
|
22
|
+
from pandas.api.types import is_hashable, is_list_like # type: ignore[attr-defined]
|
|
23
|
+
|
|
24
|
+
from pyspark.sql import functions as F, Column as PySparkColumn, Window
|
|
25
|
+
from pyspark.sql.types import DataType
|
|
26
|
+
from pyspark.sql.utils import get_column_class
|
|
27
|
+
|
|
28
|
+
# For running doctests and reference resolution in PyCharm.
|
|
29
|
+
from pyspark import pandas as ps
|
|
30
|
+
from pyspark.pandas._typing import Label, Name, Scalar
|
|
31
|
+
from pyspark.pandas.exceptions import PandasNotImplementedError
|
|
32
|
+
from pyspark.pandas.frame import DataFrame
|
|
33
|
+
from pyspark.pandas.indexes.base import Index
|
|
34
|
+
from pyspark.pandas.missing.indexes import MissingPandasLikeMultiIndex
|
|
35
|
+
from pyspark.pandas.series import Series, first_series
|
|
36
|
+
from pyspark.pandas.utils import (
|
|
37
|
+
compare_disallow_null,
|
|
38
|
+
is_name_like_tuple,
|
|
39
|
+
name_like_string,
|
|
40
|
+
scol_for,
|
|
41
|
+
verify_temp_column_name,
|
|
42
|
+
validate_index_loc,
|
|
43
|
+
)
|
|
44
|
+
from pyspark.pandas.internal import (
|
|
45
|
+
InternalField,
|
|
46
|
+
InternalFrame,
|
|
47
|
+
NATURAL_ORDER_COLUMN_NAME,
|
|
48
|
+
SPARK_INDEX_NAME_FORMAT,
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class MultiIndex(Index):
|
|
53
|
+
"""
|
|
54
|
+
pandas-on-Spark MultiIndex that corresponds to pandas MultiIndex logically. This might hold
|
|
55
|
+
Spark Column internally.
|
|
56
|
+
|
|
57
|
+
Parameters
|
|
58
|
+
----------
|
|
59
|
+
levels : sequence of arrays
|
|
60
|
+
The unique labels for each level.
|
|
61
|
+
codes : sequence of arrays
|
|
62
|
+
Integers for each level designating which label at each location.
|
|
63
|
+
sortorder : optional int
|
|
64
|
+
Level of sortedness (must be lexicographically sorted by that
|
|
65
|
+
level).
|
|
66
|
+
names : optional sequence of objects
|
|
67
|
+
Names for each of the index levels. (name is accepted for compat).
|
|
68
|
+
copy : bool, default False
|
|
69
|
+
Copy the meta-data.
|
|
70
|
+
verify_integrity : bool, default True
|
|
71
|
+
Check that the levels/codes are consistent and valid.
|
|
72
|
+
|
|
73
|
+
See Also
|
|
74
|
+
--------
|
|
75
|
+
MultiIndex.from_arrays : Convert list of arrays to MultiIndex.
|
|
76
|
+
MultiIndex.from_product : Create a MultiIndex from the cartesian product
|
|
77
|
+
of iterables.
|
|
78
|
+
MultiIndex.from_tuples : Convert list of tuples to a MultiIndex.
|
|
79
|
+
MultiIndex.from_frame : Make a MultiIndex from a DataFrame.
|
|
80
|
+
Index : A single-level Index.
|
|
81
|
+
|
|
82
|
+
Examples
|
|
83
|
+
--------
|
|
84
|
+
>>> ps.DataFrame({'a': ['a', 'b', 'c']}, index=[[1, 2, 3], [4, 5, 6]]).index # doctest: +SKIP
|
|
85
|
+
MultiIndex([(1, 4),
|
|
86
|
+
(2, 5),
|
|
87
|
+
(3, 6)],
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
>>> ps.DataFrame({'a': [1, 2, 3]}, index=[list('abc'), list('def')]).index # doctest: +SKIP
|
|
91
|
+
MultiIndex([('a', 'd'),
|
|
92
|
+
('b', 'e'),
|
|
93
|
+
('c', 'f')],
|
|
94
|
+
)
|
|
95
|
+
"""
|
|
96
|
+
|
|
97
|
+
@no_type_check
|
|
98
|
+
def __new__(
|
|
99
|
+
cls,
|
|
100
|
+
levels=None,
|
|
101
|
+
codes=None,
|
|
102
|
+
sortorder=None,
|
|
103
|
+
names=None,
|
|
104
|
+
dtype=None,
|
|
105
|
+
copy=False,
|
|
106
|
+
name=None,
|
|
107
|
+
verify_integrity: bool = True,
|
|
108
|
+
) -> "MultiIndex":
|
|
109
|
+
pidx = pd.MultiIndex(
|
|
110
|
+
levels=levels,
|
|
111
|
+
codes=codes,
|
|
112
|
+
sortorder=sortorder,
|
|
113
|
+
names=names,
|
|
114
|
+
dtype=dtype,
|
|
115
|
+
copy=copy,
|
|
116
|
+
name=name,
|
|
117
|
+
verify_integrity=verify_integrity,
|
|
118
|
+
)
|
|
119
|
+
return ps.from_pandas(pidx)
|
|
120
|
+
|
|
121
|
+
@property
|
|
122
|
+
def _internal(self) -> InternalFrame:
|
|
123
|
+
internal = self._psdf._internal
|
|
124
|
+
scol = F.struct(*internal.index_spark_columns)
|
|
125
|
+
return internal.copy(
|
|
126
|
+
column_labels=[None],
|
|
127
|
+
data_spark_columns=[scol],
|
|
128
|
+
data_fields=[None],
|
|
129
|
+
column_label_names=None,
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
@property
|
|
133
|
+
def _column_label(self) -> Optional[Label]:
|
|
134
|
+
return None
|
|
135
|
+
|
|
136
|
+
def __abs__(self) -> "MultiIndex":
|
|
137
|
+
raise TypeError("TypeError: cannot perform __abs__ with this index type: MultiIndex")
|
|
138
|
+
|
|
139
|
+
def _with_new_scol(
|
|
140
|
+
self, scol: PySparkColumn, *, field: Optional[InternalField] = None
|
|
141
|
+
) -> "MultiIndex":
|
|
142
|
+
raise NotImplementedError("Not supported for type MultiIndex")
|
|
143
|
+
|
|
144
|
+
@no_type_check
|
|
145
|
+
def any(self, *args, **kwargs) -> None:
|
|
146
|
+
raise TypeError("cannot perform any with this index type: MultiIndex")
|
|
147
|
+
|
|
148
|
+
@no_type_check
|
|
149
|
+
def all(self, *args, **kwargs) -> None:
|
|
150
|
+
raise TypeError("cannot perform all with this index type: MultiIndex")
|
|
151
|
+
|
|
152
|
+
@staticmethod
|
|
153
|
+
def from_tuples(
|
|
154
|
+
tuples: List[Tuple],
|
|
155
|
+
sortorder: Optional[int] = None,
|
|
156
|
+
names: Optional[List[Name]] = None,
|
|
157
|
+
) -> "MultiIndex":
|
|
158
|
+
"""
|
|
159
|
+
Convert list of tuples to MultiIndex.
|
|
160
|
+
|
|
161
|
+
Parameters
|
|
162
|
+
----------
|
|
163
|
+
tuples : list / sequence of tuple-likes
|
|
164
|
+
Each tuple is the index of one row/column.
|
|
165
|
+
sortorder : int or None
|
|
166
|
+
Level of sortedness (must be lexicographically sorted by that level).
|
|
167
|
+
names : list / sequence of str, optional
|
|
168
|
+
Names for the levels in the index.
|
|
169
|
+
|
|
170
|
+
Returns
|
|
171
|
+
-------
|
|
172
|
+
index : MultiIndex
|
|
173
|
+
|
|
174
|
+
Examples
|
|
175
|
+
--------
|
|
176
|
+
|
|
177
|
+
>>> tuples = [(1, 'red'), (1, 'blue'),
|
|
178
|
+
... (2, 'red'), (2, 'blue')]
|
|
179
|
+
>>> ps.MultiIndex.from_tuples(tuples, names=('number', 'color')) # doctest: +SKIP
|
|
180
|
+
MultiIndex([(1, 'red'),
|
|
181
|
+
(1, 'blue'),
|
|
182
|
+
(2, 'red'),
|
|
183
|
+
(2, 'blue')],
|
|
184
|
+
names=['number', 'color'])
|
|
185
|
+
"""
|
|
186
|
+
return cast(
|
|
187
|
+
MultiIndex,
|
|
188
|
+
ps.from_pandas(
|
|
189
|
+
pd.MultiIndex.from_tuples(tuples=tuples, sortorder=sortorder, names=names)
|
|
190
|
+
),
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
@staticmethod
|
|
194
|
+
def from_arrays(
|
|
195
|
+
arrays: List[List],
|
|
196
|
+
sortorder: Optional[int] = None,
|
|
197
|
+
names: Optional[List[Name]] = None,
|
|
198
|
+
) -> "MultiIndex":
|
|
199
|
+
"""
|
|
200
|
+
Convert arrays to MultiIndex.
|
|
201
|
+
|
|
202
|
+
Parameters
|
|
203
|
+
----------
|
|
204
|
+
arrays: list / sequence of array-likes
|
|
205
|
+
Each array-like gives one level’s value for each data point. len(arrays)
|
|
206
|
+
is the number of levels.
|
|
207
|
+
sortorder: int or None
|
|
208
|
+
Level of sortedness (must be lexicographically sorted by that level).
|
|
209
|
+
names: list / sequence of str, optional
|
|
210
|
+
Names for the levels in the index.
|
|
211
|
+
|
|
212
|
+
Returns
|
|
213
|
+
-------
|
|
214
|
+
index: MultiIndex
|
|
215
|
+
|
|
216
|
+
Examples
|
|
217
|
+
--------
|
|
218
|
+
|
|
219
|
+
>>> arrays = [[1, 1, 2, 2], ['red', 'blue', 'red', 'blue']]
|
|
220
|
+
>>> ps.MultiIndex.from_arrays(arrays, names=('number', 'color')) # doctest: +SKIP
|
|
221
|
+
MultiIndex([(1, 'red'),
|
|
222
|
+
(1, 'blue'),
|
|
223
|
+
(2, 'red'),
|
|
224
|
+
(2, 'blue')],
|
|
225
|
+
names=['number', 'color'])
|
|
226
|
+
"""
|
|
227
|
+
return cast(
|
|
228
|
+
MultiIndex,
|
|
229
|
+
ps.from_pandas(
|
|
230
|
+
pd.MultiIndex.from_arrays(arrays=arrays, sortorder=sortorder, names=names)
|
|
231
|
+
),
|
|
232
|
+
)
|
|
233
|
+
|
|
234
|
+
@staticmethod
|
|
235
|
+
def from_product(
|
|
236
|
+
iterables: List[List],
|
|
237
|
+
sortorder: Optional[int] = None,
|
|
238
|
+
names: Optional[List[Name]] = None,
|
|
239
|
+
) -> "MultiIndex":
|
|
240
|
+
"""
|
|
241
|
+
Make a MultiIndex from the cartesian product of multiple iterables.
|
|
242
|
+
|
|
243
|
+
Parameters
|
|
244
|
+
----------
|
|
245
|
+
iterables : list / sequence of iterables
|
|
246
|
+
Each iterable has unique labels for each level of the index.
|
|
247
|
+
sortorder : int or None
|
|
248
|
+
Level of sortedness (must be lexicographically sorted by that
|
|
249
|
+
level).
|
|
250
|
+
names : list / sequence of str, optional
|
|
251
|
+
Names for the levels in the index.
|
|
252
|
+
|
|
253
|
+
Returns
|
|
254
|
+
-------
|
|
255
|
+
index : MultiIndex
|
|
256
|
+
|
|
257
|
+
See Also
|
|
258
|
+
--------
|
|
259
|
+
MultiIndex.from_arrays : Convert list of arrays to MultiIndex.
|
|
260
|
+
MultiIndex.from_tuples : Convert list of tuples to MultiIndex.
|
|
261
|
+
|
|
262
|
+
Examples
|
|
263
|
+
--------
|
|
264
|
+
>>> numbers = [0, 1, 2]
|
|
265
|
+
>>> colors = ['green', 'purple']
|
|
266
|
+
>>> ps.MultiIndex.from_product([numbers, colors],
|
|
267
|
+
... names=['number', 'color']) # doctest: +SKIP
|
|
268
|
+
MultiIndex([(0, 'green'),
|
|
269
|
+
(0, 'purple'),
|
|
270
|
+
(1, 'green'),
|
|
271
|
+
(1, 'purple'),
|
|
272
|
+
(2, 'green'),
|
|
273
|
+
(2, 'purple')],
|
|
274
|
+
names=['number', 'color'])
|
|
275
|
+
"""
|
|
276
|
+
return cast(
|
|
277
|
+
MultiIndex,
|
|
278
|
+
ps.from_pandas(
|
|
279
|
+
pd.MultiIndex.from_product(iterables=iterables, sortorder=sortorder, names=names)
|
|
280
|
+
),
|
|
281
|
+
)
|
|
282
|
+
|
|
283
|
+
@staticmethod
|
|
284
|
+
def from_frame(df: DataFrame, names: Optional[List[Name]] = None) -> "MultiIndex":
|
|
285
|
+
"""
|
|
286
|
+
Make a MultiIndex from a DataFrame.
|
|
287
|
+
|
|
288
|
+
Parameters
|
|
289
|
+
----------
|
|
290
|
+
df : DataFrame
|
|
291
|
+
DataFrame to be converted to MultiIndex.
|
|
292
|
+
names : list-like, optional
|
|
293
|
+
If no names are provided, use the column names, or tuple of column
|
|
294
|
+
names if the column is a MultiIndex. If a sequence, overwrite
|
|
295
|
+
names with the given sequence.
|
|
296
|
+
|
|
297
|
+
Returns
|
|
298
|
+
-------
|
|
299
|
+
MultiIndex
|
|
300
|
+
The MultiIndex representation of the given DataFrame.
|
|
301
|
+
|
|
302
|
+
See Also
|
|
303
|
+
--------
|
|
304
|
+
MultiIndex.from_arrays : Convert list of arrays to MultiIndex.
|
|
305
|
+
MultiIndex.from_tuples : Convert list of tuples to MultiIndex.
|
|
306
|
+
MultiIndex.from_product : Make a MultiIndex from cartesian product
|
|
307
|
+
of iterables.
|
|
308
|
+
|
|
309
|
+
Examples
|
|
310
|
+
--------
|
|
311
|
+
>>> df = ps.DataFrame([['HI', 'Temp'], ['HI', 'Precip'],
|
|
312
|
+
... ['NJ', 'Temp'], ['NJ', 'Precip']],
|
|
313
|
+
... columns=['a', 'b'])
|
|
314
|
+
>>> df # doctest: +SKIP
|
|
315
|
+
a b
|
|
316
|
+
0 HI Temp
|
|
317
|
+
1 HI Precip
|
|
318
|
+
2 NJ Temp
|
|
319
|
+
3 NJ Precip
|
|
320
|
+
|
|
321
|
+
>>> ps.MultiIndex.from_frame(df) # doctest: +SKIP
|
|
322
|
+
MultiIndex([('HI', 'Temp'),
|
|
323
|
+
('HI', 'Precip'),
|
|
324
|
+
('NJ', 'Temp'),
|
|
325
|
+
('NJ', 'Precip')],
|
|
326
|
+
names=['a', 'b'])
|
|
327
|
+
|
|
328
|
+
Using explicit names, instead of the column names
|
|
329
|
+
|
|
330
|
+
>>> ps.MultiIndex.from_frame(df, names=['state', 'observation']) # doctest: +SKIP
|
|
331
|
+
MultiIndex([('HI', 'Temp'),
|
|
332
|
+
('HI', 'Precip'),
|
|
333
|
+
('NJ', 'Temp'),
|
|
334
|
+
('NJ', 'Precip')],
|
|
335
|
+
names=['state', 'observation'])
|
|
336
|
+
"""
|
|
337
|
+
if not isinstance(df, DataFrame):
|
|
338
|
+
raise TypeError("Input must be a DataFrame")
|
|
339
|
+
sdf = df._to_spark()
|
|
340
|
+
|
|
341
|
+
if names is None:
|
|
342
|
+
names = df._internal.column_labels
|
|
343
|
+
elif not is_list_like(names):
|
|
344
|
+
raise TypeError("Names should be list-like for a MultiIndex")
|
|
345
|
+
else:
|
|
346
|
+
names = [name if is_name_like_tuple(name) else (name,) for name in names]
|
|
347
|
+
|
|
348
|
+
internal = InternalFrame(
|
|
349
|
+
spark_frame=sdf,
|
|
350
|
+
index_spark_columns=[scol_for(sdf, col) for col in sdf.columns],
|
|
351
|
+
index_names=names,
|
|
352
|
+
)
|
|
353
|
+
return cast(MultiIndex, DataFrame(internal).index)
|
|
354
|
+
|
|
355
|
+
@property
|
|
356
|
+
def name(self) -> Name:
|
|
357
|
+
raise PandasNotImplementedError(class_name="pd.MultiIndex", property_name="name")
|
|
358
|
+
|
|
359
|
+
@name.setter
|
|
360
|
+
def name(self, name: Name) -> None:
|
|
361
|
+
raise PandasNotImplementedError(class_name="pd.MultiIndex", property_name="name")
|
|
362
|
+
|
|
363
|
+
@property
|
|
364
|
+
def dtypes(self) -> pd.Series:
|
|
365
|
+
"""Return the dtypes as a Series for the underlying MultiIndex.
|
|
366
|
+
|
|
367
|
+
.. versionadded:: 3.3.0
|
|
368
|
+
|
|
369
|
+
Returns
|
|
370
|
+
-------
|
|
371
|
+
pd.Series
|
|
372
|
+
The data type of each level.
|
|
373
|
+
|
|
374
|
+
Examples
|
|
375
|
+
--------
|
|
376
|
+
>>> psmidx = ps.MultiIndex.from_arrays(
|
|
377
|
+
... [[0, 1, 2, 3, 4, 5, 6, 7, 8], [1, 2, 3, 4, 5, 6, 7, 8, 9]],
|
|
378
|
+
... names=("zero", "one"),
|
|
379
|
+
... )
|
|
380
|
+
>>> psmidx.dtypes
|
|
381
|
+
zero int64
|
|
382
|
+
one int64
|
|
383
|
+
dtype: object
|
|
384
|
+
"""
|
|
385
|
+
return pd.Series(
|
|
386
|
+
[field.dtype for field in self._internal.index_fields],
|
|
387
|
+
index=pd.Index(
|
|
388
|
+
[name if len(name) > 1 else name[0] for name in self._internal.index_names]
|
|
389
|
+
),
|
|
390
|
+
)
|
|
391
|
+
|
|
392
|
+
def _verify_for_rename(self, name: List[Name]) -> List[Label]: # type: ignore[override]
|
|
393
|
+
if is_list_like(name):
|
|
394
|
+
if self._internal.index_level != len(name):
|
|
395
|
+
raise ValueError(
|
|
396
|
+
"Length of new names must be {}, got {}".format(
|
|
397
|
+
self._internal.index_level, len(name)
|
|
398
|
+
)
|
|
399
|
+
)
|
|
400
|
+
if any(not is_hashable(n) for n in name):
|
|
401
|
+
raise TypeError("MultiIndex.name must be a hashable type")
|
|
402
|
+
return [n if is_name_like_tuple(n) else (n,) for n in name]
|
|
403
|
+
else:
|
|
404
|
+
raise TypeError("Must pass list-like as `names`.")
|
|
405
|
+
|
|
406
|
+
def swaplevel(self, i: int = -2, j: int = -1) -> "MultiIndex":
|
|
407
|
+
"""
|
|
408
|
+
Swap level i with level j.
|
|
409
|
+
Calling this method does not change the ordering of the values.
|
|
410
|
+
|
|
411
|
+
Parameters
|
|
412
|
+
----------
|
|
413
|
+
i : int, str, default -2
|
|
414
|
+
First level of index to be swapped. Can pass level name as string.
|
|
415
|
+
Parameter types can be mixed.
|
|
416
|
+
j : int, str, default -1
|
|
417
|
+
Second level of index to be swapped. Can pass level name as string.
|
|
418
|
+
Parameter types can be mixed.
|
|
419
|
+
|
|
420
|
+
Returns
|
|
421
|
+
-------
|
|
422
|
+
MultiIndex
|
|
423
|
+
A new MultiIndex.
|
|
424
|
+
|
|
425
|
+
Examples
|
|
426
|
+
--------
|
|
427
|
+
>>> midx = ps.MultiIndex.from_arrays([['a', 'b'], [1, 2]], names = ['word', 'number'])
|
|
428
|
+
>>> midx # doctest: +SKIP
|
|
429
|
+
MultiIndex([('a', 1),
|
|
430
|
+
('b', 2)],
|
|
431
|
+
names=['word', 'number'])
|
|
432
|
+
|
|
433
|
+
>>> midx.swaplevel(0, 1) # doctest: +SKIP
|
|
434
|
+
MultiIndex([(1, 'a'),
|
|
435
|
+
(2, 'b')],
|
|
436
|
+
names=['number', 'word'])
|
|
437
|
+
|
|
438
|
+
>>> midx.swaplevel('number', 'word') # doctest: +SKIP
|
|
439
|
+
MultiIndex([(1, 'a'),
|
|
440
|
+
(2, 'b')],
|
|
441
|
+
names=['number', 'word'])
|
|
442
|
+
"""
|
|
443
|
+
for index in (i, j):
|
|
444
|
+
if not isinstance(index, int) and index not in self.names:
|
|
445
|
+
raise KeyError("Level %s not found" % index)
|
|
446
|
+
|
|
447
|
+
i = i if isinstance(i, int) else self.names.index(i)
|
|
448
|
+
j = j if isinstance(j, int) else self.names.index(j)
|
|
449
|
+
|
|
450
|
+
for index in (i, j):
|
|
451
|
+
if index >= len(self.names) or index < -len(self.names):
|
|
452
|
+
raise IndexError(
|
|
453
|
+
"Too many levels: Index has only %s levels, "
|
|
454
|
+
"%s is not a valid level number" % (len(self.names), index)
|
|
455
|
+
)
|
|
456
|
+
|
|
457
|
+
index_map = list(
|
|
458
|
+
zip(
|
|
459
|
+
self._internal.index_spark_columns,
|
|
460
|
+
self._internal.index_names,
|
|
461
|
+
self._internal.index_fields,
|
|
462
|
+
)
|
|
463
|
+
)
|
|
464
|
+
index_map[i], index_map[j] = index_map[j], index_map[i]
|
|
465
|
+
index_spark_columns, index_names, index_fields = zip(*index_map)
|
|
466
|
+
internal = self._internal.copy(
|
|
467
|
+
index_spark_columns=list(index_spark_columns),
|
|
468
|
+
index_names=list(index_names),
|
|
469
|
+
index_fields=list(index_fields),
|
|
470
|
+
column_labels=[],
|
|
471
|
+
data_spark_columns=[],
|
|
472
|
+
data_fields=[],
|
|
473
|
+
)
|
|
474
|
+
return cast(MultiIndex, DataFrame(internal).index)
|
|
475
|
+
|
|
476
|
+
@property
|
|
477
|
+
def levshape(self) -> Tuple[int, ...]:
|
|
478
|
+
"""
|
|
479
|
+
A tuple with the length of each level.
|
|
480
|
+
|
|
481
|
+
Examples
|
|
482
|
+
--------
|
|
483
|
+
>>> midx = ps.MultiIndex.from_tuples([('a', 'x'), ('b', 'y'), ('c', 'z')])
|
|
484
|
+
>>> midx # doctest: +SKIP
|
|
485
|
+
MultiIndex([('a', 'x'),
|
|
486
|
+
('b', 'y'),
|
|
487
|
+
('c', 'z')],
|
|
488
|
+
)
|
|
489
|
+
|
|
490
|
+
>>> midx.levshape
|
|
491
|
+
(3, 3)
|
|
492
|
+
"""
|
|
493
|
+
result = self._internal.spark_frame.agg(
|
|
494
|
+
*(F.countDistinct(c) for c in self._internal.index_spark_columns)
|
|
495
|
+
).collect()[0]
|
|
496
|
+
return tuple(result)
|
|
497
|
+
|
|
498
|
+
@staticmethod
|
|
499
|
+
def _comparator_for_monotonic_increasing(
|
|
500
|
+
data_type: DataType,
|
|
501
|
+
) -> Callable[
|
|
502
|
+
[PySparkColumn, PySparkColumn, Callable[[PySparkColumn, PySparkColumn], PySparkColumn]],
|
|
503
|
+
PySparkColumn,
|
|
504
|
+
]:
|
|
505
|
+
return compare_disallow_null
|
|
506
|
+
|
|
507
|
+
def _is_monotonic(self, order: str) -> bool:
|
|
508
|
+
if order == "increasing":
|
|
509
|
+
return self._is_monotonic_increasing().all()
|
|
510
|
+
else:
|
|
511
|
+
return self._is_monotonic_decreasing().all()
|
|
512
|
+
|
|
513
|
+
def _is_monotonic_increasing(self) -> Series:
|
|
514
|
+
window = Window.orderBy(NATURAL_ORDER_COLUMN_NAME).rowsBetween(-1, -1)
|
|
515
|
+
|
|
516
|
+
cond = F.lit(True)
|
|
517
|
+
has_not_null = F.lit(True)
|
|
518
|
+
Column = get_column_class()
|
|
519
|
+
for scol in self._internal.index_spark_columns[::-1]:
|
|
520
|
+
data_type = self._internal.spark_type_for(scol)
|
|
521
|
+
prev = F.lag(scol, 1).over(window)
|
|
522
|
+
compare = MultiIndex._comparator_for_monotonic_increasing(data_type)
|
|
523
|
+
# Since pandas 1.1.4, null value is not allowed at any levels of MultiIndex.
|
|
524
|
+
# Therefore, we should check `has_not_null` over all levels.
|
|
525
|
+
has_not_null = has_not_null & scol.isNotNull()
|
|
526
|
+
cond = F.when(scol.eqNullSafe(prev), cond).otherwise(compare(scol, prev, Column.__gt__))
|
|
527
|
+
|
|
528
|
+
cond = has_not_null & (prev.isNull() | cond)
|
|
529
|
+
|
|
530
|
+
cond_name = verify_temp_column_name(
|
|
531
|
+
self._internal.spark_frame.select(self._internal.index_spark_columns),
|
|
532
|
+
"__is_monotonic_increasing_cond__",
|
|
533
|
+
)
|
|
534
|
+
|
|
535
|
+
sdf = self._internal.spark_frame.select(
|
|
536
|
+
self._internal.index_spark_columns + [cond.alias(cond_name)]
|
|
537
|
+
)
|
|
538
|
+
|
|
539
|
+
internal = InternalFrame(
|
|
540
|
+
spark_frame=sdf,
|
|
541
|
+
index_spark_columns=[
|
|
542
|
+
scol_for(sdf, col) for col in self._internal.index_spark_column_names
|
|
543
|
+
],
|
|
544
|
+
index_names=self._internal.index_names,
|
|
545
|
+
index_fields=self._internal.index_fields,
|
|
546
|
+
)
|
|
547
|
+
|
|
548
|
+
return first_series(DataFrame(internal))
|
|
549
|
+
|
|
550
|
+
@staticmethod
|
|
551
|
+
def _comparator_for_monotonic_decreasing(
|
|
552
|
+
data_type: DataType,
|
|
553
|
+
) -> Callable[
|
|
554
|
+
[PySparkColumn, PySparkColumn, Callable[[PySparkColumn, PySparkColumn], PySparkColumn]],
|
|
555
|
+
PySparkColumn,
|
|
556
|
+
]:
|
|
557
|
+
return compare_disallow_null
|
|
558
|
+
|
|
559
|
+
def _is_monotonic_decreasing(self) -> Series:
|
|
560
|
+
window = Window.orderBy(NATURAL_ORDER_COLUMN_NAME).rowsBetween(-1, -1)
|
|
561
|
+
|
|
562
|
+
cond = F.lit(True)
|
|
563
|
+
has_not_null = F.lit(True)
|
|
564
|
+
Column = get_column_class()
|
|
565
|
+
for scol in self._internal.index_spark_columns[::-1]:
|
|
566
|
+
data_type = self._internal.spark_type_for(scol)
|
|
567
|
+
prev = F.lag(scol, 1).over(window)
|
|
568
|
+
compare = MultiIndex._comparator_for_monotonic_increasing(data_type)
|
|
569
|
+
# Since pandas 1.1.4, null value is not allowed at any levels of MultiIndex.
|
|
570
|
+
# Therefore, we should check `has_not_null` over all levels.
|
|
571
|
+
has_not_null = has_not_null & scol.isNotNull()
|
|
572
|
+
cond = F.when(scol.eqNullSafe(prev), cond).otherwise(compare(scol, prev, Column.__lt__))
|
|
573
|
+
|
|
574
|
+
cond = has_not_null & (prev.isNull() | cond)
|
|
575
|
+
|
|
576
|
+
cond_name = verify_temp_column_name(
|
|
577
|
+
self._internal.spark_frame.select(self._internal.index_spark_columns),
|
|
578
|
+
"__is_monotonic_decreasing_cond__",
|
|
579
|
+
)
|
|
580
|
+
|
|
581
|
+
sdf = self._internal.spark_frame.select(
|
|
582
|
+
self._internal.index_spark_columns + [cond.alias(cond_name)]
|
|
583
|
+
)
|
|
584
|
+
|
|
585
|
+
internal = InternalFrame(
|
|
586
|
+
spark_frame=sdf,
|
|
587
|
+
index_spark_columns=[
|
|
588
|
+
scol_for(sdf, col) for col in self._internal.index_spark_column_names
|
|
589
|
+
],
|
|
590
|
+
index_names=self._internal.index_names,
|
|
591
|
+
index_fields=self._internal.index_fields,
|
|
592
|
+
)
|
|
593
|
+
|
|
594
|
+
return first_series(DataFrame(internal))
|
|
595
|
+
|
|
596
|
+
def to_frame( # type: ignore[override]
|
|
597
|
+
self, index: bool = True, name: Optional[List[Name]] = None
|
|
598
|
+
) -> DataFrame:
|
|
599
|
+
"""
|
|
600
|
+
Create a DataFrame with the levels of the MultiIndex as columns.
|
|
601
|
+
Column ordering is determined by the DataFrame constructor with data as
|
|
602
|
+
a dict.
|
|
603
|
+
|
|
604
|
+
Parameters
|
|
605
|
+
----------
|
|
606
|
+
index : boolean, default True
|
|
607
|
+
Set the index of the returned DataFrame as the original MultiIndex.
|
|
608
|
+
name : list / sequence of strings, optional
|
|
609
|
+
The passed names should substitute index level names.
|
|
610
|
+
|
|
611
|
+
Returns
|
|
612
|
+
-------
|
|
613
|
+
DataFrame : a DataFrame containing the original MultiIndex data.
|
|
614
|
+
|
|
615
|
+
See Also
|
|
616
|
+
--------
|
|
617
|
+
DataFrame
|
|
618
|
+
|
|
619
|
+
Examples
|
|
620
|
+
--------
|
|
621
|
+
>>> tuples = [(1, 'red'), (1, 'blue'),
|
|
622
|
+
... (2, 'red'), (2, 'blue')]
|
|
623
|
+
>>> idx = ps.MultiIndex.from_tuples(tuples, names=('number', 'color'))
|
|
624
|
+
>>> idx # doctest: +SKIP
|
|
625
|
+
MultiIndex([(1, 'red'),
|
|
626
|
+
(1, 'blue'),
|
|
627
|
+
(2, 'red'),
|
|
628
|
+
(2, 'blue')],
|
|
629
|
+
names=['number', 'color'])
|
|
630
|
+
>>> idx.to_frame() # doctest: +NORMALIZE_WHITESPACE
|
|
631
|
+
number color
|
|
632
|
+
number color
|
|
633
|
+
1 red 1 red
|
|
634
|
+
blue 1 blue
|
|
635
|
+
2 red 2 red
|
|
636
|
+
blue 2 blue
|
|
637
|
+
|
|
638
|
+
By default, the original Index is reused. To enforce a new Index:
|
|
639
|
+
|
|
640
|
+
>>> idx.to_frame(index=False)
|
|
641
|
+
number color
|
|
642
|
+
0 1 red
|
|
643
|
+
1 1 blue
|
|
644
|
+
2 2 red
|
|
645
|
+
3 2 blue
|
|
646
|
+
|
|
647
|
+
To override the name of the resulting column, specify `name`:
|
|
648
|
+
|
|
649
|
+
>>> idx.to_frame(name=['n', 'c']) # doctest: +NORMALIZE_WHITESPACE
|
|
650
|
+
n c
|
|
651
|
+
number color
|
|
652
|
+
1 red 1 red
|
|
653
|
+
blue 1 blue
|
|
654
|
+
2 red 2 red
|
|
655
|
+
blue 2 blue
|
|
656
|
+
"""
|
|
657
|
+
if name is None:
|
|
658
|
+
name = [
|
|
659
|
+
name if name is not None else (i,)
|
|
660
|
+
for i, name in enumerate(self._internal.index_names)
|
|
661
|
+
]
|
|
662
|
+
elif is_list_like(name):
|
|
663
|
+
if len(name) != self._internal.index_level:
|
|
664
|
+
raise ValueError("'name' should have same length as number of levels on index.")
|
|
665
|
+
name = [n if is_name_like_tuple(n) else (n,) for n in name]
|
|
666
|
+
else:
|
|
667
|
+
raise TypeError("'name' must be a list / sequence of column names.")
|
|
668
|
+
|
|
669
|
+
return self._to_frame(index=index, names=name)
|
|
670
|
+
|
|
671
|
+
def to_pandas(self) -> pd.MultiIndex:
|
|
672
|
+
"""
|
|
673
|
+
Return a pandas MultiIndex.
|
|
674
|
+
|
|
675
|
+
.. note:: This method should only be used if the resulting pandas object is expected
|
|
676
|
+
to be small, as all the data is loaded into the driver's memory.
|
|
677
|
+
|
|
678
|
+
Examples
|
|
679
|
+
--------
|
|
680
|
+
>>> df = ps.DataFrame([(.2, .3), (.0, .6), (.6, .0), (.2, .1)],
|
|
681
|
+
... columns=['dogs', 'cats'],
|
|
682
|
+
... index=[list('abcd'), list('efgh')])
|
|
683
|
+
>>> df['dogs'].index.to_pandas() # doctest: +SKIP
|
|
684
|
+
MultiIndex([('a', 'e'),
|
|
685
|
+
('b', 'f'),
|
|
686
|
+
('c', 'g'),
|
|
687
|
+
('d', 'h')],
|
|
688
|
+
)
|
|
689
|
+
"""
|
|
690
|
+
# TODO: We might need to handle internal state change.
|
|
691
|
+
# So far, we don't have any functions to change the internal state of MultiIndex except for
|
|
692
|
+
# series-like operations. In that case, it creates a new Index object instead of MultiIndex.
|
|
693
|
+
return cast(pd.MultiIndex, super().to_pandas())
|
|
694
|
+
|
|
695
|
+
def _to_pandas(self) -> pd.MultiIndex:
|
|
696
|
+
"""
|
|
697
|
+
Same as `to_pandas()`, without issuing the advice log for internal usage.
|
|
698
|
+
"""
|
|
699
|
+
return cast(pd.MultiIndex, super()._to_pandas())
|
|
700
|
+
|
|
701
|
+
def nunique(self, dropna: bool = True, approx: bool = False, rsd: float = 0.05) -> int:
|
|
702
|
+
raise NotImplementedError("nunique is not defined for MultiIndex")
|
|
703
|
+
|
|
704
|
+
# TODO: add 'name' parameter after pd.MultiIndex.name is implemented
|
|
705
|
+
def copy(self, deep: Optional[bool] = None) -> "MultiIndex": # type: ignore[override]
|
|
706
|
+
"""
|
|
707
|
+
Make a copy of this object.
|
|
708
|
+
|
|
709
|
+
Parameters
|
|
710
|
+
----------
|
|
711
|
+
deep : None
|
|
712
|
+
this parameter is not supported but just dummy parameter to match pandas.
|
|
713
|
+
|
|
714
|
+
Examples
|
|
715
|
+
--------
|
|
716
|
+
>>> df = ps.DataFrame([(.2, .3), (.0, .6), (.6, .0), (.2, .1)],
|
|
717
|
+
... columns=['dogs', 'cats'],
|
|
718
|
+
... index=[list('abcd'), list('efgh')])
|
|
719
|
+
>>> df['dogs'].index # doctest: +SKIP
|
|
720
|
+
MultiIndex([('a', 'e'),
|
|
721
|
+
('b', 'f'),
|
|
722
|
+
('c', 'g'),
|
|
723
|
+
('d', 'h')],
|
|
724
|
+
)
|
|
725
|
+
|
|
726
|
+
Copy index
|
|
727
|
+
|
|
728
|
+
>>> df.index.copy() # doctest: +SKIP
|
|
729
|
+
MultiIndex([('a', 'e'),
|
|
730
|
+
('b', 'f'),
|
|
731
|
+
('c', 'g'),
|
|
732
|
+
('d', 'h')],
|
|
733
|
+
)
|
|
734
|
+
"""
|
|
735
|
+
return cast(MultiIndex, super().copy(deep=deep))
|
|
736
|
+
|
|
737
|
+
def symmetric_difference( # type: ignore[override]
|
|
738
|
+
self,
|
|
739
|
+
other: Index,
|
|
740
|
+
result_name: Optional[List[Name]] = None,
|
|
741
|
+
sort: Optional[bool] = None,
|
|
742
|
+
) -> "MultiIndex":
|
|
743
|
+
"""
|
|
744
|
+
Compute the symmetric difference of two MultiIndex objects.
|
|
745
|
+
|
|
746
|
+
Parameters
|
|
747
|
+
----------
|
|
748
|
+
other : Index or array-like
|
|
749
|
+
result_name : list
|
|
750
|
+
sort : True or None, default None
|
|
751
|
+
Whether to sort the resulting index.
|
|
752
|
+
* True : Attempt to sort the result.
|
|
753
|
+
* None : Do not sort the result.
|
|
754
|
+
|
|
755
|
+
Returns
|
|
756
|
+
-------
|
|
757
|
+
symmetric_difference : MultiIndex
|
|
758
|
+
|
|
759
|
+
Notes
|
|
760
|
+
-----
|
|
761
|
+
``symmetric_difference`` contains elements that appear in either
|
|
762
|
+
``idx1`` or ``idx2`` but not both. Equivalent to the Index created by
|
|
763
|
+
``idx1.difference(idx2) | idx2.difference(idx1)`` with duplicates
|
|
764
|
+
dropped.
|
|
765
|
+
|
|
766
|
+
Examples
|
|
767
|
+
--------
|
|
768
|
+
>>> midx1 = pd.MultiIndex([['lama', 'cow', 'falcon'],
|
|
769
|
+
... ['speed', 'weight', 'length']],
|
|
770
|
+
... [[0, 0, 0, 1, 1, 1, 2, 2, 2],
|
|
771
|
+
... [0, 0, 0, 0, 1, 2, 0, 1, 2]])
|
|
772
|
+
>>> midx2 = pd.MultiIndex([['pandas-on-Spark', 'cow', 'falcon'],
|
|
773
|
+
... ['speed', 'weight', 'length']],
|
|
774
|
+
... [[0, 0, 0, 1, 1, 1, 2, 2, 2],
|
|
775
|
+
... [0, 0, 0, 0, 1, 2, 0, 1, 2]])
|
|
776
|
+
>>> s1 = ps.Series([45, 200, 1.2, 30, 250, 1.5, 320, 1, 0.3],
|
|
777
|
+
... index=midx1)
|
|
778
|
+
>>> s2 = ps.Series([45, 200, 1.2, 30, 250, 1.5, 320, 1, 0.3],
|
|
779
|
+
... index=midx2)
|
|
780
|
+
|
|
781
|
+
>>> s1.index.symmetric_difference(s2.index) # doctest: +SKIP
|
|
782
|
+
MultiIndex([('pandas-on-Spark', 'speed'),
|
|
783
|
+
( 'lama', 'speed')],
|
|
784
|
+
)
|
|
785
|
+
|
|
786
|
+
You can set names of the result Index.
|
|
787
|
+
|
|
788
|
+
>>> s1.index.symmetric_difference(s2.index, result_name=['a', 'b']) # doctest: +SKIP
|
|
789
|
+
MultiIndex([('pandas-on-Spark', 'speed'),
|
|
790
|
+
( 'lama', 'speed')],
|
|
791
|
+
names=['a', 'b'])
|
|
792
|
+
|
|
793
|
+
You can set sort to `True`, if you want to sort the resulting index.
|
|
794
|
+
|
|
795
|
+
>>> s1.index.symmetric_difference(s2.index, sort=True) # doctest: +SKIP
|
|
796
|
+
MultiIndex([('pandas-on-Spark', 'speed'),
|
|
797
|
+
( 'lama', 'speed')],
|
|
798
|
+
)
|
|
799
|
+
|
|
800
|
+
You can also use the ``^`` operator:
|
|
801
|
+
|
|
802
|
+
>>> s1.index ^ s2.index # doctest: +SKIP
|
|
803
|
+
MultiIndex([('pandas-on-Spark', 'speed'),
|
|
804
|
+
( 'lama', 'speed')],
|
|
805
|
+
)
|
|
806
|
+
"""
|
|
807
|
+
if type(self) != type(other):
|
|
808
|
+
raise NotImplementedError(
|
|
809
|
+
"Doesn't support symmetric_difference between Index & MultiIndex for now"
|
|
810
|
+
)
|
|
811
|
+
|
|
812
|
+
sdf_self = self._psdf._internal.spark_frame.select(self._internal.index_spark_columns)
|
|
813
|
+
sdf_other = other._psdf._internal.spark_frame.select(other._internal.index_spark_columns)
|
|
814
|
+
|
|
815
|
+
sdf_symdiff = sdf_self.union(sdf_other).subtract(sdf_self.intersect(sdf_other))
|
|
816
|
+
|
|
817
|
+
if sort:
|
|
818
|
+
sdf_symdiff = sdf_symdiff.sort(*self._internal.index_spark_column_names)
|
|
819
|
+
|
|
820
|
+
internal = InternalFrame(
|
|
821
|
+
spark_frame=sdf_symdiff,
|
|
822
|
+
index_spark_columns=[
|
|
823
|
+
scol_for(sdf_symdiff, col) for col in self._internal.index_spark_column_names
|
|
824
|
+
],
|
|
825
|
+
index_names=self._internal.index_names,
|
|
826
|
+
index_fields=self._internal.index_fields,
|
|
827
|
+
)
|
|
828
|
+
result = cast(MultiIndex, DataFrame(internal).index)
|
|
829
|
+
|
|
830
|
+
if result_name:
|
|
831
|
+
result.names = result_name
|
|
832
|
+
|
|
833
|
+
return result
|
|
834
|
+
|
|
835
|
+
# TODO: ADD error parameter
|
|
836
|
+
def drop(self, codes: List[Any], level: Optional[Union[int, Name]] = None) -> "MultiIndex":
|
|
837
|
+
"""
|
|
838
|
+
Make new MultiIndex with passed list of labels deleted
|
|
839
|
+
|
|
840
|
+
Parameters
|
|
841
|
+
----------
|
|
842
|
+
codes : array-like
|
|
843
|
+
Must be a list of tuples
|
|
844
|
+
level : int or level name, default None
|
|
845
|
+
|
|
846
|
+
Returns
|
|
847
|
+
-------
|
|
848
|
+
dropped : MultiIndex
|
|
849
|
+
|
|
850
|
+
Examples
|
|
851
|
+
--------
|
|
852
|
+
>>> index = ps.MultiIndex.from_tuples([('a', 'x'), ('b', 'y'), ('c', 'z')])
|
|
853
|
+
>>> index # doctest: +SKIP
|
|
854
|
+
MultiIndex([('a', 'x'),
|
|
855
|
+
('b', 'y'),
|
|
856
|
+
('c', 'z')],
|
|
857
|
+
)
|
|
858
|
+
|
|
859
|
+
>>> index.drop(['a']) # doctest: +SKIP
|
|
860
|
+
MultiIndex([('b', 'y'),
|
|
861
|
+
('c', 'z')],
|
|
862
|
+
)
|
|
863
|
+
|
|
864
|
+
>>> index.drop(['x', 'y'], level=1) # doctest: +SKIP
|
|
865
|
+
MultiIndex([('c', 'z')],
|
|
866
|
+
)
|
|
867
|
+
"""
|
|
868
|
+
internal = self._internal.resolved_copy
|
|
869
|
+
sdf = internal.spark_frame
|
|
870
|
+
index_scols = internal.index_spark_columns
|
|
871
|
+
if level is None:
|
|
872
|
+
scol = index_scols[0]
|
|
873
|
+
elif isinstance(level, int):
|
|
874
|
+
scol = index_scols[level]
|
|
875
|
+
else:
|
|
876
|
+
scol = None
|
|
877
|
+
for index_spark_column, index_name in zip(
|
|
878
|
+
internal.index_spark_columns, internal.index_names
|
|
879
|
+
):
|
|
880
|
+
if not isinstance(level, tuple):
|
|
881
|
+
level = (level,)
|
|
882
|
+
if level == index_name:
|
|
883
|
+
if scol is not None:
|
|
884
|
+
raise ValueError(
|
|
885
|
+
"The name {} occurs multiple times, use a level number".format(
|
|
886
|
+
name_like_string(level)
|
|
887
|
+
)
|
|
888
|
+
)
|
|
889
|
+
scol = index_spark_column
|
|
890
|
+
if scol is None:
|
|
891
|
+
raise KeyError("Level {} not found".format(name_like_string(level)))
|
|
892
|
+
sdf = sdf[~scol.isin(codes)]
|
|
893
|
+
|
|
894
|
+
internal = InternalFrame(
|
|
895
|
+
spark_frame=sdf,
|
|
896
|
+
index_spark_columns=[scol_for(sdf, col) for col in internal.index_spark_column_names],
|
|
897
|
+
index_names=internal.index_names,
|
|
898
|
+
index_fields=internal.index_fields,
|
|
899
|
+
column_labels=[],
|
|
900
|
+
data_spark_columns=[],
|
|
901
|
+
data_fields=[],
|
|
902
|
+
)
|
|
903
|
+
return cast(MultiIndex, DataFrame(internal).index)
|
|
904
|
+
|
|
905
|
+
def drop_duplicates(self, keep: Union[bool, str] = "first") -> "MultiIndex":
|
|
906
|
+
"""
|
|
907
|
+
Return MultiIndex with duplicate values removed.
|
|
908
|
+
|
|
909
|
+
Parameters
|
|
910
|
+
----------
|
|
911
|
+
keep : {'first', 'last', ``False``}, default 'first'
|
|
912
|
+
Method to handle dropping duplicates:
|
|
913
|
+
- 'first' : Drop duplicates except for the first occurrence.
|
|
914
|
+
- 'last' : Drop duplicates except for the last occurrence.
|
|
915
|
+
- ``False`` : Drop all duplicates.
|
|
916
|
+
|
|
917
|
+
Returns
|
|
918
|
+
-------
|
|
919
|
+
deduplicated : MultiIndex
|
|
920
|
+
|
|
921
|
+
See Also
|
|
922
|
+
--------
|
|
923
|
+
Series.drop_duplicates : Equivalent method on Series.
|
|
924
|
+
DataFrame.drop_duplicates : Equivalent method on DataFrame.
|
|
925
|
+
|
|
926
|
+
Examples
|
|
927
|
+
--------
|
|
928
|
+
Generate a MultiIndex with duplicate values.
|
|
929
|
+
|
|
930
|
+
>>> arrays = [[1, 2, 3, 1, 2], ["red", "blue", "black", "red", "blue"]]
|
|
931
|
+
>>> midx = ps.MultiIndex.from_arrays(arrays, names=("number", "color"))
|
|
932
|
+
>>> midx
|
|
933
|
+
MultiIndex([(1, 'red'),
|
|
934
|
+
(2, 'blue'),
|
|
935
|
+
(3, 'black'),
|
|
936
|
+
(1, 'red'),
|
|
937
|
+
(2, 'blue')],
|
|
938
|
+
names=['number', 'color'])
|
|
939
|
+
|
|
940
|
+
>>> midx.drop_duplicates()
|
|
941
|
+
MultiIndex([(1, 'red'),
|
|
942
|
+
(2, 'blue'),
|
|
943
|
+
(3, 'black')],
|
|
944
|
+
names=['number', 'color'])
|
|
945
|
+
|
|
946
|
+
>>> midx.drop_duplicates(keep='first')
|
|
947
|
+
MultiIndex([(1, 'red'),
|
|
948
|
+
(2, 'blue'),
|
|
949
|
+
(3, 'black')],
|
|
950
|
+
names=['number', 'color'])
|
|
951
|
+
|
|
952
|
+
>>> midx.drop_duplicates(keep='last')
|
|
953
|
+
MultiIndex([(3, 'black'),
|
|
954
|
+
(1, 'red'),
|
|
955
|
+
(2, 'blue')],
|
|
956
|
+
names=['number', 'color'])
|
|
957
|
+
|
|
958
|
+
>>> midx.drop_duplicates(keep=False)
|
|
959
|
+
MultiIndex([(3, 'black')],
|
|
960
|
+
names=['number', 'color'])
|
|
961
|
+
"""
|
|
962
|
+
with ps.option_context("compute.default_index_type", "distributed"):
|
|
963
|
+
# The attached index caused by `reset_index` below is used for sorting only,
|
|
964
|
+
# and it will be dropped soon,
|
|
965
|
+
# so we enforce “distributed” default index type
|
|
966
|
+
psdf = self.to_frame().reset_index(drop=True)
|
|
967
|
+
return ps.MultiIndex.from_frame(psdf.drop_duplicates(keep=keep).sort_index())
|
|
968
|
+
|
|
969
|
+
def argmax(self) -> None:
|
|
970
|
+
raise TypeError("reduction operation 'argmax' not allowed for this dtype")
|
|
971
|
+
|
|
972
|
+
def argmin(self) -> None:
|
|
973
|
+
raise TypeError("reduction operation 'argmin' not allowed for this dtype")
|
|
974
|
+
|
|
975
|
+
def asof(self, label: Any) -> None:
|
|
976
|
+
raise NotImplementedError(
|
|
977
|
+
"only the default get_loc method is currently supported for MultiIndex"
|
|
978
|
+
)
|
|
979
|
+
|
|
980
|
+
@property
|
|
981
|
+
def is_all_dates(self) -> bool:
|
|
982
|
+
"""
|
|
983
|
+
is_all_dates always returns False for MultiIndex
|
|
984
|
+
|
|
985
|
+
Examples
|
|
986
|
+
--------
|
|
987
|
+
>>> from datetime import datetime
|
|
988
|
+
|
|
989
|
+
>>> idx = ps.MultiIndex.from_tuples(
|
|
990
|
+
... [(datetime(2019, 1, 1, 0, 0, 0), datetime(2019, 1, 1, 0, 0, 0)),
|
|
991
|
+
... (datetime(2019, 1, 1, 0, 0, 0), datetime(2019, 1, 1, 0, 0, 0))])
|
|
992
|
+
>>> idx # doctest: +SKIP
|
|
993
|
+
MultiIndex([('2019-01-01', '2019-01-01'),
|
|
994
|
+
('2019-01-01', '2019-01-01')],
|
|
995
|
+
)
|
|
996
|
+
|
|
997
|
+
>>> idx.is_all_dates
|
|
998
|
+
False
|
|
999
|
+
"""
|
|
1000
|
+
return False
|
|
1001
|
+
|
|
1002
|
+
def __getattr__(self, item: str) -> Any:
|
|
1003
|
+
if hasattr(MissingPandasLikeMultiIndex, item):
|
|
1004
|
+
property_or_func = getattr(MissingPandasLikeMultiIndex, item)
|
|
1005
|
+
if isinstance(property_or_func, property):
|
|
1006
|
+
return property_or_func.fget(self)
|
|
1007
|
+
else:
|
|
1008
|
+
return partial(property_or_func, self)
|
|
1009
|
+
raise AttributeError("'MultiIndex' object has no attribute '{}'".format(item))
|
|
1010
|
+
|
|
1011
|
+
def _get_level_number(self, level: Union[int, Name]) -> int:
|
|
1012
|
+
"""
|
|
1013
|
+
Return the level number if a valid level is given.
|
|
1014
|
+
"""
|
|
1015
|
+
count = self.names.count(level)
|
|
1016
|
+
if (count > 1) and not isinstance(level, int):
|
|
1017
|
+
raise ValueError("The name %s occurs multiple times, use a level number" % level)
|
|
1018
|
+
if level in self.names:
|
|
1019
|
+
level = self.names.index(level)
|
|
1020
|
+
elif isinstance(level, int):
|
|
1021
|
+
nlevels = self.nlevels
|
|
1022
|
+
if level >= nlevels:
|
|
1023
|
+
raise IndexError(
|
|
1024
|
+
"Too many levels: Index has only %d "
|
|
1025
|
+
"levels, %d is not a valid level number" % (nlevels, level)
|
|
1026
|
+
)
|
|
1027
|
+
if level < 0:
|
|
1028
|
+
if (level + nlevels) < 0:
|
|
1029
|
+
raise IndexError(
|
|
1030
|
+
"Too many levels: Index has only %d levels, "
|
|
1031
|
+
"not %d" % (nlevels, level + 1)
|
|
1032
|
+
)
|
|
1033
|
+
level = level + nlevels
|
|
1034
|
+
else:
|
|
1035
|
+
raise KeyError("Level %s not found" % str(level))
|
|
1036
|
+
|
|
1037
|
+
return level
|
|
1038
|
+
|
|
1039
|
+
def get_level_values(self, level: Union[int, Name]) -> Index:
|
|
1040
|
+
"""
|
|
1041
|
+
Return vector of label values for requested level,
|
|
1042
|
+
equal to the length of the index.
|
|
1043
|
+
|
|
1044
|
+
Parameters
|
|
1045
|
+
----------
|
|
1046
|
+
level : int or str
|
|
1047
|
+
``level`` is either the integer position of the level in the
|
|
1048
|
+
MultiIndex, or the name of the level.
|
|
1049
|
+
|
|
1050
|
+
Returns
|
|
1051
|
+
-------
|
|
1052
|
+
values : Index
|
|
1053
|
+
Values is a level of this MultiIndex converted to
|
|
1054
|
+
a single :class:`Index` (or subclass thereof).
|
|
1055
|
+
|
|
1056
|
+
Examples
|
|
1057
|
+
--------
|
|
1058
|
+
|
|
1059
|
+
Create a MultiIndex:
|
|
1060
|
+
|
|
1061
|
+
>>> mi = ps.MultiIndex.from_tuples([('x', 'a'), ('x', 'b'), ('y', 'a')])
|
|
1062
|
+
>>> mi.names = ['level_1', 'level_2']
|
|
1063
|
+
|
|
1064
|
+
Get level values by supplying level as either integer or name:
|
|
1065
|
+
|
|
1066
|
+
>>> mi.get_level_values(0)
|
|
1067
|
+
Index(['x', 'x', 'y'], dtype='object', name='level_1')
|
|
1068
|
+
|
|
1069
|
+
>>> mi.get_level_values('level_2')
|
|
1070
|
+
Index(['a', 'b', 'a'], dtype='object', name='level_2')
|
|
1071
|
+
"""
|
|
1072
|
+
level = self._get_level_number(level)
|
|
1073
|
+
index_scol = self._internal.index_spark_columns[level]
|
|
1074
|
+
index_name = self._internal.index_names[level]
|
|
1075
|
+
index_field = self._internal.index_fields[level]
|
|
1076
|
+
internal = self._internal.copy(
|
|
1077
|
+
index_spark_columns=[index_scol],
|
|
1078
|
+
index_names=[index_name],
|
|
1079
|
+
index_fields=[index_field],
|
|
1080
|
+
column_labels=[],
|
|
1081
|
+
data_spark_columns=[],
|
|
1082
|
+
data_fields=[],
|
|
1083
|
+
)
|
|
1084
|
+
return DataFrame(internal).index
|
|
1085
|
+
|
|
1086
|
+
def insert(self, loc: int, item: Any) -> Index:
|
|
1087
|
+
"""
|
|
1088
|
+
Make new MultiIndex inserting new item at location.
|
|
1089
|
+
|
|
1090
|
+
Follows Python list.append semantics for negative values.
|
|
1091
|
+
|
|
1092
|
+
.. versionchanged:: 3.4.0
|
|
1093
|
+
Raise IndexError when loc is out of bounds to follow Pandas 1.4+ behavior
|
|
1094
|
+
|
|
1095
|
+
Parameters
|
|
1096
|
+
----------
|
|
1097
|
+
loc : int
|
|
1098
|
+
item : object
|
|
1099
|
+
|
|
1100
|
+
Returns
|
|
1101
|
+
-------
|
|
1102
|
+
new_index : MultiIndex
|
|
1103
|
+
|
|
1104
|
+
Examples
|
|
1105
|
+
--------
|
|
1106
|
+
>>> psmidx = ps.MultiIndex.from_tuples([("a", "x"), ("b", "y"), ("c", "z")])
|
|
1107
|
+
>>> psmidx.insert(3, ("h", "j")) # doctest: +SKIP
|
|
1108
|
+
MultiIndex([('a', 'x'),
|
|
1109
|
+
('b', 'y'),
|
|
1110
|
+
('c', 'z'),
|
|
1111
|
+
('h', 'j')],
|
|
1112
|
+
)
|
|
1113
|
+
|
|
1114
|
+
For negative values
|
|
1115
|
+
|
|
1116
|
+
>>> psmidx.insert(-2, ("h", "j")) # doctest: +SKIP
|
|
1117
|
+
MultiIndex([('a', 'x'),
|
|
1118
|
+
('h', 'j'),
|
|
1119
|
+
('b', 'y'),
|
|
1120
|
+
('c', 'z')],
|
|
1121
|
+
)
|
|
1122
|
+
"""
|
|
1123
|
+
validate_index_loc(self, loc)
|
|
1124
|
+
loc = loc + len(self) if loc < 0 else loc
|
|
1125
|
+
|
|
1126
|
+
index_name: List[Label] = [(name,) for name in self._internal.index_spark_column_names]
|
|
1127
|
+
sdf_before = self.to_frame(name=index_name)[:loc]._to_spark()
|
|
1128
|
+
sdf_middle = Index([item]).to_frame(name=index_name)._to_spark()
|
|
1129
|
+
sdf_after = self.to_frame(name=index_name)[loc:]._to_spark()
|
|
1130
|
+
sdf = sdf_before.union(sdf_middle).union(sdf_after)
|
|
1131
|
+
|
|
1132
|
+
internal = InternalFrame(
|
|
1133
|
+
spark_frame=sdf,
|
|
1134
|
+
index_spark_columns=[
|
|
1135
|
+
scol_for(sdf, col) for col in self._internal.index_spark_column_names
|
|
1136
|
+
],
|
|
1137
|
+
index_names=self._internal.index_names,
|
|
1138
|
+
index_fields=[InternalField(field.dtype) for field in self._internal.index_fields],
|
|
1139
|
+
)
|
|
1140
|
+
return DataFrame(internal).index
|
|
1141
|
+
|
|
1142
|
+
def item(self) -> Tuple[Scalar, ...]:
|
|
1143
|
+
"""
|
|
1144
|
+
Return the first element of the underlying data as a python tuple.
|
|
1145
|
+
|
|
1146
|
+
Returns
|
|
1147
|
+
-------
|
|
1148
|
+
tuple
|
|
1149
|
+
The first element of MultiIndex.
|
|
1150
|
+
|
|
1151
|
+
Raises
|
|
1152
|
+
------
|
|
1153
|
+
ValueError
|
|
1154
|
+
If the data is not length-1.
|
|
1155
|
+
|
|
1156
|
+
Examples
|
|
1157
|
+
--------
|
|
1158
|
+
>>> psmidx = ps.MultiIndex.from_tuples([('a', 'x')])
|
|
1159
|
+
>>> psmidx.item()
|
|
1160
|
+
('a', 'x')
|
|
1161
|
+
"""
|
|
1162
|
+
return self._psdf.head(2)._to_internal_pandas().index.item()
|
|
1163
|
+
|
|
1164
|
+
def intersection(self, other: Union[DataFrame, Series, Index, List]) -> "MultiIndex":
|
|
1165
|
+
"""
|
|
1166
|
+
Form the intersection of two Index objects.
|
|
1167
|
+
|
|
1168
|
+
This returns a new Index with elements common to the index and `other`.
|
|
1169
|
+
|
|
1170
|
+
Parameters
|
|
1171
|
+
----------
|
|
1172
|
+
other : Index or array-like
|
|
1173
|
+
|
|
1174
|
+
Returns
|
|
1175
|
+
-------
|
|
1176
|
+
intersection : MultiIndex
|
|
1177
|
+
|
|
1178
|
+
Examples
|
|
1179
|
+
--------
|
|
1180
|
+
>>> midx1 = ps.MultiIndex.from_tuples([("a", "x"), ("b", "y"), ("c", "z")])
|
|
1181
|
+
>>> midx2 = ps.MultiIndex.from_tuples([("c", "z"), ("d", "w")])
|
|
1182
|
+
>>> midx1.intersection(midx2).sort_values() # doctest: +SKIP
|
|
1183
|
+
MultiIndex([('c', 'z')],
|
|
1184
|
+
)
|
|
1185
|
+
"""
|
|
1186
|
+
if isinstance(other, Series) or not is_list_like(other):
|
|
1187
|
+
raise TypeError("other must be a MultiIndex or a list of tuples")
|
|
1188
|
+
elif isinstance(other, DataFrame):
|
|
1189
|
+
raise ValueError("Index data must be 1-dimensional")
|
|
1190
|
+
elif isinstance(other, MultiIndex):
|
|
1191
|
+
spark_frame_other = other.to_frame()._to_spark()
|
|
1192
|
+
keep_name = self.names == other.names
|
|
1193
|
+
elif isinstance(other, Index):
|
|
1194
|
+
# Always returns an empty MultiIndex if `other` is Index.
|
|
1195
|
+
return cast(MultiIndex, self.to_frame().head(0).index)
|
|
1196
|
+
elif not all(isinstance(item, tuple) for item in other):
|
|
1197
|
+
raise TypeError("other must be a MultiIndex or a list of tuples")
|
|
1198
|
+
else:
|
|
1199
|
+
other = MultiIndex.from_tuples(list(other))
|
|
1200
|
+
spark_frame_other = cast(MultiIndex, other).to_frame()._to_spark()
|
|
1201
|
+
keep_name = True
|
|
1202
|
+
|
|
1203
|
+
index_fields = self._index_fields_for_union_like(other, func_name="intersection")
|
|
1204
|
+
|
|
1205
|
+
default_name: List[Name] = [SPARK_INDEX_NAME_FORMAT(i) for i in range(self.nlevels)]
|
|
1206
|
+
spark_frame_self = self.to_frame(name=default_name)._to_spark()
|
|
1207
|
+
spark_frame_intersected = spark_frame_self.intersect(spark_frame_other)
|
|
1208
|
+
if keep_name:
|
|
1209
|
+
index_names = self._internal.index_names
|
|
1210
|
+
else:
|
|
1211
|
+
index_names = None
|
|
1212
|
+
|
|
1213
|
+
internal = InternalFrame(
|
|
1214
|
+
spark_frame=spark_frame_intersected,
|
|
1215
|
+
index_spark_columns=[
|
|
1216
|
+
scol_for(spark_frame_intersected, cast(str, col)) for col in default_name
|
|
1217
|
+
],
|
|
1218
|
+
index_names=index_names,
|
|
1219
|
+
index_fields=index_fields,
|
|
1220
|
+
)
|
|
1221
|
+
return cast(MultiIndex, DataFrame(internal).index)
|
|
1222
|
+
|
|
1223
|
+
def equal_levels(self, other: "MultiIndex") -> bool:
|
|
1224
|
+
"""
|
|
1225
|
+
Return True if the levels of both MultiIndex objects are the same
|
|
1226
|
+
|
|
1227
|
+
.. versionadded:: 3.3.0
|
|
1228
|
+
|
|
1229
|
+
Examples
|
|
1230
|
+
--------
|
|
1231
|
+
>>> psmidx1 = ps.MultiIndex.from_tuples([("a", "x"), ("b", "y"), ("c", "z")])
|
|
1232
|
+
>>> psmidx2 = ps.MultiIndex.from_tuples([("b", "y"), ("a", "x"), ("c", "z")])
|
|
1233
|
+
>>> psmidx1.equal_levels(psmidx2)
|
|
1234
|
+
True
|
|
1235
|
+
|
|
1236
|
+
>>> psmidx2 = ps.MultiIndex.from_tuples([("a", "x"), ("b", "y"), ("c", "j")])
|
|
1237
|
+
>>> psmidx1.equal_levels(psmidx2)
|
|
1238
|
+
False
|
|
1239
|
+
"""
|
|
1240
|
+
nlevels = self.nlevels
|
|
1241
|
+
if nlevels != other.nlevels:
|
|
1242
|
+
return False
|
|
1243
|
+
|
|
1244
|
+
self_sdf = self._internal.spark_frame
|
|
1245
|
+
other_sdf = other._internal.spark_frame
|
|
1246
|
+
subtract_list = []
|
|
1247
|
+
for nlevel in range(nlevels):
|
|
1248
|
+
self_index_scol = self._internal.index_spark_columns[nlevel]
|
|
1249
|
+
other_index_scol = other._internal.index_spark_columns[nlevel]
|
|
1250
|
+
self_subtract_other = self_sdf.select(self_index_scol).subtract(
|
|
1251
|
+
other_sdf.select(other_index_scol)
|
|
1252
|
+
)
|
|
1253
|
+
subtract_list.append(self_subtract_other)
|
|
1254
|
+
|
|
1255
|
+
unioned_subtracts = reduce(lambda x, y: x.union(y), subtract_list)
|
|
1256
|
+
return len(unioned_subtracts.head(1)) == 0
|
|
1257
|
+
|
|
1258
|
+
@property
|
|
1259
|
+
def hasnans(self) -> bool:
|
|
1260
|
+
raise NotImplementedError("hasnans is not defined for MultiIndex")
|
|
1261
|
+
|
|
1262
|
+
@property
|
|
1263
|
+
def inferred_type(self) -> str:
|
|
1264
|
+
"""
|
|
1265
|
+
Return a string of the type inferred from the values.
|
|
1266
|
+
"""
|
|
1267
|
+
# Always returns "mixed" for MultiIndex
|
|
1268
|
+
return "mixed"
|
|
1269
|
+
|
|
1270
|
+
@property
|
|
1271
|
+
def asi8(self) -> None:
|
|
1272
|
+
"""
|
|
1273
|
+
Integer representation of the values.
|
|
1274
|
+
"""
|
|
1275
|
+
# Always returns None for MultiIndex
|
|
1276
|
+
return None
|
|
1277
|
+
|
|
1278
|
+
def factorize(
|
|
1279
|
+
self, sort: bool = True, na_sentinel: Optional[int] = -1
|
|
1280
|
+
) -> Tuple["MultiIndex", pd.Index]:
|
|
1281
|
+
return MissingPandasLikeMultiIndex.factorize(self, sort=sort, na_sentinel=na_sentinel)
|
|
1282
|
+
|
|
1283
|
+
def __iter__(self) -> Iterator:
|
|
1284
|
+
return MissingPandasLikeMultiIndex.__iter__(self)
|
|
1285
|
+
|
|
1286
|
+
def map(
|
|
1287
|
+
self,
|
|
1288
|
+
mapper: Union[dict, Callable[[Any], Any], pd.Series] = None,
|
|
1289
|
+
na_action: Optional[str] = None,
|
|
1290
|
+
) -> "Index":
|
|
1291
|
+
return MissingPandasLikeMultiIndex.map(self, mapper, na_action)
|
|
1292
|
+
|
|
1293
|
+
|
|
1294
|
+
def _test() -> None:
|
|
1295
|
+
import os
|
|
1296
|
+
import doctest
|
|
1297
|
+
import sys
|
|
1298
|
+
import numpy
|
|
1299
|
+
from pyspark.sql import SparkSession
|
|
1300
|
+
import pyspark.pandas.indexes.multi
|
|
1301
|
+
|
|
1302
|
+
os.chdir(os.environ["SPARK_HOME"])
|
|
1303
|
+
|
|
1304
|
+
globs = pyspark.pandas.indexes.multi.__dict__.copy()
|
|
1305
|
+
globs["np"] = numpy
|
|
1306
|
+
globs["ps"] = pyspark.pandas
|
|
1307
|
+
spark = (
|
|
1308
|
+
SparkSession.builder.master("local[4]")
|
|
1309
|
+
.appName("pyspark.pandas.indexes.multi tests")
|
|
1310
|
+
.getOrCreate()
|
|
1311
|
+
)
|
|
1312
|
+
(failure_count, test_count) = doctest.testmod(
|
|
1313
|
+
pyspark.pandas.indexes.multi,
|
|
1314
|
+
globs=globs,
|
|
1315
|
+
optionflags=doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE,
|
|
1316
|
+
)
|
|
1317
|
+
spark.stop()
|
|
1318
|
+
if failure_count:
|
|
1319
|
+
sys.exit(-1)
|
|
1320
|
+
|
|
1321
|
+
|
|
1322
|
+
if __name__ == "__main__":
|
|
1323
|
+
_test()
|