Unstructured information is in all places, and should you’re a knowledge scientist, analyst, or engineer, you’ve possible handled textual content information you need to classify by sentiment. Frequent sources of such information embrace product critiques, emails, name transcripts, or CRM notes. Making sense of those will be robust, however typically you simply want the general tone: good, dangerous, completely satisfied, annoyed. Figuring out sentiments permits you to filter data shortly or spot general traits.
On this information, we’ll discover product evaluation information and use Massive Language Fashions (LLMs) for sentiment evaluation. We will then share outcomes by an interactive app or automated workflow.
Studying Aims
The purpose of this information is to learn to use a mixture of LLMs and Python to categorize a set of plain English critiques inside a structured information set. We’ll not solely categorize the critiques, however we may even analyze the emotions to grasp the general sentiment by product class. We may even be taught to share our findings as an interactive information app and automatic sync to Google Sheets.
Exploring Your Knowledge With SQL, Python, and AI
On this workflow, we’ll begin by gathering and getting ready the info, then run exploratory information evaluation (EDA) earlier than performing sentiment evaluation. We’ll use Fabi.ai, an AI-native BI platform with a built-in AI information analyst.
Making ready Your Knowledge
Step one in any evaluation is gathering and getting ready your information. We’ll use textual content information in a structured desk. With Fabi, you possibly can hook up with many sources: warehouses, recordsdata, or Google Sheets. For this information, we’ll pull from a public Google Sheet, however you should utilize any supply.
Begin by including a Google Sheets cell in a brand new Smartbook (an AI-native Python pocket book).

When you’ve licensed Fabi to entry your Google Drive, seek for the file containing your information. On this case, we’re utilizing a publicly accessible dataset, so we’re going to make use of the Google Sheet Pull (Public URL) cell, which doesn’t require authentication.
Copy/paste the sheet URL within the cell and provides your output Python DataFrame a reputation (eg. “product_review_data”). After working that cell, the info can be saved in Fabi as a Python DataFrame, which now you can use AI to research.

Preliminary Exploratory Knowledge Evaluation and Knowledge Cleansing
Earlier than beginning sentiment evaluation, we have to verify that the info is clear. I requested the AI: “What are some potential points with the info?” and it flagged two straight away:
- Inconsistent state codecs (“NY” vs. “New York”)
- Inconsistent class names (“Hat” vs. “Hats”)
These sorts of issues are widespread in real-world information. AI makes it simple to shortly floor such points earlier than shifting on with evaluation.

Not solely can AI assist spot potential points, however it could actually additionally assist deal with them. Let’s ask the AI to repair these points for us: “Please clear up the info primarily based on these findings.”

The AI will generate both SQL or Python code to deal with any points recognized. In case you’re working the Fabi AI Analyst Agent in guide mode (versus auto-accept mode), you’ll be prompted to simply accept or reject the AI recommendations.
On this case, let’s settle for the AI recommendations, which is able to add the suitable Python cell to your Smartbook.

We now have a brand new Python DataFrame known as “cleaned_data”.
At this stage, it’s additionally good to manually examine the info and ensure the AI didn’t miss every other potential points. And if the AI did miss any points, you possibly can ask it to replace the cleansing script to account for these.
Sentiment Evaluation
With cleaned product evaluation information, we will begin sentiment evaluation by including a “review_sentiment” discipline to categorise every evaluation as constructive, unfavorable, or impartial. Massive language fashions with Python are perfect for this.
Add an AI enrichment cell beneath your cleansing step. These cells take a DataFrame, a discipline, and a immediate, then return the DataFrame with a brand new column primarily based on the immediate.
Right here, use “cleaned_data” with the “evaluation” discipline, outputting “cleaned_data_categorized” with “review_sentiment.” Immediate: Categorize the product evaluation as constructive, unfavorable, or impartial. Change from Preview to Run and execute.

After working this AI enrichment cell, you’ll have your new DataFrame that has a brand new discipline that comprises the sentiment class for every evaluation. That is now conveniently formatted in such a approach you could analyze the info in a extra structured approach. Let’s ask the AI to plot the % of critiques in every class as a 100% bar chart.

We instantly discover a number of issues:
- Denims and swimwear have essentially the most unfavorable critiques as a proportion of all critiques
- Sneakers have essentially the most constructive critiques as a proportion of all critiques
As a marketer or product proprietor, geared up with this info, I can now dig into our jean and swimwear strains to grasp the place the dissatisfaction comes from and discuss to the gross sales and advertising and marketing staff to determine the way to capitalize on the constructive critiques for footwear or double down on that product line.
Sharing Your Work
Your information evaluation is barely pretty much as good as your skill to share your findings together with your coworkers. It’s now time to show your work into a knowledge app or spreadsheet you could share. We’ll present you the way to take each approaches.
Turning Your Fabi Pocket book Right into a Knowledge App
If you wish to share your evaluation as an interactive information app, merely click on the “Publish” button within the prime right-hand nook (on this information, we gained’t contact on the way to add inputs or filters to your information app, however you possibly can simply do that in just some minutes). On this staging space, you possibly can conceal, transfer, and resize tables and charts.

As soon as your information app appears the best way you need it to, you possibly can schedule it to refresh at any cadence you need. Lastly, when you’re prepared for it to go dwell, click on “End & View Report”. From right here, you can provide entry to this report back to any coworker or your whole group utilizing the “Share” performance.
Syncing Your Evaluation With Google Sheets
In case you would somewhat sync this enriched information to a different vacation spot that your stakeholders wish to work out of, corresponding to Google Sheets, you possibly can add an output cell. On the backside of your Smartbook, add a “Google Sheets Push” cell and choose the “cleaned_data_categorized” DataFrame and the Google sheet you need to sync the info to.

Key Takeaways
- Knowledge sources: Analyze information from a warehouse, database, Google Sheet, or native CSV/Excel file.
- AI for EDA and cleansing: Ask Fabi’s AI Analyst Agent to identify points and clear your information.
- Sentiment evaluation: Use AI enrichment cells to categorize freeform textual content in a DataFrame.
- Python information apps: Publish findings as interactive dashboards to share with coworkers.
- Automating syncs: Push processed evaluation information again to Google Sheets for collaboration.
Conclusion
On this information, we explored an environment friendly solution to carry out sentiment evaluation utilizing AI and Python within the AI-native information evaluation platform Fabi.ai. You noticed how simple it’s to drag product evaluation information from Google Sheets, discover and clear it with AI-generated Python code through Fabi’s AI Analyst Agent, run sentiment evaluation with an LLM, and share outcomes as an interactive Python app or Google Sheet.
Login to proceed studying and revel in expert-curated content material.