About the method of using pandas to import dat data files in python (any dat data files and csv data files can be imported)

I believe that everyone will encounter some very distressing data import problems when learning python. The data import on csdn is various, most of which are implemented under specific conditions. I found that there are many dat on csdn while learning the implementation of machine learning classification algorithms. Data files, so I want to use these dat data files, but I don’t know how to import them. After some exploration, there is a way to completely convert dat files into csv files and import them into python:
first download a dat file and
Insert picture description here
directly change the suffix to xlsx, Open the file and find that the format of the dat data file is like this:
Insert picture description here
you can see that the data has only one column, so you have to find a way to separate them. The specific method is the column operation of excell. It is very simple not to mention the
column after the normal row and column. Data. At this time, save the data format as csv
and then change the file to utf-8 encoding. Then you can
do the code operation:
import pandas as pd
pd.read_csv("11heart1.csv", encoding ='utf-8')
Insert picture description here
and import the data Up!

Guess you like

Origin blog.csdn.net/ChangHongYin/article/details/109277574