How to join tuple elements?
📁 cortege, Advanced Python Topics
There is a tuple:
('2020-08-02', '00:00', 'A', 'B', 'C')Need to join the first and second elements:
('2020-08-02 00:00', 'A', 'B', 'C')Please advise how to do this?
Most likely the error is that the data in the file is not split correctly (for example, there is a header before the data). When pandas tries to parse the file, the library needs to understand how many columns to create, and if the number of data elements in the first rows differs from subsequent ones, an error will occur.
I know about two solutions.
Ignore the error.
pd.read_csv(filename, sep='\\t', error_bad_lines=False)In this case, the table will be created based on the first row, and everything that does not match its format will be omitted. This is suitable if your data starts from the first row, but somewhere in the file the data may be corrupted.
Skip
Log in to leave an answer