{"action":"created","issue":{"url":"https://api.github.com/repos/pydata/pandas/issues/10245","labels_url":"https://api.github.com/repos/pydata/pandas/issues/10245/labels{/name}","comments_url":"https://api.github.com/repos/pydata/pandas/issues/10245/comments","events_url":"https://api.github.com/repos/pydata/pandas/issues/10245/events","html_url":"https://github.com/pydata/pandas/issues/10245","id":83373915,"number":10245,"title":"numpy error using read_csv with parse_dates=[...] and index_col=[...]","user":{"login":"cmeeren","id":7766733,"avatar_url":"https://avatars.githubusercontent.com/u/7766733?v=3","gravatar_id":"","url":"https://api.github.com/users/cmeeren","html_url":"https://github.com/cmeeren","followers_url":"https://api.github.com/users/cmeeren/followers","following_url":"https://api.github.com/users/cmeeren/following{/other_user}","gists_url":"https://api.github.com/users/cmeeren/gists{/gist_id}","starred_url":"https://api.github.com/users/cmeeren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmeeren/subscriptions","organizations_url":"https://api.github.com/users/cmeeren/orgs","repos_url":"https://api.github.com/users/cmeeren/repos","events_url":"https://api.github.com/users/cmeeren/events{/privacy}","received_events_url":"https://api.github.com/users/cmeeren/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pydata/pandas/labels/Bug","name":"Bug","color":"e10c02"},{"url":"https://api.github.com/repos/pydata/pandas/labels/CSV","name":"CSV","color":"5319e7"},{"url":"https://api.github.com/repos/pydata/pandas/labels/Timeseries","name":"Timeseries","color":"AFEEEE"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/pydata/pandas/milestones/32","html_url":"https://github.com/pydata/pandas/milestones/Next%20Major%20Release","labels_url":"https://api.github.com/repos/pydata/pandas/milestones/32/labels","id":933188,"number":32,"title":"Next Major Release","description":"after 0.16.1 of course","creator":{"login":"jreback","id":953992,"avatar_url":"https://avatars.githubusercontent.com/u/953992?v=3","gravatar_id":"","url":"https://api.github.com/users/jreback","html_url":"https://github.com/jreback","followers_url":"https://api.github.com/users/jreback/followers","following_url":"https://api.github.com/users/jreback/following{/other_user}","gists_url":"https://api.github.com/users/jreback/gists{/gist_id}","starred_url":"https://api.github.com/users/jreback/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jreback/subscriptions","organizations_url":"https://api.github.com/users/jreback/orgs","repos_url":"https://api.github.com/users/jreback/repos","events_url":"https://api.github.com/users/jreback/events{/privacy}","received_events_url":"https://api.github.com/users/jreback/received_events","type":"User","site_admin":false},"open_issues":809,"closed_issues":45,"state":"open","created_at":"2015-01-13T10:53:19Z","updated_at":"2015-06-01T11:51:29Z","due_on":"2015-08-31T04:00:00Z","closed_at":null},"comments":15,"created_at":"2015-06-01T08:05:39Z","updated_at":"2015-06-01T13:26:58Z","closed_at":null,"body":"Consider a file of the following format:\r\n```\r\nweek,sow,prn,rxstatus,az,elv,l1_cno,s4,s4_cor,secsigma1,secsigma3,secsigma10,secsigma30,secsigma60,code_carrier,c_cstdev,tec45,tecrate45,tec30,tecrate30,tec15,tecrate15,tec00,tecrate00,l1_loctime,chanstatus,l2_locktime,l2_cno\r\n1765,68460.00,126,00E80000,0.00,0.00,39.38,0.118447,0.107595,0.252663,0.532384,0.600540,0.603073,0.603309,-13.255543,0.114,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,1692.182,8C023D84,0.000,0.00\r\n1765,68460.00,23,00E80000,0.00,0.00,53.48,0.034255,0.021177,0.035187,0.042985,0.061142,0.061738,0.061801,-22.760003,0.015,24.955111,0.112239,25.115330,-0.119774,25.146603,-0.065852,24.747576,-0.243804,10426.426,08109CC4,10409.660,44.52\r\n1765,68460.00,13,00E80000,0.00,0.00,54.28,0.046218,0.019314,0.037818,0.056421,0.060602,0.060698,0.060735,-20.679035,0.090,25.670250,-0.070761,25.752224,-0.055089,26.045048,-0.180056,25.360369,-0.062119,7553.020,18109CA4,7202.660,47.27\r\n```\r\n\r\nI try to read that with the following code\r\n\r\n```python\r\ndata = pd.read_csv(FILE, date_parser=GPStime2datetime,\r\n                   parse_dates={'datetime': ['week', 'sow']},\r\n                   index_col=['datetime', 'prn'])\r\n```\r\n\r\nHere I'm parsing ``week`` and ``sow`` into a ``datetime`` column using a custom function (this works properly) and using ``datetime`` and the ``prn`` column as a ``MultiIndex``. The file is read successfully when ``index_col='datetime'``, but not when trying to create the ``MultiIndex`` using ``index_col=['datetime', 'prn']`` (or when using column numbers instead of names). I get the following traceback:\r\n\r\n```\r\n  File \"C:\\Anaconda\\lib\\site-packages\\pandas\\io\\parsers.py\", line 474, in parser_f\r\n    return _read(filepath_or_buffer, kwds)\r\n\r\n  File \"C:\\Anaconda\\lib\\site-packages\\pandas\\io\\parsers.py\", line 260, in _read\r\n    return parser.read()\r\n\r\n  File \"C:\\Anaconda\\lib\\site-packages\\pandas\\io\\parsers.py\", line 721, in read\r\n    ret = self._engine.read(nrows)\r\n\r\n  File \"C:\\Anaconda\\lib\\site-packages\\pandas\\io\\parsers.py\", line 1223, in read\r\n    index, names = self._make_index(data, alldata, names)\r\n\r\n  File \"C:\\Anaconda\\lib\\site-packages\\pandas\\io\\parsers.py\", line 898, in _make_index\r\n    index = self._agg_index(index, try_parse_dates=False)\r\n\r\n  File \"C:\\Anaconda\\lib\\site-packages\\pandas\\io\\parsers.py\", line 984, in _agg_index\r\n    index = MultiIndex.from_arrays(arrays, names=self.index_names)\r\n\r\n  File \"C:\\Anaconda\\lib\\site-packages\\pandas\\core\\index.py\", line 4410, in from_arrays\r\n    cats = [Categorical.from_array(arr, ordered=True) for arr in arrays]\r\n\r\n  File \"C:\\Anaconda\\lib\\site-packages\\pandas\\core\\categorical.py\", line 355, in from_array\r\n    return Categorical(data, **kwargs)\r\n\r\n  File \"C:\\Anaconda\\lib\\site-packages\\pandas\\core\\categorical.py\", line 271, in __init__\r\n    codes, categories = factorize(values, sort=False)\r\n\r\n  File \"C:\\Anaconda\\lib\\site-packages\\pandas\\core\\algorithms.py\", line 131, in factorize\r\n    (hash_klass, vec_klass), vals = _get_data_algo(vals, _hashtables)\r\n\r\n  File \"C:\\Anaconda\\lib\\site-packages\\pandas\\core\\algorithms.py\", line 412, in _get_data_algo\r\n    mask = com.isnull(values)\r\n\r\n  File \"C:\\Anaconda\\lib\\site-packages\\pandas\\core\\common.py\", line 230, in isnull\r\n    return _isnull(obj)\r\n\r\n  File \"C:\\Anaconda\\lib\\site-packages\\pandas\\core\\common.py\", line 240, in _isnull_new\r\n    return _isnull_ndarraylike(obj)\r\n\r\n  File \"C:\\Anaconda\\lib\\site-packages\\pandas\\core\\common.py\", line 330, in _isnull_ndarraylike\r\n    result = np.isnan(values)\r\n\r\nTypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''\r\n```\r\n\r\nI am using Python 2.7, Pandas 0.16.1 and numpy 1.9.2."},"comment":{"url":"https://api.github.com/repos/pydata/pandas/issues/comments/107463463","html_url":"https://github.com/pydata/pandas/issues/10245#issuecomment-107463463","issue_url":"https://api.github.com/repos/pydata/pandas/issues/10245","id":107463463,"user":{"login":"jreback","id":953992,"avatar_url":"https://avatars.githubusercontent.com/u/953992?v=3","gravatar_id":"","url":"https://api.github.com/users/jreback","html_url":"https://github.com/jreback","followers_url":"https://api.github.com/users/jreback/followers","following_url":"https://api.github.com/users/jreback/following{/other_user}","gists_url":"https://api.github.com/users/jreback/gists{/gist_id}","starred_url":"https://api.github.com/users/jreback/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jreback/subscriptions","organizations_url":"https://api.github.com/users/jreback/orgs","repos_url":"https://api.github.com/users/jreback/repos","events_url":"https://api.github.com/users/jreback/events{/privacy}","received_events_url":"https://api.github.com/users/jreback/received_events","type":"User","site_admin":false},"created_at":"2015-06-01T13:26:58Z","updated_at":"2015-06-01T13:26:58Z","body":"This works just fine (and is the point of ``to_datetime`` it will handle almost anything)\r\n```\r\nIn [6]: dt = np.array(['2013-01-01T01:23:45Z'], dtype='datetime64[s]')\r\n\r\nIn [7]: dt\r\nOut[7]: array(['2012-12-31T20:23:45-0500'], dtype='datetime64[s]')\r\n\r\nIn [8]: pd.to_datetime(dt)\r\nOut[8]: DatetimeIndex(['2013-01-01 01:23:45'], dtype='datetime64[ns]', freq=None, tz=None)\r\n```"}}