Skip to content
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

more datetime conversion issues #9

Open
rotten opened this issue Sep 13, 2016 · 1 comment
Open

more datetime conversion issues #9

rotten opened this issue Sep 13, 2016 · 1 comment

Comments

@rotten
Copy link

rotten commented Sep 13, 2016

In date_util.py you have:

def format_timestamp(indf, index=0):
    if indf.dtypes[0].type is np.datetime64:
        return indf

Unfortunately my column is type:
datetime64[ns, UTC]

So it doesn't match and we fall through to the regexes which choke on the data type.

The problem, I think, is that I have timezone aware datetime types. Simply converting the timestamp column to a string did not work.

So, I stripped the timezones off before converting it to a string and that seemed to do the trick:

    df['mytimecolumn'] = pandas.to_datetime(df['mytimecolumn'])
    df['mytimecolumn'] = df['mytimecolumn'].dt.strftime('%Y-%m-%d %H:%M:%S')
@rotten
Copy link
Author

rotten commented Sep 14, 2016

Oh, I should mention that when I feed the string datetimes into pyculiarity I do get these warnings now:

/usr/local/lib/python2.7/site-packages/pyculiarity/detect_ts.py:179: FutureWarning: iget(i) is deprecated. Please use .iloc[i] or .iat[i]
  last_date = df.timestamp.iget(-1)
/usr/local/lib/python2.7/site-packages/pyculiarity/detect_ts.py:184: FutureWarning: iget(i) is deprecated. Please use .iloc[i] or .iat[i]
  start_date = df.timestamp.iget(j)
/usr/local/lib/python2.7/site-packages/pyculiarity/detect_ts.py:187: FutureWarning: iget(i) is deprecated. Please use .iloc[i] or .iat[i]
  df.timestamp.iget(-1))
/usr/local/lib/python2.7/site-packages/pyculiarity/detect_anoms.py:81: FutureWarning: convert_objects is deprecated.  Use the data-type specific converters pd.to_datetime, pd.to_timedelta and pd.to_numeric.
  'value': (decomp['trend'] + decomp['seasonal']).truncate().convert_objects(convert_numeric=True)

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

No branches or pull requests

1 participant