Beam Code 可在 Google Collab 中运行,但无法在我自己的 jupyter 笔记本上运行 - 也许与 Pandas 2.0.0 有关?任何帮助将非常感激。
我正在尝试学习 Apache Beam,我尝试根据Cloud AI 和 Analytics 频道的教程创建一个基本管道。
这是代码:
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'))
Run Code Online (Sandbox Code Playgroud)
此代码适用于 Google Collaboratory,但不适用于我本地的 Jupyter Notebook。
相反,我收到此错误:
Run Code Online (Sandbox Code Playgroud)"name": "AttributeError", "message": "type object 'Series' has no attribute 'append'",
完整错误消息:
Run Code Online (Sandbox Code Playgroud)"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 …