You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are specifically interested in this because we've been trying to move towards using enum.Enum classes to remove column-name string constants from our code, which works well in many cases, but fails badly when there's a datetime index. Just as an example, we might do something like
But with a DateTime index, it eventually gets here where apparently str subclasses are no longer accepted and a TypeError is raised.
I see two easy solutions (i.e. that I could easily submit a PR for):
Convert the key to a normal string either here or in the subclass implementations thereof
Watch for TypeErrors here in addition to the other known types there, allowing it to gracefully continue on and try the key as a column name (which will then succeed)
I can also envision fixing this by
3. extending the low-level parsing function to work better with this case, or
4. finishing the deprecation of row lookups using regular frame[indx] notation
However solution 3 is outside my comfort zone, and 4 seems like it might be more involved anyway.
It feels to me like solution 3 is the "correct" resolution to this problem, and that 1 is almost as good (if applied in all the right places), but since it's not my project, I wanted to get feedback before trying to jump in to any of these.
The text was updated successfully, but these errors were encountered:
mortada
added a commit
to mortada/pandas
that referenced
this issue
May 10, 2021
Consider the following code:
We are specifically interested in this because we've been trying to move towards using
enum.Enum
classes to remove column-name string constants from our code, which works well in many cases, but fails badly when there's a datetime index. Just as an example, we might do something likeAs far as I can tell, what's going on is:
TypeError
is raised.I see two easy solutions (i.e. that I could easily submit a PR for):
TypeError
s here in addition to the other known types there, allowing it to gracefully continue on and try the key as a column name (which will then succeed)I can also envision fixing this by
3. extending the low-level parsing function to work better with this case, or
4. finishing the deprecation of row lookups using regular
frame[indx]
notationHowever solution 3 is outside my comfort zone, and 4 seems like it might be more involved anyway.
It feels to me like solution 3 is the "correct" resolution to this problem, and that 1 is almost as good (if applied in all the right places), but since it's not my project, I wanted to get feedback before trying to jump in to any of these.
The text was updated successfully, but these errors were encountered: