I'm working with a dataset of movies to run a regression and predict the gross. But because some columns have String values, I'm doing an Ordinal Encoding before I do the split and run the regression. One example is the column containing the movie titles(shown below): Series_Title 1 The Shawshank Redemption 2 The Godfather 3 The Dark Knight ... 1001 The 39 Steps Here's my code to run Ordinal Encoding on these first 3 movies: df2 = pd.DataFrame({'title': ['The Shawshank Redemption','The Godfather','The Dark Knight']}) df2['title'] = df1.Series_Title.astype("category").cat.codes df2 OUTPUT: 0 875 1 786 2 766 Since the Series_Title column has 1,000 values, how can I apply Ordinal Encoding to the entire Series_Title column? Continue reading...