Is it possible to define a new type (or alias) which refers to a pandas DataFrame with specific columns or indices?
For example, in the same code I often use a DataFrame with columns x and z. Also as slices of it, Series with the indices x and z. Let's say I want to call these Curve and Point.
Is there a method similar to this, in order to be more specific than just hinting to a general DataFrame?
import pandas as pd
Curve = type(pd.Dataframe(columns=['x','z']))
Point = type(pd.Series(index=['x', 'z']))
def function(a: Curve) -> Point:
return a.iloc[0]