pandas assign with new column name as string
pandas assign with new column name as string Question: I recently discovered pandas "assign" method which I find very elegant. My issue is that the name of the new column is assigned as keyword, so it cannot have spaces or dashes in it. df = DataFrame({‘A’: range(1, 11), ‘B’: np.random.randn(10)}) df.assign(ln_A=lambda x: np.log(x.A)) A B …
Total answers: 2