excel_colnum

mdtools.numpy_helper_functions.excel_colnum(name)[source]

Convert an Excel-style column name to its corresponding integer number.

Parameters:

name (str) – Excel-style column name to convert to column number. Also name = '0' is accepted, in wich case the return value will be 0.

Returns:

col_num (int) – Column number.

Examples

>>> mdt.nph.excel_colnum('0')
0
>>> mdt.nph.excel_colnum('A')
1
>>> mdt.nph.excel_colnum('a')
1
>>> mdt.nph.excel_colnum('Z')
26
>>> mdt.nph.excel_colnum('AA')
27
>>> mdt.nph.excel_colnum('aa')
27
>>> mdt.nph.excel_colnum('Aa')
27
>>> mdt.nph.excel_colnum('aA')
27