I have been trying to learn Python, specifically with respect to applying K-Means Analysis to my data.
I found the following tutorial and copied the code into Jupyter notebook to run it.
I received three different errors, one of which I resolved (changed “size” to the revised “height” in the code.
The first warning was returned for two instances of the following code, one for a training set and the second for a test set.
Fill missing values with mean column values in the train set
train.fillna(train.mean(), inplace=True)
FutureWarning: Dropping of nuisance columns in DataFrame reductions (with ‘numeric_only=None’) is deprecated; in a future version this will raise TypeError. Select only valid columns before calling the reduction.
train.fillna(train.mean(), inplace=True)
The second was for multiple instances of slight variants of the following code:
TypeError Traceback (most recent call last)
Input In [44], in <cell line: 1>()
----> 1 KMeans(algorithm=‘auto’, copy_x=True, init=‘k-means++’, max_iter=600,
2 n_clusters=2, n_init=10, n_jobs=1, precompute_distances=‘auto’,
3 random_state=None, tol=0.0001, verbose=0)
TypeError: init() got an unexpected keyword argument ‘n_jobs’
My question is this, is it worth learning Python if code is going to become obsolete, with code no longer running over, in this case, four years?