0

I am creating two tuple lists :

The first one is :

Entity=tuple(df['Entity'])

and the output is this

(1007897079, 1007897253, 1007898597)`

The other one is :

Research=tuple(df8['research'])

and the output is

('2008841156', '1432883725', '2000535429')

Why is the second one with quotes ? Can i remove them ? Thanks a lot!

I have tried to remove the quotes but it seems like i can't do it. Thanks a lot for helping!

1 Answers1

0

The column types are different. Reproducible example and fix:

import pandas as pd

df = pd.DataFrame({'entity': [1007897079, 1007897253, 1007898597],           # integers
                   'research': ['2008841156', '1432883725', '2000535429']})  # strings
print(df)
print('entity', tuple(df.entity))
print('research', tuple(df.research))
print('research(forced)', tuple(df.research.astype(int)))  # force integers
df.research = df.research.astype(int)  # convert the column
print('research(converted)', tuple(df.research))

Output:

       entity    research
0  1007897079  2008841156
1  1007897253  1432883725
2  1007898597  2000535429
entity (1007897079, 1007897253, 1007898597)
research ('2008841156', '1432883725', '2000535429')
research(forced) (2008841156, 1432883725, 2000535429)
research(converted) (2008841156, 1432883725, 2000535429)
Mark Tolonen
  • 166,664
  • 26
  • 169
  • 251