Untitled

From Morose Lizard, 11 Months ago, written in Plain Text, viewed 223 times.
URL http://codebin.org/view/ae045c5c Embed
Download Paste or View Raw
  1. #Решение прошло
  2.  
  3. import pandas as pd
  4. logs = pd.read_csv('/datasets/logs.csv')
  5. logs['email'] = logs['email'].fillna(value='')
  6. logs.loc[logs['source'] == 'None', 'source'] = 'email'
  7. print(logs['source'].value_counts())
  8.  
  9. other      133834
  10. context     52032
  11. email       13953
  12. undef         181
  13. Name: source, dtype: int64
  14.  
  15.  
  16. #Решение не прошло
  17.  
  18. import pandas as pd
  19. logs = pd.read_csv('/datasets/logs.csv')
  20. logs['email'] = logs['email'].fillna(value='')
  21. logs['source'].loc[logs['source'] == 'None'] = 'email'
  22. print(logs['source'].value_counts())
  23.  
  24. See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  25.   self._setitem_single_block(indexer, value, name)
  26. other      133834
  27. context     52032
  28. email       13953
  29. undef         181
  30. Name: source, dtype: int64
  31.  

Replies to Untitled rss

Title Name Language When
Re: Untitled Scorching Dove text 11 Months ago.

Reply to "Untitled"

Here you can reply to the paste above