I am trying to read a csv file, which doesn't contain a header line, and it contains an indefinite amount of columns, with pandas.
I have search how to work around this, but all the answers that I have found require for me to already know (search by opening the file) the maximum number that a column can have and create a names=
attribute on read_csv
function, like this:
names = ["a", "b", "c", "d"]
table = pandas.read_csv('freqs.tsv', header=None, sep='\t+', names=names)
My question is, is there any possible ways to do this without knowing the maximum number of columns? For future reusability of the script, I want to generalize if it is possible.
Here is a sample text file I was using to run some tests:
mathematics 1.548438245 1.4661764369999999 1.429891562
english 1.237816576 1.043399455
physics 2.415563662 11.165497484000001 5.954598265 7.853732762999999 7.929835858
drama 2.0439384830000003 9.81210385 5.068332477 8.579349377 5.962282599999999
health 1.557941553 1.222267933
science 1.550193476
gym 1.240610831 1.149375944 1.899408195 1.3713249980000002
Thank you