那些年我们遇到的Error


1.pandas.core.series.Series 变换日期格式:

import datatime
a = pd.to_datetime(a)

2.查看数据类型:

print(type(a))

3.'Series' object has no attribute 'decode':

其实解决方案很简单,只需要改成str类型就可以了

4.strptime() argument 1 must be str, not Series:

原因:

行是字节串,因为以二进制模式打开文件。需要解码该字符串;如果它是一个与模式匹配的日期字符串,则只需使用ASCII:

a=datetime.strptime(s.decode('ascii'), "%d-%m-%Y").

5.当一个excel表中有多个sheet时,要输出第二张sheet

data1 = pd.read_excel("D:/D/大学课程/大三下_数据可视化/期末作业/某咖啡公司销售数据.xlsx",sheet_name=2,encoding='gbk')

 详细:

持续更新中。。。。。。