NLTK python scripts in Power Bi

Hi Experts,
I have a survey data which consist of text and there are almost 15,000 records. Can someone plz help and guide me how can i run NLTK key phrase extraction in power bi using python scripts.

I dont want to use Microsoft text analytics as my office dont want the data to go on ther ther server.

Answer:
Hi @EnanBahadur,

Using EDNA AI within the Enterprise DNA platform. Please see below.

Running NLTK Key Phrase Extraction in Power BI using Python Scripts

To run NLTK key phrase extraction in Power BI using Python scripts, you can follow these steps:

Load Your Survey Data into Power BI
    Import your survey data into Power BI. Ensure that the text data is accessible in your Power BI report.

Set Up Python Environment in Power BI
    Go to File -> Options and settings -> Options -> Python scripting.
    Enable Python scripting by providing the path to your Python executable file.

Write Python Script for NLTK Key Phrase Extraction
    Write a Python script that utilizes NLTK for key phrase extraction. Make sure your script includes the necessary NLTK libraries.
    Here is a general outline of how your script might look:

    import nltk
    from nltk import word_tokenize
    from nltk.util import ngrams

    def extract_keyphrases(text):
        # Tokenize the text
        tokens = word_tokenize(text)
        
        # Extract key phrases using NLTK ngrams
        key_phrases = []
        for i in range(1, 4):  # Extract n-grams up to trigrams
            key_phrases.extend([' '.join(ng) for ng in ngrams(tokens, i)])
        
        return key_phrases

    # Apply key phrase extraction function to each row of data
    df['KeyPhrases'] = df['TextColumn'].apply(extract_keyphrases)

Integrate Python Script into Power BI

In Power BI, go to Transform Data -> Run Python Script.
Paste your Python script into the script editor and modify it to fit your data source and requirements.

Visualize Key Phrases in Power BI

Once the Python script runs successfully, you will have a new column in your dataset containing the extracted key phrases.
You can then create visuals in Power BI to analyze and visualize these key phrases as needed.

DataMentor is good tool to help you in your solution.

I hope this helps.
Keith

1 Like

@EnanBahadur ,

You can check Gaellim’s training Advanced Python for Power BI in Data Cleaning and NLP

Available at Enteprise DNA platform

aftrer basic NLP and Clean Text and Word Frequency session with different NLTK options

at the end you can find Final Dashboard part so you can see how it can be combined with Power BI.

Enjoy the training.

Best regards

Thank you so much for the detailed answer and apologies for the late reply as i was not at work. I truly appreciate your time to reply to my post that gives me a starting point for my analysis.

Thank you for the update.
Yes i am currently doing this training.

1 Like

Hi,
can you please guide me the name of the course where python setup in power bi is done. I have done the NLP which states to do the python - part 1 but cant find it.

Appreciate your help.

Hi @EnanBahadur

All python courses are on the learning platform

all you need to do is search by typing in python in the

results of the python

Happy Learning.

Thanks
Keith

Hi Keith,
Thank you for your message. I did the same to find out the NLP training.
But in the same training it is mentioned to “Python for Power BI Users”
and i assume that will be teach and guide how to setup python in power bi.

I searched with the same training name but nothing is coming hence request the assistance.

Attached pic for reference.

Hi @EnanBahadur,

I might have found it its part of this course. They might have changed the name.
Data Wrangling & Visualization with Python for Power BI. They might have have discontinue/delete it too,

Never mind the Enterprise team replied :slight_smile:

You might want to send a message to Customer Support customersupport@enterprisedna.co .

thanks
Keith

Hi @EnanBahadur ,

The “Python for Power BI Users” course is an older offering. As alternatives, you may search for the following courses:

  • Python Beyond Excel
  • Excel to Python for Data Analysis
  • Navigating Financial Data with Python
  • Python for Marketing Analytics
  • Data Science Overview with Python
  • Data Wrangling & Visualization with Python for Power BI
  • Advanced Python for Power BI in Data Cleaning and NLP

Cheers,

Enterprise DNA Support Team

Hi @EnanBahadur ,

You can check also Data Wrangling & Visualization with Python for Power BI course

especially Three Ways to Use Python Scripting part :

Enyoy learnign.