I'm trying to import data from the following url into pandas dataframe:
https://www.asx.com.au/data/shortsell.txt
I tried the following:
url = 'https://www.asx.com.au/data/shortsell.txt'
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.
CodePudding user response:
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'])