Home > Enterprise >  Pandas Pivot chart with filtering
Pandas Pivot chart with filtering

Time:07-21

I have a data frame as shown below.It's name is 'df_IBIAS_mode1_FUN'

enter image description here

I need to plot a pivot chart with index='Device_ID'', columns='Temp(deg)', values='ibias_post_trim[MHz]' for all values of Supply[V]=2.5.

Below is my code for making the pivot table.

df_IBIAS_mode1_FUN[df_IBIAS_mode1_FUN.Supply[V] == 2.5].pivot_table(index='Device_ID', columns='Temp(deg)', values='ibias_post_trim[MHz')
    

This coding throwing an error as shown below.May I know where I went wrong.

*AttributeError: 'DataFrame' object has no attribute 'Supply'*

CodePudding user response:

You can use ['Supply[V]'] to access Supply[V] column

df_IBIAS_mode1_FUN[df_IBIAS_mode1_FUN['Supply[V]'] == 2.5].pivot_table(index='Device_ID', columns='Temp(deg)', values='ibias_post_trim[MHz')

CodePudding user response:

You will need to use quotations to access the column, as the column name contains square brackets. You are also missing a square bracket towards the end:

df_IBIAS_mode1_FUN[df_IBIAS_mode1_FUN["Supply[V]"] == 2.5].pivot_table(index='Device_ID', columns='Temp(deg)', values='ibias_post_trim[MHz]')
  • Related