问题是它说有一个意外的关键字,但是df.to_gbq(destination_table =“ ********”,project_id =“ ********”,if_exists =“ replace ”)

任何关于如何解决此问题的想法都值得欢迎,我正在Jupiter Notebook中运行它。但是当我说有一个意外的关键字“位置”时,我无法运行该功能

import pandas as pd
import os
import re
import datetime
import time

humans = [
 {'name':'Tom', 'gender': 'M'},
 {'name':'Bob', 'gender': 'M'}
]

df = pd.DataFrame(humans)

df.to_gbq(destination_table="random.humans", project_id="top-secret", if_exists="replace")


<ipython-input-19-dae3425a89d7> in <module>()
----> 1 result.to_gbq(destination_table="random.humans", project_id="top-secret", if_exists="replace")

~/anaconda3/lib/python3.6/site-packages/pandas/core/frame.py in to_gbq(self, destination_table, project_id, chunksize, reauth, if_exists, auth_local_webserver, table_schema, location, progress_bar, credentials, verbose, private_key)
   1426             table_schema=table_schema, location=location,
   1427             progress_bar=progress_bar, credentials=credentials,
-> 1428             verbose=verbose, private_key=private_key)
   1429
   1430     @classmethod

~/anaconda3/lib/python3.6/site-packages/pandas/io/gbq.py in to_gbq(dataframe, destination_table, project_id, chunksize, reauth, if_exists, auth_local_webserver, table_schema, location, progress_bar, credentials, verbose, private_key)
    160         auth_local_webserver=auth_local_webserver, table_schema=table_schema,
    161         location=location, progress_bar=progress_bar,
--> 162         credentials=credentials, verbose=verbose, private_key=private_key)

TypeError: to_gbq() got an unexpected keyword argument 'location'


套餐信息:

# Name                    Version                   Build  Channel
_ipyw_jlab_nb_ext_conf    0.1.0                    py36_0
_py-xgboost-mutex         2.0                       cpu_0    conda-forge
_tflow_1100_select        0.0.3                       mkl
_tflow_select             2.1.0                       gpu
absl-py                   0.5.0                    py36_0
alabaster                 0.7.11                   py36_0
altgraph                  0.15                       py_0    conda-forge
anaconda-client           1.7.2                    py36_0
anaconda-navigator        1.9.2                    py36_0
anaconda-project          0.8.2                    py36_0
appdirs                   1.4.3            py36h28b3542_0
asn1crypto                0.24.0                   py36_0
astor                     0.7.1                    py36_0
astroid                   2.0.4                    py36_0
astropy                   3.0.4            py36h14c3975_0
atomicwrites              1.2.1                    py36_0
attrs                     18.2.0           py36h28b3542_0
autograd                  1.2                        py_1    conda-forge
automat                   0.7.0                    py36_0
autopep8                  1.4                      py36_0
babel                     2.6.0                    py36_0
backcall                  0.1.0                    py36_0
backports                 1.0                      py36_1
backports.shutil_get_terminal_size 1.0.0                    py36_2
bcrypt                    3.1.6            py36h7b6447c_0
beautifulsoup4            4.6.3                    py36_0
bitarray                  0.8.3            py36h14c3975_0
bkcharts                  0.2                      py36_0
blas                      1.0                         mkl
blaze                     0.11.3                   py36_0
bleach                    2.1.4                    py36_0
blinker                   1.4                        py_1    conda-forge
blosc                     1.14.4               hdbcaa40_0
bokeh                     0.13.0                   py36_0
boto                      2.49.0                   py36_0
boto3                     1.9.82                     py_0
botocore                  1.12.82                    py_0
bottleneck                1.2.1            py36h035aef0_1
bzip2                     1.0.6                h14c3975_5
ca-certificates           2019.1.23                     0
cachetools                2.1.0                      py_0    conda-forge
cairo                     1.14.12              h8948797_3
certifi                   2019.3.9                 py36_0
cffi                      1.11.5           py36he75722e_1
chardet                   3.0.4                    py36_1
click                     6.7                      py36_0
cloudpickle               0.5.6                    py36_0
clyent                    1.2.2                    py36_1
colorama                  0.3.9                    py36_0
conda                     4.6.12                   py36_1
conda-build               3.15.1                   py36_0
conda-env                 2.6.0                         1
constantly                15.1.0           py36h28b3542_0
contextlib2               0.5.5                    py36_0
cryptography              2.3.1            py36hc365091_0
cryptography-vectors      2.3.1                 py36_1000    conda-forge/label/cf201901
cudatoolkit               9.0                  h13b8566_0
cudnn                     7.1.2                 cuda9.0_0
cupti                     9.0.176                       0
curl                      7.61.0               h84994c4_0
cycler                    0.10.0                   py36_0
cyrus-sasl                2.1.26               hf938e8d_3
cython                    0.28.5           py36hf484d3e_0
cytoolz                   0.9.0.1          py36h14c3975_1
dask                      0.19.2                   py36_0
dask-core                 0.19.2                   py36_0
datashape                 0.5.4                    py36_1
dbus                      1.13.2               h714fa37_1
decorator                 4.3.0                    py36_0
defusedxml                0.5.0                    py36_1
distributed               1.23.2                   py36_0
docutils                  0.14                     py36_0
entrypoints               0.2.3                    py36_2
et_xmlfile                1.0.1                    py36_0
expat                     2.2.6                he6710b0_0
fastcache                 1.0.2            py36h14c3975_2
ffmpeg                    4.0                  hcdf2ecd_0
filelock                  3.0.8                    py36_0
flask                     1.0.2                    py36_1
flask-caching             1.4.0                      py_0    conda-forge
flask-cors                3.0.6                    py36_0
fontconfig                2.13.0               h9420a91_0
freeglut                  3.0.0                hf484d3e_5
freetype                  2.9.1                h8a8886c_1
fribidi                   1.0.5                h7b6447c_0
future                    0.17.1                py36_1000    conda-forge
gast                      0.2.0                    py36_0
gensim                    3.4.0            py36h14c3975_0
get_terminal_size         1.0.0                haa9412d_0
gevent                    1.3.6            py36h7b6447c_0
glib                      2.56.2               hd408876_0
glob2                     0.6                      py36_1
gmp                       6.1.2                h6c8ec71_1
gmpy2                     2.0.8            py36h10f8cd9_2
google-api-core           0.1.4                      py_0    conda-forge
google-api-python-client  1.7.6                    pypi_0    pypi
google-auth               1.6.1                      py_0    conda-forge
google-auth-httplib2      0.0.3                    pypi_0    pypi
google-auth-oauthlib      0.1.0                    py36_0    conda-forge
google-cloud              0.34.0                   pypi_0    pypi
google-cloud-bigquery     0.29.0                     py_0    conda-forge
google-cloud-core         0.28.1                     py_0    conda-forge
google-cloud-sdk          228.0.0               py36_1000    conda-forge
google-cloud-storage      1.13.0                     py_0    conda-forge
google-resumable-media    0.3.1                      py_0    conda-forge
googleapis-common-protos  1.5.5                      py_0    conda-forge
graphite2                 1.3.12               h23475e2_2
graphviz                  2.40.1               h21bd128_2
greenlet                  0.4.15           py36h7b6447c_0
grpcio                    1.12.1           py36hdbcaa40_0
gst-plugins-base          1.14.0               hbbd80ab_1
gstreamer                 1.14.0               hb453b48_1
h5py                      2.8.0            py36h989c5e5_3
harfbuzz                  1.8.8                hffaf4a1_0
hdf5                      1.10.2               hba1933b_1
heapdict                  1.0.0                    py36_2
html5lib                  1.0.1                    py36_0
httplib2                  0.12.0                   pypi_0    pypi
hyperlink                 18.0.0                   py36_0
icu                       58.2                 h9c2bf20_1
idna                      2.7                      py36_0
imageio                   2.4.1                    py36_0
imagesize                 1.1.0                    py36_0
incremental               17.5.0                   py36_0
intel-openmp              2019.0                      118
ipykernel                 4.10.0                   py36_0
ipython                   6.5.0                    py36_0
ipython_genutils          0.2.0                    py36_0
ipywidgets                7.4.2                    py36_0
isort                     4.3.4                    py36_0
itsdangerous              0.24                     py36_1
jasper                    2.0.14               h07fcdf6_1
jbig                      2.1                  hdba287a_0
jdcal                     1.4                      py36_0
jedi                      0.12.1                   py36_0
jeepney                   0.4                      py36_0
jinja2                    2.10                     py36_0
jmespath                  0.9.3                    py36_0
jpeg                      9b                   h024ee3a_2
jsonschema                2.6.0                    py36_0
jupyter                   1.0.0                    py36_7
jupyter_client            5.2.3                    py36_0
jupyter_console           5.2.0                    py36_1
jupyter_core              4.4.0                    py36_0
jupyterlab                0.34.9                   py36_0
jupyterlab_launcher       0.13.1                   py36_0
keras                     2.2.2                         0
keras-applications        1.0.6                    py36_0
keras-base                2.2.2                    py36_0
keras-preprocessing       1.0.5                    py36_0
keyring                   13.2.1                   py36_0
kiwisolver                1.0.1            py36hf484d3e_0
krb5                      1.16.1               hc83ff2d_6
lazy-object-proxy         1.3.1            py36h14c3975_2
libcurl                   7.61.0               h1ad7b7a_0
libdb                     6.1.26               he6710b0_0
libedit                   3.1.20170329         h6b74fdf_2
libffi                    3.2.1                hd88cf55_4
libgcc                    7.2.0                h69d50b8_2
libgcc-ng                 8.2.0                hdf63c60_1
libgfortran-ng            7.3.0                hdf63c60_0
libglu                    9.0.0                hf484d3e_1
libntlm                   1.5                  h7b6447c_0
libopencv                 3.4.2                hb342d67_1
libopus                   1.3                  h7b6447c_0
libpng                    1.6.36               hbc83047_0    anaconda
libprotobuf               3.6.0                hdbcaa40_0
libsodium                 1.0.16               h1bed415_0
libssh2                   1.8.0                h9cfc8f7_4
libstdcxx-ng              8.2.0                hdf63c60_1
libtiff                   4.0.9                he85c1e1_2
libtool                   2.4.6                h544aabb_3
libuuid                   1.0.3                h1bed415_2
libvpx                    1.7.0                h439df22_0
libxcb                    1.13                 h1bed415_1
libxgboost                0.80                 hfc679d8_1    conda-forge
libxml2                   2.9.8                h26e45fe_1
libxslt                   1.1.32               h1312cb7_0
lifelines                 0.16.1                     py_0    conda-forge/label/cf201901
llvmlite                  0.24.0           py36hdbcaa40_0
locket                    0.2.0                    py36_1
lxml                      4.2.5            py36hefd8a0e_0
lzo                       2.10                 h49e0be7_2
macholib                  1.11                       py_0    conda-forge
markdown                  2.6.11                   py36_0
markupsafe                1.0              py36h14c3975_1
matplotlib                3.0.2                    pypi_0    pypi
mccabe                    0.6.1                    py36_1
mecab                     0.996                         1    chezou
mecab-python3             0.996.1                  pypi_0    pypi
mistune                   0.8.3            py36h14c3975_1
mkl                       2019.1                      144    anaconda
mkl-service               1.1.2            py36he904b0f_5    anaconda
mkl_fft                   1.0.10           py36ha843d7b_0    anaconda
mkl_random                1.0.2            py36hd81dba3_0    anaconda
more-itertools            4.3.0                    py36_0
mpc                       1.1.0                h10f8cd9_1
mpfr                      4.0.1                hdf1c602_3
mpmath                    1.0.0                    py36_2
msgpack-python            0.5.6            py36h6bb024c_1
multipledispatch          0.6.0                    py36_0
mysql                     5.7.22               hef7e34c_0
mysql-connector-c         6.1.11               hf4847fb_0
mysql-connector-python    8.0.13           py36h9c95fcb_0    anaconda
navigator-updater         0.2.1                    py36_0
nbconvert                 5.4.0                    py36_1
nbformat                  4.4.0                    py36_0
nccl                      1.3.5                 cuda9.0_0
ncurses                   6.1                  hf484d3e_0
networkx                  2.1                      py36_0
ninja                     1.8.2            py36h6bb024c_1
nltk                      3.3.0                    py36_0
nose                      1.3.7                    py36_2
notebook                  5.6.0                    py36_0
numba                     0.39.0           py36h04863e7_0
numexpr                   2.6.9            py36h9e4a6bb_0    anaconda
numpy                     1.15.4           py36h7e9f1db_0    anaconda
numpy-base                1.15.4           py36hde5b4d6_0    anaconda
numpydoc                  0.8.0                    py36_0
oauthlib                  2.1.0                      py_0    conda-forge
odo                       0.5.1                    py36_0
olefile                   0.46                     py36_0
opencv                    3.4.2            py36h6fd60c2_1
openpyxl                  2.5.8                    py36_0
openssl                   1.0.2r               h7b6447c_0
packaging                 17.1                     py36_0
pandas                    0.24.2           py36he6710b0_0
pandas-compat             0.1.1                    pypi_0    pypi
pandas-gbq                0.4.1                      py_0    conda-forge
pandoc                    1.19.2.1             hea2e7c5_1
pandocfilters             1.4.2                    py36_1
pango                     1.42.4               h049681c_0
parso                     0.3.1                    py36_0
partd                     0.3.8                    py36_0
patchelf                  0.9                  hf484d3e_2
path.py                   11.1.0                   py36_0
pathlib2                  2.3.2                    py36_0
patsy                     0.5.0                    py36_0
pcre                      8.42                 h439df22_0
pep8                      1.7.1                    py36_0
pexpect                   4.6.0                    py36_0
pickleshare               0.7.4                    py36_0
pillow                    5.3.0            py36h34e0f95_0
pip                       10.0.1                   py36_0
pixman                    0.34.0               hceecf20_3
pkginfo                   1.4.2                    py36_1
pluggy                    0.7.1            py36h28b3542_0
ply                       3.11                     py36_0
prometheus_client         0.3.1            py36h28b3542_0
prompt_toolkit            1.0.15                   py36_0
protobuf                  3.6.0            py36hf484d3e_0
psutil                    5.4.7            py36h14c3975_0
ptyprocess                0.6.0                    py36_0
py                        1.6.0                    py36_0
py-opencv                 3.4.2            py36hb342d67_1
py-xgboost                0.80             py36hfc679d8_1    conda-forge
pyasn1                    0.4.4            py36h28b3542_0
pyasn1-modules            0.2.2                    py36_0
pycodestyle               2.4.0                    py36_0
pycosat                   0.6.3            py36h14c3975_0
pycparser                 2.19                     py36_0
pycrypto                  2.6.1            py36h14c3975_9
pycurl                    7.43.0.2         py36hb7f436b_0
pydot                     1.3.0                    py36_1
pyflakes                  2.0.0                    py36_0
pygments                  2.2.0                    py36_0
pyinstaller               3.4              py36ha92aebf_0    conda-forge
pyjwt                     1.6.4                      py_0    conda-forge
pylint                    2.1.1                    py36_0
pymongo                   3.7.2                    pypi_0    pypi
pyodbc                    4.0.24           py36he6710b0_0
pyopenssl                 18.0.0                   py36_0
pyparsing                 2.2.1                    py36_0
pyqt                      5.9.2            py36h05f1152_2
pysocks                   1.6.8                    py36_0
pytables                  3.4.4            py36ha205bf6_0
pytest                    3.8.1                    py36_0
pytest-arraydiff          0.2              py36h39e3cac_0
pytest-astropy            0.4.0                    py36_0
pytest-doctestplus        0.1.3                    py36_0
pytest-openfiles          0.3.0                    py36_0
pytest-remotedata         0.3.0                    py36_0
python                    3.6.6                h6e4f718_2
python-dateutil           2.7.3                    py36_0
python_http_client        3.1.0                      py_0    conda-forge
pytorch                   0.4.1            py36ha74772b_0    anaconda
pytz                      2018.5                   py36_0
pywavelets                1.0.0            py36hdd07704_0
pyyaml                    3.13             py36h14c3975_0
pyzmq                     17.1.2           py36h14c3975_0
qt                        5.9.6                h8703b6f_2
qtawesome                 0.5.0                    py36_0
qtconsole                 4.4.1                    py36_0
qtpy                      1.5.1                    py36_0
readline                  7.0                  h7b6447c_5
requests                  2.19.1                   py36_0
requests-oauthlib         0.8.0                    py36_1    conda-forge
rope                      0.11.0                   py36_0
rsa                       4.0                      pypi_0    pypi
ruamel_yaml               0.15.46          py36h14c3975_0
s3transfer                0.1.13                   py36_0
scikit-image              0.14.0           py36hf484d3e_1
scikit-learn              0.20.2           py36hd81dba3_0    anaconda
scipy                     1.2.0            py36h7c811a0_0    anaconda
seaborn                   0.9.0                    py36_0
secretstorage             3.1.0                    py36_0
send2trash                1.5.0                    py36_0
sendgrid                  5.6.0                      py_0    conda-forge
service_identity          17.0.0           py36h28b3542_0
setuptools                40.2.0                   py36_0
simplegeneric             0.8.1                    py36_2
singledispatch            3.4.0.3                  py36_0
sip                       4.19.8           py36hf484d3e_0
six                       1.11.0                   py36_1
smart_open                1.8.0                    py36_0
snappy                    1.1.7                hbae5bb6_3
snowballstemmer           1.2.1                    py36_0
sortedcollections         1.0.1                    py36_0
sortedcontainers          2.0.5                    py36_0
sphinx                    1.8.1                    py36_0
sphinxcontrib             1.0                      py36_1
sphinxcontrib-websupport  1.1.0                    py36_1
spyder                    3.3.1                    py36_1
spyder-kernels            0.2.6                    py36_0
sqlalchemy                1.2.12           py36h7b6447c_0
sqlite                    3.26.0               h7b6447c_0    anaconda
statsmodels               0.9.0            py36h035aef0_0
sympy                     1.3                      py36_0
tblib                     1.3.2                    py36_0
tensorboard               1.12.0           py36hf484d3e_0
tensorflow                1.12.0          gpu_py36he68c306_0
tensorflow-base           1.12.0          gpu_py36h8e0ae2d_0
tensorflow-gpu            1.12.0               h0d30ee6_0    anaconda
termcolor                 1.1.0                    py36_1
terminado                 0.8.1                    py36_1
testpath                  0.3.1                    py36_0
tk                        8.6.8                hbc83047_0
toolz                     0.9.0                    py36_0
tornado                   5.1.1            py36h7b6447c_0
tqdm                      4.26.0           py36h28b3542_0
traitlets                 4.3.2                    py36_0
twisted                   18.7.0           py36h14c3975_1
typed-ast                 1.1.0            py36h14c3975_0
unicodecsv                0.14.1                   py36_0
unixodbc                  2.3.7                h14c3975_0
uritemplate               3.0.0                    pypi_0    pypi
urllib3                   1.23                     py36_0
wcwidth                   0.1.7                    py36_0
webencodings              0.5.1                    py36_1
werkzeug                  0.14.1                   py36_0
wheel                     0.31.1                   py36_0
widgetsnbextension        3.4.2                    py36_0
wrapt                     1.10.11          py36h14c3975_2
xgboost                   0.80             py36hfc679d8_1    conda-forge
xlrd                      1.1.0                    py36_1
xlsxwriter                1.1.1                    py36_0
xlwt                      1.3.0                    py36_0
xz                        5.2.4                h14c3975_4
yaml                      0.1.7                had09818_2
zeromq                    4.2.5                hf484d3e_1
zict                      0.1.3                    py36_0
zlib                      1.2.11               ha838bed_2
zope                      1.0                      py36_1
zope.interface            4.5.0            py36h14c3975_0


我尝试使用conda切换到python的另一个版本,我是3.8.6,现在是3.6.6。我也尝试切换熊猫版本

最佳答案

我用将pandas-gbq降级到0.8.0的魔术来修复它,我与pandas和pandas-gbq有一些冲突

08-04 23:58