Advertisement
inilim

Untitled

Dec 14th, 2021
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.97 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # coding: utf-8
  3. # In[44]:
  4. import pandas as pd
  5. import numpy as np
  6. import json
  7. # In[30]:
  8. with open('123.json', encoding="utf8") as f:
  9.     s1 = json.load(f)
  10. # In[31]:
  11. s2 = json.dumps(s1)
  12. dataLite = json.loads(s2)
  13. # In[ ]:
  14. dataF = pd.DataFrame(dataLite['rows'])
  15. # In[37]:
  16. dataF.columns = ['nameG', 'name', 'unixDate', 'viewersCount']
  17.  
  18. pd.read_json()
  19. # In[39]:
  20. with open('GamesAndChannels.json', encoding="utf8") as f:
  21.     gc1 = json.load(f)
  22. gc2 = json.dumps(gc1)
  23. dataGC = json.loads(gc2)
  24. # In[40]:
  25. games = pd.DataFrame(dataGC['games'])
  26. # In[41]:
  27. channels = pd.DataFrame(dataGC['channels'])
  28. # In[77]:
  29. games = games.rename(columns={'name': 'nameG'})
  30. games.iloc[1000:1010]
  31. # In[76]:
  32. channels = channels.rename(columns={'name': 'nameC'})
  33. channels.iloc[1000:1010]
  34.  
  35. dataF["idGame"] = np.nan
  36. dataF["idChannel"] = np.nan
  37. # In[46]:
  38. dataF
  39.  
  40. dataF['test'] = np.where(games['nameG'] == 1, df.index, '')
  41. # In[ ]:
  42. df.query('Column == 17').index.tolist()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement