title: DBSCAN Clustering (Python) - exporting the Iris data set with a new column
body: <p>I found this cal to get the relevant clustered data to a new column. Pls see the below</p>
  <p>from sklearn.cluster import DBSCAN
  import numpy as np
  import pandas as pd</p>
  <pre><code>X = np.array([[1, 2], [2, 2], [2, 3],
                [8, 7], [8, 8], [25, 80]])
  df = pd.DataFrame(X)
  clustering = DBSCAN(eps=3, min_samples=2).fit(df)
  df[&quot;clusters&quot;] = clustering.labels_
  </code></pre>
  <p>I have a file on this location &quot;C:\Users\05807\Desktop\New folder (5)\FinalX.csv&quot;</p>
  <p>And there are text fields as well as number fields. so the columns stated in the above report are,</p>
  <p>&quot;Sepal_length&quot;,&quot;Sepal_width&quot;,&quot;Petal_length&quot;,&quot;Petal_width&quot; , &quot;Species_name&quot;,&quot;Species_No&quot;,&quot;ID&quot;,&quot;K-Means&quot;,&quot;Hierarchical&quot;</p>
  <p>So I need to get a new column after &quot;Hierarchical&quot; column named &quot;DBSCAN&quot;. That should contain  which cluster is which as per to DBSCAN Clustering. that means Cluster 1, cluster 2 o cluster 3. (I need the clustering output in to columns in a new CSV)</p>
  <p>This is basically total iris data set with added two more columns. There are 150 rows and i want to export all to a new file with that additional DBSCAN column</p>
  <p>Thanks</p>