Giter VIP home page Giter VIP logo

datetransform's People

Stargazers

 avatar

Watchers

 avatar  avatar

datetransform's Issues

Make "inplace" optional

Currently the dataframe is edited inplace. Make this an optional argument that defaults to False so a copy of the dataframe is updated.

Timezone aware timestamps failing

ValueError Traceback (most recent call last)
in
----> 9 df = add_date_features(df, 'datetime_col')

~/opt/anaconda3/envs/model-call-projections/lib/python3.6/site-packages/datetransform/transform.py in add_date_features(df, date_field_name, time, inplace)
5 if not inplace:
6 df = df.copy()
----> 7 make_date(df, date_field_name)
8 field = df[date_field_name]
9 attr = ['Year', 'Month', 'Week', 'Day', 'DayOfWeek', 'DayOfYear', 'Is_Month_End', 'Is_Month_Start',

~/opt/anaconda3/envs/model-call-projections/lib/python3.6/site-packages/datetransform/transform.py in make_date(df, date_field_name)
22 field_dtype = np.datetime64
23 if not np.issubdtype(field_dtype, np.datetime64):
---> 24 df[date_field_name] = pd.to_datetime(df[date_field_name], infer_datetime_format=True)

~/opt/anaconda3/envs/model-call-projections/lib/python3.6/site-packages/pandas/core/tools/datetimes.py in to_datetime(arg, errors, dayfirst, yearfirst, utc, box, format, exact, unit, infer_datetime_format, origin, cache)
590 else:
591 from pandas import Series
--> 592 values = convert_listlike(arg._values, True, format)
593 result = Series(values, index=arg.index, name=arg.name)
594 elif isinstance(arg, (ABCDataFrame, compat.MutableMapping)):

~/opt/anaconda3/envs/model-call-projections/lib/python3.6/site-packages/pandas/core/tools/datetimes.py in _convert_listlike_datetimes(arg, box, format, name, tz, unit, errors, infer_datetime_format, dayfirst, yearfirst, exact)
300 arg, dayfirst=dayfirst, yearfirst=yearfirst,
301 utc=utc, errors=errors, require_iso8601=require_iso8601,
--> 302 allow_object=True)
303
304 if tz_parsed is not None:

~/opt/anaconda3/envs/model-call-projections/lib/python3.6/site-packages/pandas/core/arrays/datetimes.py in objects_to_datetime64ns(data, dayfirst, yearfirst, utc, errors, require_iso8601, allow_object)
1864 return values.view('i8'), tz_parsed
1865 except (ValueError, TypeError):
-> 1866 raise e
1867
1868 if tz_parsed is not None:

~/opt/anaconda3/envs/model-call-projections/lib/python3.6/site-packages/pandas/core/arrays/datetimes.py in objects_to_datetime64ns(data, dayfirst, yearfirst, utc, errors, require_iso8601, allow_object)
1855 dayfirst=dayfirst,
1856 yearfirst=yearfirst,
-> 1857 require_iso8601=require_iso8601
1858 )
1859 except ValueError as e:

pandas/_libs/tslib.pyx in pandas._libs.tslib.array_to_datetime()

pandas/_libs/tslib.pyx in pandas._libs.tslib.array_to_datetime()

ValueError: Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True

Input times were of format, '2020-01-01 09:08:06-06:00'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.