static-frame / frame-fixtures

Use compact expressions to create diverse, deterministic DataFrame fixtures with StaticFrame
Other
8 stars 0 forks source link

Support all StaticFrame `Index` `datetime64` types #6

Closed flexatone closed 1 year ago

flexatone commented 1 year ago

Presently frame-fixtures does not support all Static-Frame index types due to a name conflict in the way abbreviations are presently constructed.

For the basic types, Index is represented as "I", and IndexHierarchy is represented as: "IH".

However, while IndexDate can be given as "ID", following the same approach for IndexHour would result in "IH", colliding with IndexHierarchy. Similarly, IndexMillisecond and IndexMicrosecond would both map to "IM".

To avoid these conflicts, one option is to add the characters "DT" (for datetime) and use the case-sensitive representation that NumPy already uses for units, where, for example, "M" is month, "m" is minute, "ms" is millisecond, etc.

IndexYearMont: "IDTM" (presently "IYM") IndexDate: "IDTD" (presently "ID") IndexHour: "IDTh" IndexMinute: "IDTm" IndexMillisecond: "IDTms" IndexNanosecond: "IDTns" (presently "IN")

This would be a backwards incompatible change made as part of the 1.0 release.

Happy to hear feedback or other suggestions.

michaeljpeters commented 1 year ago

I think case sensitivity is a great way to represent these differences concisely. For ease of typing these out, I would consider shortening DT to D or removing DT all together.

Removing DT completely gives a closer representation to the python class names.

Shortest: IndexHierarchy: IH IndexHour: Ih IndexDate: ID IndexMonth: IM IndexMinute: Im IndexMillisecond: Ims ...

flexatone commented 1 year ago

Thanks, @michaeljpeters ! I like your suggestions... I guess I thought IH was too close to Ih but maybe it is fine, and I do appreciate that these stay concise. Plus, this is nearly backwards compatible.