chemcoord.Cartesian.iloc

Cartesian.iloc

Label based indexing

The indexing behaves like Indexing and Selecting data in Pandas. You can slice with loc(), iloc() and Cartesian[...]. The only question is about the return type. If the information in the columns is enough to draw a molecule, an instance of the own class (e.g. Cartesian) is returned. If the information in the columns is not enough to draw a molecule, there are two cases to consider:

  • A Series instance is returned for one dimensional slices.
  • A DataFrame instance is returned in all other cases.

This means that:

molecule.loc[:, ['atom', 'x', 'y', 'z']] returns a Cartesian.

molecule.loc[:, ['atom', 'x']] returns a pandas.DataFrame.

molecule.loc[:, 'atom'] returns a pandas.Series.