Home > Enterprise >  Convert .tab file into pandas dataframe
Convert .tab file into pandas dataframe

Time:08-02

After downloading a .tab file, I am trying to convert it into a pandas df but it looks very strange when I run this line of code:

df = pd.read_csv('/Users/me/HUMAN_9606_idmapping_selected.tab',  sep ='\t', nrows=10)

File: https://ftp.uniprot.org/pub/databases/uniprot/current_release/knowledgebase/idmapping/by_organism/HUMAN_9606_idmapping_selected.tab.gz

How can I convert it to look like a regular df?

CodePudding user response:

You don't even need to extract it, looks like you don't have a header, so you should specify header=None:

df = pd.read_csv('HUMAN_9606_idmapping_selected.tab.gz', sep='\t', header=None)
# OR
df = pd.read_table('HUMAN_9606_idmapping_selected.tab.gz', header=None)
  • Related