尝试运行基本 Apache Beam Pipeline 时获得"AttributeError: type object 'Series' has no attribute 'append'"



Beam Code可以在Google Collab中工作,但不能在我自己的jupyter笔记本上工作-可能与Pandas 2.0.0有关?如有任何帮助,不胜感激。

我正在尝试学习Apache Beam,我试图根据云AI和分析频道的教程创建一个基本的管道。

这是代码:

import apache_beam as beam
grocery = (p1
| "Read From Text" >> beam.io.ReadFromText(file, skip_header_lines=1)
| "Convert to uppercase" >> beam.Map(lambda record: record.upper())
| 'Write to Text' >> beam.io.WriteToText('/concent/grocery_upper.txt'))

此代码在Google Collaboratory中工作,但在我的本地Jupyter Notebook中不工作。

我得到了这个错误:

"name": "AttributeError",
"message": "type object 'Series' has no attribute 'append'",

完整错误信息:

"stack": "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mAttributeError\u001b[0m                           
Traceback (most recent call last)\nCell \u001b[0;32mIn[14], line 21\u001b[0m\n\u001b[1;32m     19\u001b[0m \u001b[39mimport\u001b[39;00m \u001b[39mapache_beam\u001b[39;00m \u001b[39mas\u001b[39;00m \u001b[39mbeam\u001b[39;00m\n\u001b[1;32m     20\u001b[0m \u001b[39mprint\u001b[39m(beam\u001b[39m.\u001b[39m__version__)\n\u001b[0;32m---> 21\u001b[0m grocery \u001b[39m=\u001b[39m (p1\n\u001b[1;32m     22\u001b[0m            \u001b[39m|\u001b[39;49m \u001b[39m"\u001b[39;49m\u001b[39mRead From Text\u001b[39;49m\u001b[39m"\u001b[39;49m \u001b[39m>>\u001b[39;49m beam\u001b[39m.\u001b[39;49mio\u001b[39m.\u001b[39;49mReadFromText(file, skip_header_lines\u001b[39m=\u001b[39;49m\u001b[39m1\u001b[39;49m)\n\u001b[1;32m     23\u001b[0m            \u001b[39m|\u001b[39m \u001b[39m"\u001b[39m\u001b[39mConvert to uppercase\u001b[39m\u001b[39m"\u001b[39m \u001b[39m>>\u001b[39m beam\u001b[39m.\u001b[39mMap(\u001b[39mlambda\u001b[39;00m record: record\u001b[39m.\u001b[39mupper()) \u001b[39m# New step to convert to uppercase\u001b[39;00m\n\u001b[1;32m     24\u001b[0m            \u001b[39m|\u001b[39m \u001b[39m'\u001b[39m\u001b[39mWrite to Text\u001b[39m\u001b[39m'\u001b[39m \u001b[39m>>\u001b[39m beam\u001b[39m.\u001b[39mio\u001b[39m.\u001b[39mWriteToText(\u001b[39m'\u001b[39m\u001b[39m/concent/grocery_upper.txt\u001b[39m\u001b[39m'\u001b[39m))\n\nFile \u001b[0;32m/usr/local/lib/python3.9/site-packages/apache_beam/transforms/ptransform.py:1095\u001b[0m, in \u001b[0;36m_NamedPTransform.__ror__\u001b[0;34m(self, pvalueish, _unused)\u001b[0m\n\u001b[1;32m   1094\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39m__ror__\u001b[39m(\u001b[39mself\u001b[39m, pvalueish, _unused\u001b[39m=\u001b[39m\u001b[39mNone\u001b[39;00m):\n\u001b[0;32m-> 1095\u001b[0m   \u001b[39mreturn\u001b[39;00m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mtransform\u001b[39m.\u001b[39;49m\u001b[39m__ror__\u001b[39;49m(pvalueish, \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mlabel)\n\nFile \u001b[0;32m/usr/local/lib/python3.9/site-packages/apache_beam/transforms/ptransform.py:617\u001b[0m, in \u001b[0;36mPTransform.__ror__\u001b[0;34m(self, left, label)\u001b[0m\n\u001b[1;32m    615\u001b[0m pvalueish \u001b[39m=\u001b[39m _SetInputPValues()\u001b[39m.\u001b[39mvisit(pvalueish, replacements)\n\u001b[1;32m    616\u001b[0m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mpipeline \u001b[39m=\u001b[39m p\n\u001b[0;32m--> 617\u001b[0m result \u001b[39m=\u001b[39m p\u001b[39m.\u001b[39;49mapply(\u001b[39mself\u001b[39;49m, pvalueish, label)\n\u001b[1;32m    618\u001b[0m \u001b[39mif\u001b[39;00m deferred:\n\u001b[1;32m    619\u001b[0m   \u001b[39mreturn\u001b[39;00m result\n\nFile \u001b[0;32m/usr/local/lib/python3.9/site-packages/apache_beam/pipeline.py:666\u001b[0m, in \u001b[0;36mPipeline.apply\u001b[0;34m(self, transform, pvalueish, label)\u001b[0m\n\u001b[1;32m    664\u001b[0m old_label, transform\u001b[39m.\u001b[39mlabel \u001b[39m=\u001b[39m transform\u001b[39m.\u001b[39mlabel, label\n\u001b[1;32m    665\u001b[0m \u001b[39mtry\u001b[39;00m:\n\u001b[0;32m--> 666\u001b[0m   \u001b[39mreturn\u001b[39;00m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mapply(transform, pvalueish)\n\u001b[1;32m    667\u001b[0m \u001b[39mfinally\u001b[39;00m:\n\u001b[1;32m    668\u001b[0m   transform\u001b[39m.\u001b[39mlabel \u001b[39m=\u001b[39m old_label\n\nFile \u001b[0;32m/usr/local/lib/python3.9/site-packages/apache_beam/pipeline.py:674\u001b[0m, in \u001b[0;36mPipeline.apply\u001b[0;34m(self, transform, pvalueish, label)\u001b[0m\n\u001b[1;32m    670\u001b[0m \u001b[39m# Attempts to alter the label of the transform to be applied only when it's\u001b[39;00m\n\u001b[1;32m    671\u001b[0m \u001b[39m# a top-level transform so that the cell number will not be prepended to\u001b[39;00m\n\u001b[1;32m    672\u001b[0m \u001b[39m# every child transform in a composite.\u001b[39;00m\n\u001b[1;32m    673\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_current_transform() \u001b[39mis\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_root_transform():\n\u001b[0;32m--> 674\u001b[0m   alter_label_if_ipython(transform, pvalueish)\n\u001b[1;32m    676\u001b[0m full_label \u001b[39m=\u001b[39m \u001b[39m'\u001b[39m\u001b[39m/\u001b[39m\u001b[39m'\u001b[39m\u001b[39m.\u001b[39mjoin(\n\u001b[1;32m    677\u001b[0m     [\u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_current_transform()\u001b[39m.\u001b[39mfull_label, label \u001b[39mor\u001b[39;00m\n\u001b[1;32m    678\u001b[0m      transform\u001b[39m.\u001b[39mlabel])\u001b[39m.\u001b[39mlstrip(\u001b[39m'\u001b[39m\u001b[39m/\u001b[39m\u001b[39m'\u001b[39m)\n\u001b[1;32m    679\u001b[0m \u001b[39mif\u001b[39;00m full_label \u001b[39min\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mapplied_labels:\n\nFile \u001b[0;32m/usr/local/lib/python3.9/site-packages/apache_beam/utils/interactive_utils.py:74\u001b[0m, in \u001b[0;36malter_label_if_ipython\u001b[0;34m(transform, pvalueish)\u001b[0m\n\u001b[1;32m     62\u001b[0m \u001b[39m\u001b[39m\u001b[39m"""Alters the label to an interactive label with ipython prompt metadata\u001b[39;00m\n\u001b[1;32m     63\u001b[0m \u001b[39mprefixed for the given transform if the given pvalueish belongs to a\u001b[39;00m\n\u001b[1;32m     64\u001b[0m \u001b[39muser-defined pipeline and current code execution is within an ipython kernel.\u001b[39;00m\n\u001b[0;32m   (...)\u001b[0m\n\u001b[1;32m     71\u001b[0m \u001b[39m`Cell {prompt}: {original_label}`.\u001b[39;00m\n\u001b[1;32m     72\u001b[0m \u001b[39m"""\u001b[39;00m\n\u001b[1;32m     73\u001b[0m \u001b[39mif\u001b[39;00m is_in_ipython():\n\u001b[0;32m---> 74\u001b[0m   \u001b[39mfrom\u001b[39;00m \u001b[39mapache_beam\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mrunners\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39minteractive\u001b[39;00m \u001b[39mimport\u001b[39;00m interactive_environment \u001b[39mas\u001b[39;00m ie\n\u001b[1;32m     75\u001b[0m   \u001b[39m# Tracks user defined pipeline instances in watched scopes so that we only\u001b[39;00m\n\u001b[1;32m     76\u001b[0m   \u001b[39m# alter labels for any transform to pvalueish belonging to those pipeline\u001b[39;00m\n\u001b[1;32m     77\u001b[0m   \u001b[39m# instances, excluding any transform to be applied in other pipeline\u001b[39;00m\n\u001b[1;32m     78\u001b[0m   \u001b[39m# instances the Beam SDK creates implicitly.\u001b[39;00m\n\u001b[1;32m     79\u001b[0m   ie\u001b[39m.\u001b[39mcurrent_env()\u001b[39m.\u001b[39mtrack_user_pipelines()\n\nFile \u001b[0;32m/usr/local/lib/python3.9/site-packages/apache_beam/runners/interactive/interactive_environment.py:41\u001b[0m\n\u001b[1;32m     39\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mapache_beam\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mrunners\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mdirect\u001b[39;00m \u001b[39mimport\u001b[39;00m direct_runner\n\u001b[1;32m     40\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mapache_beam\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mrunners\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39minteractive\u001b[39;00m \u001b[39mimport\u001b[39;00m cache_manager \u001b[39mas\u001b[39;00m cache\n\u001b[0;32m---> 41\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mapache_beam\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mrunners\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39minteractive\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mmessaging\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39minteractive_environment_inspector\u001b[39;00m \u001b[39mimport\u001b[39;00m InteractiveEnvironmentInspector\n\u001b[1;32m     42\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mapache_beam\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mrunners\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39minteractive\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mrecording_manager\u001b[39;00m \u001b[39mimport\u001b[39;00m RecordingManager\n\u001b[1;32m     43\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mapache_beam\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mrunners\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39minteractive\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39msql\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39msql_chain\u001b[39;00m \u001b[39mimport\u001b[39;00m SqlChain\n\nFile \u001b[0;32m/usr/local/lib/python3.9/site-packages/apache_beam/runners/interactive/messaging/interactive_environment_inspector.py:26\u001b[0m\n\u001b[1;32m     23\u001b[0m \u001b[39m# pytype: skip-file\u001b[39;00m\n\u001b[1;32m     25\u001b[0m \u001b[39mimport\u001b[39;00m \u001b[39mapache_beam\u001b[39;00m \u001b[39mas\u001b[39;00m \u001b[39mbeam\u001b[39;00m\n\u001b[0;32m---> 26\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mapache_beam\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mrunners\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39minteractive\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mutils\u001b[39;00m \u001b[39mimport\u001b[39;00m as_json\n\u001b[1;32m     27\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mapache_beam\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mrunners\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39minteractive\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mutils\u001b[39;00m \u001b[39mimport\u001b[39;00m obfuscate\n\u001b[1;32m     30\u001b[0m \u001b[39mclass\u001b[39;00m \u001b[39mInteractiveEnvironmentInspector\u001b[39;00m(\u001b[39mobject\u001b[39m):\n\nFile \u001b[0;32m/usr/local/lib/python3.9/site-packages/apache_beam/runners/interactive/utils.py:33\u001b[0m\n\u001b[1;32m     30\u001b[0m \u001b[39mimport\u001b[39;00m \u001b[39mpandas\u001b[39;00m \u001b[39mas\u001b[39;00m \u001b[39mpd\u001b[39;00m\n\u001b[1;32m     32\u001b[0m \u001b[39mimport\u001b[39;00m \u001b[39mapache_beam\u001b[39;00m \u001b[39mas\u001b[39;00m \u001b[39mbeam\u001b[39;00m\n\u001b[0;32m---> 33\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mapache_beam\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mdataframe\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mconvert\u001b[39;00m \u001b[39mimport\u001b[39;00m to_pcollection\n\u001b[1;32m     34\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mapache_beam\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mdataframe\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mframe_base\u001b[39;00m \u001b[39mimport\u001b[39;00m DeferredBase\n\u001b[1;32m     35\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mapache_beam\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39minternal\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mgcp\u001b[39;00m \u001b[39mimport\u001b[39;00m auth\n\nFile \u001b[0;32m/usr/local/lib/python3.9/site-packages/apache_beam/dataframe/convert.py:33\u001b[0m\n\u001b[1;32m     31\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mapache_beam\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mdataframe\u001b[39;00m \u001b[39mimport\u001b[39;00m expressions\n\u001b[1;32m     32\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mapache_beam\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mdataframe\u001b[39;00m \u001b[39mimport\u001b[39;00m frame_base\n\u001b[0;32m---> 33\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mapache_beam\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mdataframe\u001b[39;00m \u001b[39mimport\u001b[39;00m transforms\n\u001b[1;32m     34\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mapache_beam\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mdataframe\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mschemas\u001b[39;00m \u001b[39mimport\u001b[39;00m element_typehint_from_dataframe_proxy\n\u001b[1;32m     35\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mapache_beam\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mdataframe\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mschemas\u001b[39;00m \u001b[39mimport\u001b[39;00m generate_proxy\n\nFile \u001b[0;32m/usr/local/lib/python3.9/site-packages/apache_beam/dataframe/transforms.py:33\u001b[0m\n\u001b[1;32m     31\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mapache_beam\u001b[39;00m \u001b[39mimport\u001b[39;00m transforms\n\u001b[1;32m     32\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mapache_beam\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mdataframe\u001b[39;00m \u001b[39mimport\u001b[39;00m expressions\n\u001b[0;32m---> 33\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mapache_beam\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mdataframe\u001b[39;00m \u001b[39mimport\u001b[39;00m frames  \u001b[39m# pylint: disable=unused-import\u001b[39;00m\n\u001b[1;32m     34\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mapache_beam\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mdataframe\u001b[39;00m \u001b[39mimport\u001b[39;00m partitionings\n\u001b[1;32m     35\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mapache_beam\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mutils\u001b[39;00m \u001b[39mimport\u001b[39;00m windowed_value\n\nFile \u001b[0;32m/usr/local/lib/python3.9/site-packages/apache_beam/dataframe/frames.py:1229\u001b[0m\n\u001b[1;32m   1222\u001b[0m       \u001b[39mreturn\u001b[39;00m func(\u001b[39m*\u001b[39margs, \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mkwargs)\n\u001b[1;32m   1224\u001b[0m     \u001b[39mreturn\u001b[39;00m func(\u001b[39mself\u001b[39m, \u001b[39m*\u001b[39margs, \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mkwargs)\n\u001b[1;32m   1227\u001b[0m \u001b[39m@populate_not_implemented\u001b[39m(pd\u001b[39m.\u001b[39mSeries)\n\u001b[1;32m   1228\u001b[0m \u001b[39m@frame_base\u001b[39m\u001b[39m.\u001b[39mDeferredFrame\u001b[39m.\u001b[39m_register_for(pd\u001b[39m.\u001b[39mSeries)\n\u001b[0;32m-> 1229\u001b[0m \u001b[39mclass\u001b[39;00m \u001b[39mDeferredSeries\u001b[39;00m(DeferredDataFrameOrSeries):\n\u001b[1;32m   1230\u001b[0m   \u001b[39mdef\u001b[39;00m \u001b[39m__repr__\u001b[39m(\u001b[39mself\u001b[39m):\n\u001b[1;32m   1231\u001b[0m     \u001b[39mreturn\u001b[39;00m (\n\u001b[1;32m   1232\u001b[0m         \u001b[39mf\u001b[39m\u001b[39m'\u001b[39m\u001b[39mDeferredSeries(name=\u001b[39m\u001b[39m{\u001b[39;00m\u001b[39mself\u001b[39m\u001b[39m.\u001b[39mname\u001b[39m!r}\u001b[39;00m\u001b[39m, dtype=\u001b[39m\u001b[39m{\u001b[39;00m\u001b[39mself\u001b[39m\u001b[39m.\u001b[39mdtype\u001b[39m}\u001b[39;00m\u001b[39m, \u001b[39m\u001b[39m'\u001b[39m\n\u001b[1;32m   1233\u001b[0m         \u001b[39mf\u001b[39m\u001b[39m'\u001b[39m\u001b[39m{\u001b[39;00m\u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_render_indexes()\u001b[39m}\u001b[39;00m\u001b[39m)\u001b[39m\u001b[39m'\u001b[39m)\n\nFile \u001b[0;32m/usr/local/lib/python3.9/site-packages/apache_beam/dataframe/frames.py:1337\u001b[0m, in \u001b[0;36mDeferredSeries\u001b[0;34m()\u001b[0m\n\u001b[1;32m   1329\u001b[0m transpose \u001b[39m=\u001b[39m frame_base\u001b[39m.\u001b[39m_elementwise_method(\u001b[39m'\u001b[39m\u001b[39mtranspose\u001b[39m\u001b[39m'\u001b[39m, base\u001b[39m=\u001b[39mpd\u001b[39m.\u001b[39mSeries)\n\u001b[1;32m   1330\u001b[0m shape \u001b[39m=\u001b[39m \u001b[39mproperty\u001b[39m(\n\u001b[1;32m   1331\u001b[0m     frame_base\u001b[39m.\u001b[39mwont_implement_method(\n\u001b[1;32m   1332\u001b[0m         pd\u001b[39m.\u001b[39mSeries, \u001b[39m'\u001b[39m\u001b[39mshape\u001b[39m\u001b[39m'\u001b[39m, reason\u001b[39m=\u001b[39m\u001b[39m"\u001b[39m\u001b[39mnon-deferred-result\u001b[39m\u001b[39m"\u001b[39m))\n\u001b[1;32m   1334\u001b[0m \u001b[39m@frame_base\u001b[39;49m\u001b[39m.\u001b[39;49mwith_docs_from(pd\u001b[39m.\u001b[39;49mSeries)\n\u001b[1;32m   1335\u001b[0m \u001b[39m@frame_base\u001b[39;49m\u001b[39m.\u001b[39;49margs_to_kwargs(pd\u001b[39m.\u001b[39;49mSeries)\n\u001b[1;32m   1336\u001b[0m \u001b[39m@frame_base\u001b[39;49m\u001b[39m.\u001b[39;49mpopulate_defaults(pd\u001b[39m.\u001b[39;49mSeries)\n\u001b[0;32m-> 1337\u001b[0m \u001b[39mdef\u001b[39;49;00m \u001b[39mappend\u001b[39;49m(\u001b[39mself\u001b[39;49m, to_append, ignore_index, verify_integrity, \u001b[39m*\u001b[39;49m\u001b[39m*\u001b[39;49mkwargs):\n\u001b[1;32m   1338\u001b[0m \u001b[39m  \u001b[39;49m\u001b[39m"""``ignore_index=True`` is not supported, because it requires generating an\u001b[39;49;00m\n\u001b[1;32m   1339\u001b[0m \u001b[39m  order-sensitive index."""\u001b[39;49;00m\n\u001b[1;32m   1340\u001b[0m   \u001b[39mif\u001b[39;49;00m \u001b[39mnot\u001b[39;49;00m \u001b[39misinstance\u001b[39;49m(to_append, DeferredSeries):\n\nFile \u001b[0;32m/usr/local/lib/python3.9/site-packages/apache_beam/dataframe/frame_base.py:600\u001b[0m, in \u001b[0;36mpopulate_defaults.<locals>.wrap\u001b[0;34m(func)\u001b[0m\n\u001b[1;32m    599\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39mwrap\u001b[39m(func):\n\u001b[0;32m--> 600\u001b[0m   base_argspec \u001b[39m=\u001b[39m getfullargspec(unwrap(\u001b[39mgetattr\u001b[39;49m(base_type, func\u001b[39m.\u001b[39;49m\u001b[39m__name__\u001b[39;49m)))\n\u001b[1;32m    601\u001b[0m   \u001b[39mif\u001b[39;00m \u001b[39mnot\u001b[39;00m base_argspec\u001b[39m.\u001b[39mdefaults:\n\u001b[1;32m    602\u001b[0m     \u001b[39mreturn\u001b[39;00m func\n\n\u001b[0;31m
AttributeError\u001b[0m: type object 'Series' has no attribute 'append'"
}

我很困惑为什么这在协作中工作,而不是在我自己的Jupyter Notebook中使用VSCode。他们运行的是同一个版本。它将错误选为来自我的PTransforms的第一行,我甚至不必在管道中包含run函数,它就会出错。

我唯一能猜到的是,也许是因为我的VSCode版本使用的是新的预发布版本的Pandas?但是这个笔记本里根本没有Pandas代码。

任何帮助将非常感激-谢谢!

安装apache-beam时,请使用pip install "apache-beam[gcp,interactive,dataframe]"。这将确保您安装1.5.3版本的pandas。

相关内容

  • 没有找到相关文章

最新更新