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

Cannot infer dst time from Timestamp('2015-11-01 01:00:10'), try using the 'ambiguous' argument #11619

Closed
vgoklani opened this Issue Nov 16, 2015 · 1 comment

Comments

Projects
None yet
2 participants
@vgoklani

vgoklani commented Nov 16, 2015

running pandas 0.17, and getting this error when generating a csv, traceback is below. What exactly does "try using the ambigous argument mean"?

df.to_csv("VIP_data.csv", encoding="utf-8", index=False)


AmbiguousTimeError Traceback (most recent call last)
in ()
----> 1 df.to_csv("VIP_data.csv", encoding="utf-8", index=False)

/opt/anaconda/lib/python2.7/site-packages/pandas/core/frame.pyc in to_csv(self, path_or_buf, sep, na_rep, float_format, columns, header, index, index_label, mode, encoding, quoting, quotechar, line_terminator, chunksize, tupleize_cols, date_format, doublequote, escapechar, decimal, **kwds)
1287 escapechar=escapechar,
1288 decimal=decimal)
-> 1289 formatter.save()
1290
1291 if path_or_buf is None:

/opt/anaconda/lib/python2.7/site-packages/pandas/core/format.pyc in save(self)
1492
1493 else:
-> 1494 self._save()
1495
1496 finally:

/opt/anaconda/lib/python2.7/site-packages/pandas/core/format.pyc in _save(self)
1592 break
1593
-> 1594 self._save_chunk(start_i, end_i)
1595
1596 def _save_chunk(self, start_i, end_i):

/opt/anaconda/lib/python2.7/site-packages/pandas/core/format.pyc in _save_chunk(self, start_i, end_i)
1607 decimal=self.decimal,
1608 date_format=self.date_format,
-> 1609 quoting=self.quoting)
1610
1611 for col_loc, col in zip(b.mgr_locs, d):

/opt/anaconda/lib/python2.7/site-packages/pandas/core/internals.pyc in to_native_types(self, slicer, na_rep, date_format, quoting, **kwargs)
1999
2000 from pandas.core.format import _get_format_datetime64_from_values
-> 2001 format = _get_format_datetime64_from_values(values, date_format)
2002
2003 result = tslib.format_array_from_datetime(values.view('i8').ravel(),

/opt/anaconda/lib/python2.7/site-packages/pandas/core/format.pyc in _get_format_datetime64_from_values(values, date_format)
2189 def _get_format_datetime64_from_values(values, date_format):
2190 """ given values and a date_format, return a string format """
-> 2191 is_dates_only = _is_dates_only(values)
2192 if is_dates_only:
2193 return date_format or "%Y-%m-%d"

/opt/anaconda/lib/python2.7/site-packages/pandas/core/format.pyc in _is_dates_only(values)
2143 def _is_dates_only(values):
2144 # return a boolean if we are only dates (and don't have a timezone)
-> 2145 values = DatetimeIndex(values)
2146 if values.tz is not None:
2147 return False

/opt/anaconda/lib/python2.7/site-packages/pandas/util/decorators.pyc in wrapper(_args, *_kwargs)
87 else:
88 kwargs[new_arg_name] = new_arg_value
---> 89 return func(_args, *_kwargs)
90 return wrapper
91 return _deprecate_kwarg

/opt/anaconda/lib/python2.7/site-packages/pandas/tseries/index.pyc in new(cls, data, freq, start, end, periods, copy, name, tz, verify_integrity, normalize, closed, ambiguous, dtype, **kwargs)
342 ints = subarr.view('i8')
343 subarr = tslib.tz_localize_to_utc(ints, tz,
--> 344 ambiguous=ambiguous)
345
346 subarr = subarr.view(_NS_DTYPE)

pandas/tslib.pyx in pandas.tslib.tz_localize_to_utc (pandas/tslib.c:64516)()

AmbiguousTimeError: Cannot infer dst time from Timestamp('2015-11-01 01:00:10'), try using the 'ambiguous' argument

@jreback

This comment has been minimized.

Show comment
Hide comment
@jreback

jreback Nov 16, 2015

Contributor

can you show a sample of the frame, as well as df.info()

Contributor

jreback commented Nov 16, 2015

can you show a sample of the frame, as well as df.info()

@jreback jreback added this to the 0.17.1 milestone Nov 17, 2015

jreback added a commit to jreback/pandas that referenced this issue Nov 17, 2015

BUG: date_range creation with an ambiguous endpoint, pandas-dev#11619
TST: some tests for datetime tz aware serialized to/from csv/hdf

@jreback jreback removed this from the 0.17.1 milestone Nov 17, 2015

@jreback jreback removed the Bug label Nov 17, 2015

jreback added a commit that referenced this issue Nov 17, 2015

Merge pull request #11627 from jreback/ambiguous
BUG: date_range creation with an ambiguous endpoint, #11619

jreback added a commit to jreback/pandas that referenced this issue Nov 18, 2015

@jreback jreback added this to the 0.17.1 milestone Nov 18, 2015

jreback added a commit that referenced this issue Nov 18, 2015

Merge pull request #11641 from jreback/ambig
TST: tests for outputing ambiguous times, #11619, fixed already in #11301
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment