Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. date path
  2. 2017-01-01 /A/B/C/D
  3. 2017-01-01 /X
  4. 2017-01-01 /X/Y
  5.  
  6. date path
  7. 2017-01-01 /A/B
  8. 2017-01-01 /X
  9. 2017-01-01 /X/Y
  10.  
  11. from urllib import quote_plus
  12.  
  13. path_levels = df['path'].split('/')
  14. filtered_path_levels = []
  15. for _level in range(min(df_size, 3)):
  16. # Take only the top 2 levels of path
  17. filtered_path_levels.append(quote_plus(path_levels[_level]))
  18.  
  19. df['path'] = '/'.join(map(str, filtered_path_levels))
  20.  
  21. path_levels = split(results_df['path'], '/')
  22. filtered_path_levels = []
  23. for _level in range(size(df_size, 3)):
  24. # Take only the top 2 levels of path
  25. filtered_path_levels.append(quote_plus(path_levels[_level]))
  26.  
  27. df['path'] = '/'.join(map(str, filtered_path_levels))
  28.  
  29. ValueError: Cannot convert column into bool: please use '&' for 'and', '|' for 'or', '~' for 'not' when building DataFrame boolean expressions.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement