Guest User

Untitled

a guest
Jun 24th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. import pandas as pd
  2. import numpy as np
  3.  
  4. numbers = [9, 23, 33, 91, 13, 7]
  5. players = ["Ron Harper", "Michael Jordan", "Scottie Pippen", "Dennis Rodman", "Luc Longley", "Toni Kukoc"]
  6. colleges = ["Miami University", "University of North Carolina", "University of Central Arkansas", "Southeastern Oklahoma State University", "University of New Mexico", None] # None 替換為 np.nan 亦可
  7. df = pd.DataFrame()
  8. df["number"] = numbers
  9. df["player"] = players
  10. df["college"] = colleges
  11. print(df["college"].isna()) # 判斷大學是否有遺漏值
  12. df[df["college"].isna()] # 篩選出大學為遺漏值的列數
Add Comment
Please, Sign In to add comment