pandas - What is the best way for feature extraction form text in Python -
lets have row in series in python containing values a, b, c, a. can apply count vectorizer count vectorizer return a -2, b-1, c-1. want following output a-1, b-1, c-1. should see present , return 1 it. how can that?
how can total number of unique values inside series. if second row has b, d. should return 4.
lets name of series df['a'].
1st row = a,b,c,a desired output-a,b,c
2nd row = b,d,b desired output-b,d
you can unique items of series by:
df['a'].unique() additionally, can use series.value_counts:
df['a'].value_counts() this return count of unique values in series.
Comments
Post a Comment