designing an application I am looking for the best datastructure that should be used for passing 2D arrays between pure functions.
I would like them to be, by decreasing order of preference:
- immutable
- preferably from the native Python library
- easily converted to Pandas Dataframe which will be used in most (but not all) functions
- enabling fast execution (read) times.
Right now I am leaning towards tuple of tuples:
data=(("header a", "header b", "header c"), (1, 2, 3), (2, 3, 5))
but the idea of converting them to pandas dataframe like this:
df = pd.DataFrame(data=data[1:], columns=data[0])
does not quite feel the most Pythonic.
What would be the best "There should be one-- and preferably only one --obvious way to do it."?