Matthew
Matthew

Reputation: 21

Getting "AttributeError: type object 'Series' has no attribute 'append'" when trying to run basic Apache Beam Pipeline

Beam Code works in Google Collab but won't work on my own jupyter notebook - maybe to do with Pandas 2.0.0? Any help would be much appreciated.

I'm trying to learn Apache Beam, I've tried to create a basic pipeline based on the tutorials from the Cloud AI and Analytics channel.

This is the code:

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'))

This code works in Google Collaboratory but doesn't work in my local Jupyter Notebook.

Instead I get this error:

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

Full Error Message:

"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'"
}

I'm confused as to why this works in collab but not in my own Jupyter Notebook Using VSCode. They're running the same version. It's picking the error as coming from the first line of my PTransforms, I don't even have to include the run function on the pipeline for it to error out.

The only thing I can guess is that maybe it's because my version of VSCode is using the new pre-release version of Pandas? But there's no Pandas code in this notebook at all.

Any help would be much appreciated - thanks!

Upvotes: 2

Views: 1485

Answers (2)

Take
Take

Reputation: 1

Run:

!pip install 'apache-beam' --user
!pip install "apache-beam[gcp,interactive,dataframe]" --user

And the kernel needed to be restarted.

Upvotes: 0

XQ Hu
XQ Hu

Reputation: 407

when you install apache-beam, please use pip install "apache-beam[gcp,interactive,dataframe]". This will make sure you install pandas with 1.5.3.

Upvotes: 6

Related Questions