技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
koalas【数据与研究】Use Koalas, the legacy pandas API on Apache Spark, for DataFrame, Spark I/O, SQL, options, plotting, and migration workflows.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this skill when a task involves legacy Databricks Koalas (databricks.koalas), the pandas-like API backed by Apache Spark. Koalas is maintenance-mode software: for Spark 3.2 and newer, prefer pyspark.pandas unless the user must keep existing Koalas 1.x code.
--mode import, --mode options, --mode dataframe, or --mode all.# Conda is usually safest for legacy Python/Spark/PyArrow combinations.
conda install -c conda-forge koalas
# Pip package; add [spark] if PySpark is not already installed.
pip install "koalas[spark]"
Minimal import check:
import databricks.koalas as ks
print(ks.__version__)
A useful local Spark smoke run normally needs Java, PySpark, compatible pandas/numpy/pyarrow, and early environment settings such as SPARK_LOCAL_IP=127.0.0.1, PYARROW_IGNORE_TIMEZONE=1, and matching PYSPARK_PYTHON / PYSPARK_DRIVER_PYTHON when workers otherwise pick another Python.
Use core-dataframes for:
DataFrame, Series, and Index objects.ks.from_pandas, ks.range, ks.concat, ks.merge, ks.melt, ks.get_dummies, ks.to_datetime, and ks.date_range.to_pandas() collection is bounded and safe.Use spark-io-sql for:
to_spark, Spark DataFrame.to_koalas, explicit index_col, and .spark accessors.read_csv, read_parquet, read_json, read_delta, read_table, read_spark_io, read_sql*, read_orc, and corresponding writers.ks.sql, JDBC databases, Spark catalog tables, Delta/File format setup, plan inspection, checkpoint/cache/repartition/hints, and path semantics.Use apply-groupby-window for:
apply, transform, koalas.apply_batch, koalas.transform_batch, and Series batch transforms.GroupBy.apply, GroupBy.transform, agg/aggregate, ks.NamedAgg, reductions, rolling, expanding, and groupby rolling/expanding.Use configuration-extensions for:
ks.options, get_option, set_option, reset_option, and option_context..koalas accessor orientation, MLflow wrapper use, and PySpark 3.2+ migration warnings.to_pandas(), to_numpy(), Python iteration, plotting, Excel/HTML export, or full-result equality checks.index_col on Spark-to-Koalas reads/conversions and on Koalas-to-Spark/file writes.koalas[plotly], koalas[matplotlib], koalas[mlflow], or a Spark/JDBC/Delta connector required by the task.pyspark.pandas and validate behavior changes instead of expanding old Koalas code.