Changing Date format with default property
Question:
0
`vectorizer = TfidfVectorizer(analyzer=’word’,norm=None, use_idf=True,smooth_idf=True) tfIdfMat = vectorizer.fit_transform(df[‘Description’]) feature_names = sorted(vectorizer.get_feature_names())
docList=[‘df.Description’] #skDocsTfIdfdf = pd.DataFrame(tfIdfMat.todense(),index=sorted(docList), columns=feature_names) #print(skDocsTfIdfdf)
for col in tfIdfMat.nonzero()[1]: print (feature_names[col], ‘-‘ , tfIdfMat[0, col])`
Answers:
I think you can encapsulate a function, return the time in this format, and then replace it datetime.now
Because he is calling this function for you
0
`vectorizer = TfidfVectorizer(analyzer=’word’,norm=None, use_idf=True,smooth_idf=True) tfIdfMat = vectorizer.fit_transform(df[‘Description’]) feature_names = sorted(vectorizer.get_feature_names())
docList=[‘df.Description’] #skDocsTfIdfdf = pd.DataFrame(tfIdfMat.todense(),index=sorted(docList), columns=feature_names) #print(skDocsTfIdfdf)
for col in tfIdfMat.nonzero()[1]: print (feature_names[col], ‘-‘ , tfIdfMat[0, col])`
I think you can encapsulate a function, return the time in this format, and then replace it datetime.now
Because he is calling this function for you