I have the following Table Test
Work_Experience
1
2
3
4
3 Month
4 months
5 Month
Now i want that a new column should be created IntOnly where first four values (of datatype Int64) should be there and for remaining last 3 rows it should display 'NaN'
I have tried two main codes
Test['IntOnly'] = Test['Work_Experience'].select_dtypes(include='number')
It's throwing 'Series' object has no attribute 'select_dtypes'
IntOnly=[]
for i in Test.Work_Experience:
if Test[i].dtype == 'int64':
IntOnly.append(i)
Its throwing Key Error : 1
Following should be the output
Work_Experience IntOnly
1 1
2 2
3 3
4 4
3 Month NaN
4 months NaN
5 Month NaN