EXPAND ALL
  • Home

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.