This is the sixth day of my participation in the November Gwen Challenge. See details: The Last Gwen Challenge 2021.

To read TXT or CSV data in Python, use the read_table or read_CSV functions in the PANDAS module. The “or” here does not mean that each function intelligently reads data in one format. The second is that both hash numbers can read data from text files. Since the two functions are similar in function and parameter usage, the jinyi read_table function is used as an example to explain the usage of the function and the meanings of several important parameters.

Filepath_or_buffer: specifies the path where TXT or CSV files are stored.

Sep: Specifies the separator between fields in the raw data set. The default is Tab.

Header: Whether to use the first row in the original data set as the table header. By default, the first row is used as the field name.

Names: If there are no fields in the original data set, you can change the parameter to add a specific header to the data box when the data is read. Index_col: Specifies columns in the original data set as the navigation index (label) of the data box.

Usecols: Specifies which variable names in the metadata set need to be read.

Dtype: When reading data, you can set a different data type for each field in the original data set.

Converters: Sets conversion functions for certain fields in a dataset in dictionary format.

Skiprows: Specifies the number of rows to skip at the beginning of the original data set when reading data.

Skipfooter: Specifies the number of rows to skip at the end of the original data set when reading data.

Nrows: Specifies the number of rows to read data.

Na_values: Specifies which feature values in the original data set are missing values.

Skip_blank_lines: Whether to skip blank lines in the original data set when reading data. Default: True.

Parse_dates: If True, attempt to parse the row index of the data box; If the argument is a list, try to resolve the corresponding date column; If the argument is a nested list, merge some columns into date columns; If the argument is a dictionary, the corresponding column (the value in the dictionary) is parsed and a new field name (the key in the dictionary) is generated.

Thousands: Specifies the thousands character in the original data set.

Comment: specifies the comment. When reading data, if the first comment is encountered, the line will be skipped.

Encoding: If the file contains Chinese characters, it is sometimes necessary to specify the character encoding.