我正在使用gspread将pandas dataframe写入Google Sheets:
from gspread_formatting import *
import gspread
from df2gspread import df2gspread as d2g
import pandas as pd
d2g.upload(data, sheet.id, 'test_name', clean=True, credentials=creds, col_names=True, row_names=False)
虽然pandas数据框舍入到2
个小数点,但在Google Sheets中的值有时超过了这个范围。
df
a b
100.56 600.79
在 Google Sheets 中的结果:
aa b
100.5616 600.79
我找不到关于如何使用Python gspread API取整的任何信息。