pandas error when convert object to datetime
<p>This is two lines of inputdataframe:</p>

<pre><code>    ts  country       os product_id  total_users  total_purchases
0  0000-00-00   Brazil      iOS                       1                0
1  0000-00-00  Germany                                1                0
</code></pre>

<p>I have tried following commands in order to convert 'ts' which is object to datetime:</p>

<pre><code> df['ts'] = df['ts'].astype('datetime64[ns]')
</code></pre>

<p>and this is an error I've got:
<strong>ValueError: Month out of range in datetime string "0000-00-00"</strong></p>

<p>I know that there is a problem with 0000-00-00, but I don't know how to get ride of it and solve it to work?</p>

<p>easy peasy</p>

<pre><code>df['ts'] = pd.to_datetime(df['ts'], errors ='coerce')
</code></pre>

<p>no need to clean the data. wrong timestamps will get the <code>NaT</code> (not a timestamp)</p>

python datetime pandas