I am looking to create a new DataFrame that corresponds to the results of Devices A and B based on Silicon.
The following is my code for creating the DataFrame:
import numpy as np
import pandas as pd
x = np.array(
[
[0.26, 0.92, 0.05, 0.43],
[1.00, 0.62, 1.00, 1.00],
[1.00, 0.97, 0.04, 1.00],
[0.00, 1.00, 1.00, 0.88],
[1.00, 1.00, 1.00, 0.79],
[0.98, 1.00, 0.79, 0.99],
[0.99, 1.00, 1.00, 1.00],
[0.18, 1.00, 0.26, 1.00],
[0.22, 0.00, 0.34, 0.82],
]
)
rowIndx = pd.MultiIndex.from_product(
[["Slurm", "Zoidberg", "Wernstrom"], ["A", "B", "C"]],
names=["Laboratory", "Device"],
)
colIndex = pd.MultiIndex.from_product(
[["Replicant 1 ", "Replicant 2 "], ["Silicon", "Carbon"]]
)
robot = pd.DataFrame(data=x, index=rowIndx, columns=colIndex)
robot
Here is an image of the table.

This is the code that I thought would somewhat work, but it just gives me errors, so now I don't know what to try,
robot[(robot.Device=="A") & (robot.Device=="B")][["Silicon"]]
robot.Devicecannot be equal to "A" & "B" at the same time. You need "|".robot[(robot.Device=="A") | (robot.Device=="B")]. Secondly you have a multiindex dataframe and if you want to access robot.Device one way isreset_index()reset_index()? I am open to other options. I am very poor at Python, and from the limited knowledge I have, this was just the only code that was the closest code I could remember.