Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pandas as pd
- import numpy as np
- raw_data = {
- 'Score1': [42, 52, -999, 24, 73],
- 'Score2': [-999, -999, -999, 2, 1],
- 'Score3': [2, 2, -999, 2, -999]}
- df = pd.DataFrame(raw_data, columns = ['Score1', 'Score2', 'Score3'])
- df.loc[:,('Score2', 'Score3')].replace(-999, np.nan, inplace=True)
- df
Add Comment
Please, Sign In to add comment