COLLAPSE ALL
  • Home
  • About Pixie
    • Pixie Overview
    • Data Sources
    • How Pixie uses eBPF
    • Roadmap
    • FAQ
    • Troubleshooting
  • Installing Pixie
    • Requirements
  • Using Pixie
    • Using the Live UI
    • Using the CLI
    • Using the API
  • Tutorials
  • Reference
    • Architecture
    • PxL
      • DataFrame
        • DataFrame.__getitem__
        • DataFrame.agg
        • DataFrame.append
        • DataFrame.ctx.__getitem__
        • DataFrame.DataFrame
        • DataFrame.drop
        • DataFrame.filter
        • DataFrame.groupby
        • DataFrame.head
        • DataFrame.map
        • DataFrame.merge
        • DataFrame.rolling
        • DataFrame.stream
        • px.debug
        • px.display
        • px.export

DataFrame.__getitem__

Keeps only the specified columns.

Returns a DataFrame with only the specified columns. Useful for pruning columns to a small set before data is displayed. See drop() on how to drop specific columns instead.

Arguments

NameTypeDescription
columnsList[str]DataFrame columns to keep.

Returns

px.DataFrame: DataFrame with the specified columns removed.

Examples

df = px.DataFrame('process_stats', select=['upid', 'cpu_ktime_ns', 'rss_bytes'])
# Keep only the upid and rss_bytes columns
df = df[['upid', 'rss_bytes']]

This site uses cookies to provide you with a better user experience. By using Pixie, you consent to our use of cookies.