Skip to content

timespan parsing is broken in dataframe_from_result_table when days and seconds co-exists #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Intaik opened this issue Nov 14, 2018 · 1 comment
Assignees
Labels

Comments

@Intaik
Copy link

Intaik commented Nov 14, 2018

the following lambda fails to parse timespan correctly on when days and seconds co-exists.
ex> Kusto timespan: 7.04:44:01.5115511 (7 days, 4 hrs, 44 min, 1.5115511 seconds) will results in "7 days 04:44:01 days 5115511" string passed to pd.to_timedelta, which will produce "67 days 09:42:31" incorrectly. only the first dot should be replaced with "days"

if col_type.lower() == "timespan":

        frame[col_name] = pandas.to_timedelta(

            frame[col_name].apply(lambda t: t.replace(".", " days ") if t and "." in t.split(":")[0] else t)

        )
@toshetah toshetah self-assigned this Dec 5, 2018
@toshetah toshetah added the bug label Dec 5, 2018
toshetah added a commit that referenced this issue Dec 5, 2018
@toshetah
Copy link
Contributor

Thanks Intaik for reporting this. If you encounter this issue again please reopen it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants