不使用DataFrame,指定dtype=object即可
import pandas as pd
import numpy as np
import os
curror_dir = os.path.dirname(os.path.realpath(__file__))
dir = os.path.join(curror_dir,'text.xlsx')
def pandas():
df_map = pd.read_excel(dir,sheet_name=0,dtype=object)
df = df_map.values
print(df)
结果
[[Timestamp('2024-06-20 10:24:04') '1' 1 '01' '1' 0 nan '1' '1' '1' '1']
[Timestamp('2024-06-20 10:24:37') '111111' 1 '01' '1' 0 nan '1' '1' '1'
'1']
[Timestamp('2024-06-20 10:23:20') '123' 1476 '01' nan 0 nan '123' '3'
'3' '123']
[Timestamp('2024-06-20 10:24:25') '1234' 1 '01' '1' 0 nan '1' '1' '1'
'1']
[Timestamp('2024-06-20 10:24:08') '13' 1 '01' '1' 0 nan '1' '1' '1' '1']]