I am a novice at Python. If someone can help me out with this issue, that would be great! What I am trying to do here is create a new column based on an existing column.
Following is the script for the same -
import pandas as pd
df = pd.DataFrame(data=input_table_1)
new_col = df[‘conv’]
#insert the new column at position 2
df = df.insert(2, ‘new_col’, new_col)
output_table_1 = df.copy()
And following is the error I have been getting -
Traceback (most recent call last):
File “”, line 11, in
AttributeError: ‘NoneType’ object has no attribute ‘copy’
Are the output/input tables NoneType objects? I have referred to material and solutions from this forum wherein the usage of copy function to write the table in the output has worked. I do not understand what is going wrong in this case.