Python之pandas封装get、set方法
import pandas as pd
def get_arr_from_xls(xls_path):
df = pd.read_excel(xls_path)
arr = df.values.tolist()
return arr
def set_xls_by_xls(arr, xls_path):
df = pd.DataFrame(arr)
df.to_excel(xls_path)
return xls_path
use:
if __name__ == '__main__':
arr = pd.get_arr_from_xls("test.xlsx")
pd.set_xls_by_xls(arr, "test2.xlsx")
print("done")

done

浙公网安备 33010602011771号