 <p>I propose this solution, which doesn't deviate much from yours:</p> <pre><code>import pandas as pd from datetime import datetime data = pd.read_csv('Meteorite_Landings.csv') for i, val in enumerate(data["year"]): try: b = datetime.strptime(val, '%m/%d/%Y %H:%M:%S %p').year print b except TypeError: pass </code></pre> <p>This prints the years. The reason for the try-except thing is that <a href="https://data.nasa.gov/Space-Science/Meteorite-Landings/gh4g-9sfh" rel="nofollow">the dataset you're probably using</a> is not complete and contains some NANs (?).</p>