dfe["male"]=dfp["male"]But the last line caused memory errors.
dfe["birth_year"] = dfp["birth_year"]
dfe["age"] = dfe["out_year"] - dfe["birth_year"]
It may be an issue internal to Pandas or the garbage collector in Python.
I guess one might try generators and iterators, but I found something simple that also worked: Just convert the two columns to lists, delete one list from another and append the result to the dataframe. In short, doing the process outside of the dataframe seemed to solve the problem. Like this:
test1 = dfe["out_year"].values
test2 = dfe["birth_year"].values
test3 = test1 - test2
No comments:
Post a Comment