I am attempting to sort SrcWell by the value's index position 1. I understand there is a keyword argument key, which is similar in behavior to key in sorted, however I receive a ValueError when attempting to sort using key. Here is an example CSV file to be loaded as a pandas DataFrame:
SrcPlate SrcWell
PS000000123456 A4
PS000000123456 B7
PS000000123456 A7
PS000000123456 H6
PS000000123456 G6
PS000000123456 F6
And a small script to sort SrcWell by its numerical values:
import pandas as pd
worklist = pd.read_csv('worklist.csv')
print(worklist.sort_values(by="SrcWell", key=lambda x: int(x[1])))
>>> [...] ValueError: invalid literal for int() with base 10: 'B7'