'Why does column + column concatenation create arrays for some Windows accounts?
When running the below Python code, I get different results depending on the user account/admin privileges that is used. The code is saved as test.py
on a Windows Server 2016 machine.
import pandas as pd
data = {'A': ['a', 'b'], 'B': ['c', 'd']}
df = pd.DataFrame(data)
df['C'] = df['A'] + df['B']
print(df.head())
With df['C'] = df['A'] + df['B']
, pandas
should perform element-wise concatenation of columns A and B. Running python test.py
in a CMD with admin gets the following correct results.
A B C
0 a c ac
1 b d bd
But running the same command in a non-admin CMD gets the below results. In this case, pandas
seems to not do element-wise concatenation.
A B C
0 a c [ac, ad]
1 b d [bc, bd]
I have verified that the user account does have access to the Python, pandas and numpy folders. I would also expect the code to outright fail or error if this was a permission error, but it runs fine, just with incorrect results.
I have also verified that in both cases, the same python.exe
is called.
Versions:
Python - 3.5.6
pandas - 0.23.4
numpy - 1.14.2
Why does pandas
give different results when trying to concatenate two columns depending on if the code is run with or without admin privileges? Is there another file/folder the user account requires access to for pandas
to perform this correctly?
UPDATE
I managed to resolve this by running the following command, found here, on the main Python folder.
ICACLS "<FolderPath>" /INHERITANCE:e /GRANT:r <UserName>:(F) /T /C
But this still does not explain why pandas
does incorrect concatenation. Leaving the question up in hopes of one day getting an answer.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|