直接上实例代码吧
import pandas as pd
import numpy as np
if __name__ == '__main__':
df = pd.DataFrame({
'AAA': range(5), 'BBB': list('abcde'), 'CCC': ['a', 12, 1.2, ['alist'], (1, 2)]})
print(df)
df['CCC'] = np.where(df[
import pandas as pd
import numpy as np
if __name__ == '__main__':
df = pd.DataFrame({
'AAA': range(5), 'BBB': list('abcde'), 'CCC': ['a', 12, 1.2, ['alist'], (1, 2)]})
print(df)
df['CCC'] = np.where(df[