It doesn't make any difference how many "values" there are. The dataframe operations shown are working with series (columns). A column containint 20,000 values works exactly as one containing 4.
This part is just so I have two dataframes to work with.
df1 = pd.DataFrame({"Letters": ["A", "B", "C", "D"]})
df2 = pd.DataFrame({"Numbers": [1, 2, 3, 4]})
If you prefer they could each have 1,000,000 values.
I get an error when I do this:
import pandas as pd
df1 = pd.DataFrame({"Letters": ["A", "B", "C", "D"]})
df2 = pd.DataFrame({"Numbers": [1, 2, 3, 4, 5]})
df1["Integers"] = df2["Number"]
print(df1)
Error:
Traceback (most recent call last):
File "...\lib\site-packages\pandas\core\indexes\base.py", line 3621, in get_loc
return self._engine.get_loc(casted_key)
File "pandas\_libs\index.pyx", line 136, in pandas._libs.index.IndexEngine.get_loc
File "pandas\_libs\index.pyx", line 163, in pandas._libs.index.IndexEngine.get_loc
File "pandas\_libs\hashtable_class_helper.pxi", line 5198, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas\_libs\hashtable_class_helper.pxi", line 5206, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'Number'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File ...test.py", line 6, in <module>
df1["Integers"] = df2["Number"]
File "...\lib\site-packages\pandas\core\frame.py", line 3505, in __getitem__
indexer = self.columns.get_loc(key)
File "...\lib\site-packages\pandas\core\indexes\base.py", line 3623, in get_loc
raise KeyError(key) from err
KeyError: 'Number'
That looks a lot like your error. I think (am quite sure) there is no "machine_status" column in df1.