Question: I have a `UIViewController` and in its respective storyboard scene I have an activity indicator connect to the controller like this:

```
@IBOutlet weak var activityIndicator: UIActivityIndicatorView!

```

I want to hide this activity indicator when the view is first launched, then after the users presses a button, inside its `@IBAction`, I want to start animating the indicator. So I wrote this:

```
override func viewDidLoad() {
    super.viewDidLoad()        
    activityIndicator.stopAnimating()
}

```

and in my `@IBAction` I have:

```
@IBAction func attemptLogin(sender: UIButton) {    
    // Start the activity indicator
    activityIndicator.startAnimating()
}

```

But this code does not work. The screen is launched without showing the activity indicator but when the button is pressed, it does not start animating and it does not even appear.

I have tried setting the `.hidden` property of this object but didn't get anywhere. I do not really want to add this indicator programmatically. Is there a way to make it work?

Answer: 
You can find out how many unique values are in each column with:

```
sapply(DF, function(col) length(unique(col)))
#  Temp Feels  Time  Year 
#  5     2     1     1 

```

You can use this to subset the columns:

```
DF[, sapply(DF, function(col) length(unique(col))) > 1]
#   Temp Feels
# 1   26  cold
# 2   27  cold
# 3   28  cold
# 4   29   hot
# 5   30   hot

```
I've also another possible solution for dropping the columns with categorical value with 2 lines of code, defining a list with columns of categorical values (1st line) and dropping them with the second line. df is our dataframe

df with categorical column:

[![df with categorical column](https://i.stack.imgur.com/efHva.png)](https://i.stack.imgur.com/efHva.png)

```
 list=pd.DataFrame(df.categorical).columns
 df= df.drop(list,axis=1)

```

df after running the code:

[![df after running the code](https://i.stack.imgur.com/cXe4I.png)](https://i.stack.imgur.com/cXe4I.png)