Question: I'm just starting out learning Python/Spyder. I have completed a few classes in R for data science.

Below is failing with the error: IOError: File APPL.csv does not exist 

However, my script and .csv file are in the same folder. Any thoughts on what I'm doing wrong? Thanks

```
    import pandas as pd

     def test_run():
         df = pd.read_csv("APPL.csv")
         print df

     if __name__ == "__main__":
          test_run()

```

Answer: 
You can normalize your vectors and then cosine similarity or Euclidean distance will give same results. Mathematically it is easy to see that the Euclidean distance = 2 (1 - Cosine Similarity) for normalized vectors.
The KMeans algorithm is based on Euclidean distance, and can not directly use cosine distance. [Here](https://stats.stackexchange.com/questions/81481/why-does-k-means-clustering-algorithm-use-only-euclidean-distance-metric) is a good explanation of this fact:

> 
> K-Means is implicitly based on pairwise Euclidean distances b/w data points, because the sum of squared deviations from centroid is equal to the sum of pairwise squared Euclidean distances divided by the number of points.
> 
> 
> 

If you wish to use cosine distance (or any other metric), [KMedoids](https://en.wikipedia.org/wiki/K-medoids) might be a good option. It is similar to KMeans, but uses the median, instead of the mean, in it's update step. This allows the use of arbitrary distance metrics.