import pandas as pd
path = r"F:\101_pandas视频教程\pandas_excel"
s1 = pd.read_csv(path + "\\" + "Students.csv", index_col="ID")
# pandas中读取txt和tsv格式
s2 = pd.read_csv(path + "\\" + "Students.tsv", sep="\t", index_col="ID")
s3 = pd.read_csv(path + "\\" + "Students.txt", sep="|", index_col="ID")
s4 = pd.read_csv(path + "\\" + "Students.txt")
# pandas中将一列拆分成多列
temp = s4["ID|Name|Age"].str.split("|", expand=True, n=2)
temp2 = pd.DataFrame(columns=["ID", "Name", "Age"])
temp2["ID"] = temp[0]
temp2["Name"] = temp[1]
temp2["Age"] = temp[2]
print(temp2)