Skip to content Skip to sidebar Skip to footer

Combining Mixed Data Types In Pandas Column

I have a column in a dataframe called 'Year'. When I invoke; filtered_df['Year'].unique() My result is: array([2013, 2012, 2014, 2015, 2016, 2017, 2011, 2010, 2009, 2008, '2011',

Solution 1:

usually we convert it to numeric values (all non-convertable values will be converted into NaN's) in the following way:

filtered_df['Year'] = pd.to_numeric(filtered_df['Year'], errors='coerce')

Post a Comment for "Combining Mixed Data Types In Pandas Column"