python pandas extract unique dates from time series

If you have a Series like: In [116]: df[“Date”] Out[116]: 0 2012-10-08 07:12:22 1 2012-10-08 09:14:00 2 2012-10-08 09:15:00 3 2012-10-08 09:15:01 4 2012-10-08 09:15:01.500000 5 2012-10-08 09:15:02 6 2012-10-08 09:15:02.500000 7 2012-10-10 07:19:30 8 2012-10-10 09:14:00 9 2012-10-10 09:15:00 10 2012-10-10 09:15:01 11 2012-10-10 09:15:01.500000 12 2012-10-10 09:15:02 Name: Date where each object is … Read more

decompose() for time series: ValueError: You must specify a period or x must be a pandas object with a DatetimeIndex with a freq not set to None

Having the same ValueError, this is just the result of some testing and little research on my own, without the claim to be complete or professional about it. Please comment or answer whoever finds something wrong. Of course, your data should be in the right order of the index values, which you would assure with … Read more

pandas.DatetimeIndex frequency is None and can’t be set

You have a couple options here: pd.infer_freq pd.tseries.frequencies.to_offset I suspect that errors down the road are caused by the missing freq. You are absolutely right. Here’s what I use often: def add_freq(idx, freq=None): “””Add a frequency attribute to idx, through inference or directly. Returns a copy. If `freq` is None, it is inferred. “”” idx … Read more

Creating graph with date and time in ticklabels with matplotlib

I hope this helps. I’ve always had a hard time with matplotlib’s dates. Matplotlib requires a float format which is days since epoch. The helper functions num2date and date2num along with python builtin datetime can be used to convert to/from. The formatting business was lifted from this example. You can change an axis on any … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)