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

cannot encode object: 379, of type: <class 'numpy.int64'> #3

Open
UNFPAmaldives opened this issue May 12, 2019 · 0 comments
Open

cannot encode object: 379, of type: <class 'numpy.int64'> #3

UNFPAmaldives opened this issue May 12, 2019 · 0 comments

Comments

@UNFPAmaldives
Copy link

UNFPAmaldives commented May 12, 2019

I get the following error when I run flightextract.py on my data:

bson.errors.InvalidDocument: cannot encode object: 379, of type: <class 'numpy.int64'>

My data looks just like your sample dataset, except larger. When I run flightextract.py on your data, I don't get any errors.

The full error log that I get when I run it on my data is:

[1] Querying database.
[2] 1133 number of valid ICAOs.
[3][0-50 of 1133] ICAOs beening processed.
  [a] fetching records
flightextract.py:59: FutureWarning: Method .as_matrix will be removed in a future version. Use .values instead.
  ids = dfchunk['icao'].as_matrix()
flightextract.py:60: FutureWarning: Method .as_matrix will be removed in a future version. Use .values instead.
  lats = dfchunk['lat'].as_matrix()
flightextract.py:61: FutureWarning: Method .as_matrix will be removed in a future version. Use .values instead.
  lons = dfchunk['lon'].as_matrix()
flightextract.py:62: FutureWarning: Method .as_matrix will be removed in a future version. Use .values instead.
  alts = dfchunk['alt'].as_matrix()
flightextract.py:63: FutureWarning: Method .as_matrix will be removed in a future version. Use .values instead.
  spds = dfchunk['spd'].as_matrix()
flightextract.py:64: FutureWarning: Method .as_matrix will be removed in a future version. Use .values instead.
  hdgs = dfchunk['hdg'].as_matrix()
flightextract.py:65: FutureWarning: Method .as_matrix will be removed in a future version. Use .values instead.
  rocs = dfchunk['roc'].as_matrix()
flightextract.py:66: FutureWarning: Method .as_matrix will be removed in a future version. Use .values instead.
  times = dfchunk['ts'].as_matrix()
  [b] data scaling
/anaconda3/lib/python3.6/site-packages/sklearn/utils/validation.py:475: DataConversionWarning: Data with input dtype int64 was converted to float64 by MinMaxScaler.
  warnings.warn(msg, DataConversionWarning)
  [c] creating machine learning dataset.
  [d] start clustering, and saving results to DB
    * processing  . Traceback (most recent call last):
  File "flightextract.py", line 140, in <module>
    ('roc',  c[:, 6].tolist()),
  File "/anaconda3/lib/python3.6/site-packages/pymongo/collection.py", line 700, in insert_one
    session=session),
  File "/anaconda3/lib/python3.6/site-packages/pymongo/collection.py", line 614, in _insert
    bypass_doc_val, session)
  File "/anaconda3/lib/python3.6/site-packages/pymongo/collection.py", line 602, in _insert_one
    acknowledged, _insert_command, session)
  File "/anaconda3/lib/python3.6/site-packages/pymongo/mongo_client.py", line 1280, in _retryable_write
    return self._retry_with_session(retryable, func, s, None)
  File "/anaconda3/lib/python3.6/site-packages/pymongo/mongo_client.py", line 1233, in _retry_with_session
    return func(session, sock_info, retryable)
  File "/anaconda3/lib/python3.6/site-packages/pymongo/collection.py", line 597, in _insert_command
    retryable_write=retryable_write)
  File "/anaconda3/lib/python3.6/site-packages/pymongo/pool.py", line 589, in command
    self._raise_connection_failure(error)
  File "/anaconda3/lib/python3.6/site-packages/pymongo/pool.py", line 750, in _raise_connection_failure
    raise error
  File "/anaconda3/lib/python3.6/site-packages/pymongo/pool.py", line 584, in command
    user_fields=user_fields)
  File "/anaconda3/lib/python3.6/site-packages/pymongo/network.py", line 121, in command
    codec_options, ctx=compression_ctx)
  File "/anaconda3/lib/python3.6/site-packages/pymongo/message.py", line 678, in _op_msg
    flags, command, identifier, docs, check_keys, opts)
bson.errors.InvalidDocument: cannot encode object: 288, of type: <class 'numpy.int64'>

I wonder whether this error might be related to the ts variable?

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