This answers assumes I have correctly understood the question... I can alter my answer if OP updates the question with more details
Using your example data, you can use Pandas easily drop all duplicates.
First dump your data above into a Dataframe with three columns (one for each of the items in each row.
import pandas as pd
import your data - assuming it is a list of lists - each of your rows is a list of three items, so we have three columns:
df = pd.DataFrame.from_records(your_list_of_lists, columns=["col1", "col2", "col3"])
Have a look at the first 5 rows:
col1 col2 col3
0 600 900 3418309
1 600 900 3418309
2 600 900 3418314
3 600 900 3418314
4 600 900 3418319
The values will be integers by default, not strings (if they all were). But the solutions below should work the same in either case.
If you want to get all unique values of
col3, you can do one of the following:
uniques1 = set(df.col3) # returns a Python set
uniques2 = df.col3.unique() # returns a NumPy ndarray
uniques3 = df.col3.drop_duplicates() # returns a pandas Series object
If you want to remove only those rows where
col3 repeats itself consecutively (which in some cases could produce the same result as the methods above, depending on the data), then you can look at the methods here. [An example] adapted for your columnar situation2:
def drop_consecutive_duplicates(a, col_name): # returns the dataframe
...: ar = a[col_name].values
...: return a[np.concatenate(([True],ar[:-1] != ar[1:]))]
This will return the entire dataframe, which those rows of consecutive values removed.
There are many other ways to achieve the same result. Of the above, the first method is the fastest (on your small dataset example). Here are the benchmarks:
In : %timeit df.col3.drop_duplicates()
263 µs ± 883 ns per loop (mean ± std. dev. of 7 runs, 1000 loops each)
In : %timeit df.col3.unique()
37.2 µs ± 3.19 µs per loop (mean ± std. dev. of 7 runs, 10000 loops each)
In : %timeit set(df.col3)
10.5 µs ± 45.7 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)
The consective version:
In : %timeit drop_consecutive_duplicates(df, "col3")
266 µs ± 3.61 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)
I imagine the Pandas methods might be able to scale better to a DataFrame with many rows, so this example might be rather biased on the dummy dataset with only ~20 rows.
The final method clearly has a little bit of overhead as it has to perform some extra operations