Data input from a customized text format file

Hello., I’m not sure if this can be the best site for getting this kind of help. It is about a text which is no any ‘csv’ standard but it has the key or ‘headers’ at the beginning of each row. Something like this:

1990, #, #, #, # … , #
2000, #, #, #, # … , #
2001, #, #, #, # … , #

2023, #, #, #, # … , #

How to insert this data with numpy or pandas for a 2D line figure in plotly?
Thanks in advance.

Hi @Verboran welcome to the forums.

What happens if you just import it with pandas (read_csv) and set the delimiter to “,” or any other delimiter which is use in the file?

I tried it but I think there are more parameters of read_csv() to manage . I tried a transpose() just after the reading and it is not able to build index and columns. Thanks a lot for the guiding. It is time to read more pandas documentation.

I think it is working
Parameter index_col=[0] of read_csv()

1 Like