How to import data from a url to pandas dataframe?

I’m trying to import data from the following url into pandas dataframe:

I tried the following:

url = ''
reader = pd.read_table(url, sep='\t',
                     skiprows=lambda x: x in [0, 1, 2, 3, 4, 5, 6, 7], header=None, names=[
                         'ASX', 'Company Name', 'Product/', 'Reported Gross', 'Issued', '% of issued capital'])

I expected to get data in a dataframe for each of the columns. However, all my data is falling under ‘ASX’. I have re-read the python doc for read_table but don’t know where I’m going wrong.

>Solution :

try pd.read_fwf()

i.e. reader = pd.read_fwf(url, sep=’\t’,
skiprows=8, header=None, names=[
‘ASX’, ‘Company Name’, ‘Product/’, ‘Reported Gross’, ‘Issued’, ‘% of issued capital’])

Leave a Reply