title: Python datetime on Futures data
body: <p>I am trying to analyze Futures data using a data file I downloaded from Ninja Trader. I imported the file in Python using PyCharm IDE.</p>
  <p>The text file format is this:</p>
  <pre><code>20211031 220000 0000000;4608;4608;4608;1
  
  20211031 220000 0000000;4608;4608;4608;4
  
  20211031 220000 0000000;4608;4608;4608;1
  
  20211031 220000 0000000;4608;4608;4608;1
  </code></pre>
  <p>These are tick data with timestamp, price, price, price, volume.</p>
  <p>I imported them using:</p>
  <pre><code>    data = pd.read_csv(r&quot;C:\__dir__test.txt&quot;,sep=';')
  </code></pre>
  <p>(I have deleted the actual dir address)</p>
  <p>Assigned column names:</p>
  <pre><code>    data.columns = [&quot;date&quot;,&quot;P1&quot;,&quot;P2&quot;,&quot;P3&quot;,&quot;V&quot;]
  </code></pre>
  <p>Then I used the pd.to_datetime unsuccessfully:</p>
  <pre><code>    data[&quot;date&quot;] = pd.to_datetime(data [&quot;date&quot;])
  </code></pre>
  <p>and</p>
  <pre><code>    data['Dates'] = pd.to_datetime(data['date']).dt.date
      data['Time'] = pd.to_datetime(data['date']).dt.time
  </code></pre>
  <p>Then I am getting an error:</p>
  <pre><code>File &quot;C:\..dir..venv\lib\site-packages\pandas\core\arrays\datetimes.py&quot;, line 2187, in objects_to_datetime64ns
  values, tz_parsed = conversion.datetime_to_datetime64(data.ravel(&quot;K&quot;))
  
  File &quot;pandas\_libs\tslibs\conversion.pyx&quot;, line 359, in pandas._libs.tslibs.conversion.datetime_to_datetime64
  </code></pre>
  <p>TypeError: Unrecognized value type: &lt;class 'str'&gt;</p>
  <p>During handling of the above exception, another exception occurred:
  Traceback (most recent call last):</p>
  <pre><code>File &quot;&lt;input&gt;&quot;, line 1, in &lt;module&gt;
  
  File &quot;C:\Program Files\JetBrains\PyCharm Community Edition 2021.2.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_umd.py&quot;, line 198, in runfile
  pydev_imports.execfile(filename, global_vars, local_vars)  # execute the script
  
  File &quot;C:\Program Files\JetBrains\PyCharm Community Edition 2021.2.1\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_execfile.py&quot;, line 18, in execfile
  exec(compile(contents+&quot;\n&quot;, file, 'exec'), glob, loc)
  
  File &quot;C:/__dir__/Data from NT.py&quot;, line 10, in &lt;module&gt;
  data[&quot;date&quot;] = pd.to_datetime(data [&quot;date&quot;])
  
  File &quot;C:\__dir__\venv\lib\site-packages\pandas\core\tools\datetimes.py&quot;, line 883, in to_datetime 
  cache_array = _maybe_cache(arg, format, cache, convert_listlike)
  
  File &quot;C:\__dir__\venv\lib\site-packages\pandas\core\tools\datetimes.py&quot;, line 195, in _maybe_cache
  cache_dates = convert_listlike(unique_dates, format)
  
  File &quot;C:\__dir__\venv\lib\site-packages\pandas\core\tools\datetimes.py&quot;, line 401, in _convert_listlike_datetimes
  result, tz_parsed = objects_to_datetime64ns(
  
  File &quot;C:\__dir__\venv\lib\site-packages\pandas\core\arrays\datetimes.py&quot;, line 2193, in objects_to_datetime64ns
  raise err
  
  File &quot;C:\__dir__\venv\lib\site-packages\pandas\core\arrays\datetimes.py&quot;, line 2175, in objects_to_datetime64ns result, tz_parsed = tslib.array_to_datetime(
  
  File &quot;pandas\_libs\tslib.pyx&quot;, line 379, in pandas._libs.tslib.array_to_datetime
  
  File &quot;pandas\_libs\tslib.pyx&quot;, line 611, in pandas._libs.tslib.array_to_datetime
  
  File &quot;pandas\_libs\tslib.pyx&quot;, line 749, in pandas._libs.tslib._array_to_datetime_object
  
  File &quot;pandas\_libs\tslib.pyx&quot;, line 740, in pandas._libs.tslib._array_to_datetime_object
  
  File &quot;pandas\_libs\tslibs\parsing.pyx&quot;, line 257, in pandas._libs.tslibs.parsing.parse_datetime_string
  
  File &quot;C:\__dir__\venv\lib\site-packages\dateutil\parser\_parser.py&quot;, line 1368, in parse
  return DEFAULTPARSER.parse(timestr, **kwargs)
  
  File &quot;C:\__dir__\venv\lib\site-packages\dateutil\parser\_parser.py&quot;, line 643, in parse
  raise ParserError(&quot;Unknown string format: %s&quot;, timestr)
  dateutil.parser._parser.ParserError: Unknown string format: 20211031 220000 0000000
  </code></pre>
  <p>The purpose is to split date and time to do analysis in specific time intervals (by slicing the data). I used the same set up in a data set I downloaded from Interactive Brokers using the ib_insync framework and worked fine.</p>