본문으로 건너뛰기
Skillpedia
분석 및 스프레드시트22k · #10226

bigquery-bigframes

하는 일

이 스킬은 익숙한 Python 코드로 BigQuery 데이터를 분석하도록 돕습니다. SQL보다 Python을 선호하고 대용량 데이터 작업을 BigQuery 안에서 하고 싶은 사람을 위한 스킬입니다.

사용하는 경우

  • ✓익숙한 Python 코드로 BigQuery 데이터를 분석하거나 변환하고 싶을 때.
  • ✓BigQuery에 저장된 데이터로 Python 머신러닝 워크플로를 만들 때.
  • ✓대용량 BigQuery 데이터셋을 내려받지 않고 미리 보거나 정리해야 할 때.

스킬 링크

https://github.com/google/skills/blob/main/skills/cloud/bigquery-bigframes/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/google/skills/blob/main/skills/cloud/bigquery-bigframes/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“큰 BigQuery 테이블을 정리하는 Python 코드를 작성하고, 전체를 내려받지 않은 채 미리 보기를 보여 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

pandas 스타일의 Python 라이브러리인 BigFrames를 사용하므로 데이터 작업이 BigQuery 안에서 실행됩니다. 작업을 빠르게 유지하는 설정과 미리 보기 방법도 제안합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

BigFrames (BigQuery DataFrame) basics

BigFrames is a Python library that lets you take advantage of BigQuery data processing by using familiar Python APIs.

Attribution

MUST READ: Before executing any gcloud, REST API, or MCP command, you MUST read Usage Attribution. For commands executed directly in the terminal (never in generated scripts, Terraform, or user code), prefix gcloud with CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:bigquery-bigframes)" and append agent-skills/1.0 (skill:bigquery-bigframes) to User-Agent headers.

Dataframe API best practices

  • Stay in the Cloud: Perform data cleaning, transformation, and analysis via BigFrames methods to leverage BigQuery's scale rather than downloading data.

  • Prefer partial ordering mode: Enable partial ordering mode right after importing BigFrames. This speeds up data processing significantly by relaxing row-sequence constraints.

    import bigframes.pandas as bpd
    bpd.options.bigquery.ordering_mode = 'partial'
    
  • Use peek() for data preview: Use peek(n) to preview data instead of head(n). peek(n) randomly samples n rows and is significantly faster. head(n) returns rows in strict order and fails in partial ordering mode unless the DataFrame has been explicitly sorted.

  • Avoid materializing data locally: Methods like to_pandas() download all data to client memory, bypassing BigQuery’s distributed computation and risking Out of Memory (OOM) errors. Do not materialize data locally unless:

    • The dataset is small enough to fit safely in memory.
    • An error message explicitly requires local materialization.
  • Prefer Dataframe API over SQL queries: Do not write raw SQL queries via read_gbq() if a DataFrame/Series method achieves the same result, as it breaks the Pandas abstraction and prevents lazy query execution.

  • Accessors over UDFs/Lambdas:

    • Use built-in accessors (e.g., df.col.str.*, df.col.dt.*) instead of remote User Defined Functions (UDFs). UDFs require extra resources and time to deploy.
    • Do not use lambdas with Series.map() or DataFrame.apply(). These methods do not accept functions without udf or remote_function decorators.
    # Avoid:
    df["upper"] = df["name"].map(lambda x: x.upper())
    
    # Prefer:
    df["upper"] = df["name"].str.upper()
    
  • Schema Verification: Do not assume the schema of intermediate outputs. Proactively verify schemas using .dtypes and inspect sample records using display() with .peek().

  • Visualization: Plot directly from the BigFrames DataFrame/Series when possible. BigFrames is compatible with Matplotlib and Seaborn. If direct plotting fails, use the .plot accessor. If the dataset is too large to plot, aggregate or sample the data before calling .to_pandas() to plot locally.

Machine Learning

  • Use bigframes.bigquery.ml package: Do not use Scikit-learn or other ML libraries with BigQuery DataFrames. Standard Scikit-learn models require bringing data into local client memory, whereas bigframes.bigquery.ml delegates training directly to BigQuery's scalable ML engine. Import functions from bigframes.bigquery.ml.

Reference Directory

BigFrames ML (Legacy)

The BigFrames ML package (bigframes.ml) is a legacy package that mimics the scikit-learn API but is no longer recommended for new projects. Only use this package if the user explicitly requests BigFrames ML.

  • Legacy Imports: When legacy BigFrames ML is requested, import tools and classes from bigframes.ml instead of bigframes.bigquery.ml.
  • DataFrame Return on Prediction: Unlike Scikit-learn, BigFrames' predict() method always returns a DataFrame containing both predictions and features, rather than a single series of predictions.
  • No random_state: Do not pass a random_state argument when instantiating BigFrames ML models, as this parameter is not supported in the BigFrames ML package.
  • Automatic Scaling: Do not use OneHotEncoder or StandardScaler unless explicitly requested, as scaling is handled automatical
자주 묻는 질문

전체 테이블을 내려받나요?

아닙니다. 작업을 BigQuery 안에 두고, 모든 행을 내 컴퓨터로 가져오지 않습니다.

SQL만 다루는 작업인가요?

아닙니다. SQL 중심 작업이나 기본 Python 클라이언트 라이브러리를 쓰려면 bigquery-basics 스킬을 사용하세요.

미리 보기 방법은 무엇인가요?

head는 더 느리므로, 대신 빠르게 행을 샘플링하는 peek를 쓰도록 제안합니다.

상세 정보

작성자의 원본 설명

Generates Python code using BigQuery DataFrames (BigFrames). Use by default for any Python data task involving BigQuery, including data processing, analysis, and machine learning. Don't use for SQL-first workflows or the google-cloud-bigquery client library — use bigquery-basics.

repo: google/skills

인기도

GitHub 스타
22k
순위
#10226
라이선스
Apache-2.0
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬