Let's say I have a data framework with the following information:
Name Points String
John 24 FTS8500001A
Richard 35 FTS6700001B
John 29 FTS2500001A
Richard 35 FTS3800001B
John 34 FTS4500001A
Here's how to get a DataFrame with the sample above:
import pandas as pd keys = ('Name', 'Points', 'String') names = pd.Series(('John', 'Richard', 'John', 'Richard', 'John')) ages = pd.Series((24,35,29,35,34)) strings = pd.Series(('FTS8500001A','FTS6700001B','FTS2500001A','FTS3800001B','FTS4500001A')) df = pd.concat((names, ages, strings), axis=1, keys=keys)
I want to select each row that matches the following criteria: Name = Richard And Points = 35. And for such rows, I want to read the 4th and 5th char of the String column (two numbers immediately after FTS).
I want to get the output of numbers 67 and 38.
Ive tried several ways to achieve this, but with zero results. Could you help me?
Thank you very much.
Eduardo
source share