Astronomers have always been fascinated by the different sizes and colors of stars that they observed. In 1817 a German instrument maker named Joseph von Fraunhofer attached a spectroscope to a telescope and pointed it at the stars. He found that different stars have different absorption lines in their spectra.
The new system reordered the classes into the order OBAFGKM where O stars are the hottest and each successive class is cooler with M being the coolest stars. Each letter was also divided into tenths of the range by adding a number 0-9 to the end. O stars are the least common and M are the most common found in the main sequence of stars. Stars near the beginning or end of their lives are not part of this classification.
Implementing kmeans algorithm using sklearn package among the dataset