dfply
dfply copied to clipboard
use mask for column names with blank
for some reasons, I have a very complicate excel be read into pandas, some column names are with blank, i.e "Commercial Project-ID", target_data_frame= orginal_data_frame >> mask(X.['Commercial Project-ID']==0) or target_data_frame= orginal_data_frame >> mask(X.'Commercial Project-ID'==0) or target_data_frame= orginal_data_frame >> mask(X.Commercial Project-ID==0)
either way, not work of course I can remove the blank before the filter, but I am wondering, if there are better way to do
In addition, if you happen to have a column called isin
which is a pandas function, the mask
call doesn't work. It might not be exactly the same issue but could possibly be solved using a similar method as above.
Here is a minimal example which yields an error:AttributeError: 'NotImplementedType' object has no attribute 'dtype'
pp = pd.DataFrame( {'isin': ['a','b']})
pp >> mask(X.isin == 'b')