Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Jul1An
Frequent Visitor

Python word clustering

Hello,

im currently facing a Python clustering problem. I would like to extract from a column (say "comment") from the table "rawdata" the individual comments from customers, take out stop words and then cluster by similar sounding terms. Similar sounding because umlauts like ä,ö... are not always saved/ displayed correctly. 

Unfortunately, i cant get a visual to work here. Can someone help me here?

Code I tried to use:

# The following code for creating a data frame and removing duplicate rows is always executed and serves as a preamble to your script:

# dataset = pandas.DataFrame(Comments)
# dataset = dataset.drop_duplicates()
# Fügen oder geben Sie hier Ihren Skriptcode ein:
import pandas as pd
import nltk
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize

df = pd.read_excel("C:\Users\Data.xlsx")
def extract_entities(text) :
stop_words = set(stopwords.words('german'))
word_tokens = word_tokenize(text)
filtered_tokens = [word.lower() for word in word_tokens if word.lower() not in stop_words and word.isalpha()]
tagged = nltk.pos_tag(filtered_tokens, lang='de')
entities = nltk.chunk.ne_chunk(tagged, binary=True)
return entities
df['entities'] = df['Disp_Comments'].apply(extract_entities)
df.groupby('entities')['Disp_Comments'].count()
 
Data sometimes looks like this: 
IDComment
1Kündigung rückgängig machen
2Invoice
 
1 REPLY 1
lbendlin
Super User
Super User

Your Python visual needs to plot something to the default renderer.  What are you planning to display once you are done?

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.