A type for metadata?

It seems reasonable to associate some meta data to columns in a DataFrame. Having to track them in a separate Dict would possibly backfire because you would have to maintain the consistency between two separate data structures.

Consider the case of reading data from a relational database. Each column has metadata like data type, length, precision, allow nulls, etc. Often these are good information that is very handy when processing query results.

Something like this would be fairly easy to implement in DataFrames?

putmeta!(df, :column1, @NT(kind = :level))
putmeta!(df, :column2, @NT(kind = :rate))
getmeta(df, :column1)  # returns @NT(kind = :level)
colswith(df, t => t.kind == :level)  # returns an iterator over :level columns
6 Likes