0

I did a little searching and could not find an answer. Probably because the solution is so obvious that no one else is stumped like me. I have a simple dataframe with three columns

team_id_all.head(1)
   season   id  team
0  2016-17  1   ARS

I am attempting to add a fourth column which simply concatenates two of the existing columns, but when I convert the 'id' column to a string, it outputs 1\na1...

team_id_all['season_id_key'] = team_id_all['season'] + ":" + str(team_id_all['id'])
team_id_all.head(1)
    season  id  team    season_id_key
0   2016-17 1   ARS     2016-17:0 1\n1 2\n2 3\n3 4...

The 'id' column is an int64 type

team_id_all.dtypes
season           object
id                int64
team             object
season_id_key    object
dtype: object

If I just try to convert 1 to a string, it returns the sought value.

print('2016-17' + ':' + str(1))
2016-17:1

What is different about the 'id' column that returns a different format from the output of the one-off line shown at the end?

0 Answers0