There are constraints on what can be in a component array specification, that for non-allocatable/non-pointer components allow the specification to be evaluated at compile time (at the point that a type declaration for an object of the type being defined is encountered). Specifically, the value of a bound in the specification must not depend on the value of a variable - see C446 in F2008 for the details.
The component n
in some object of type dataframe is a variable; calculating sum(n)
requires its value; you are violating the constraint.
Length type parameters, even if your compiler supported them, can only be scalar.
As you've concluded - using an allocatable component, and allocating things correctly in some sort of construction procedure is the way to go.