---
title: "Discussion on \"Sentiment analysis on streaming Twitter data using Kafka, Spark Structured Streaming & Python (Part 2)\" | Hashnode"
description: "Discussion on \"Sentiment analysis on streaming Twitter data using Kafka, Spark Structured Streaming & Python (Part 2)\". A friend told me one day that, a problem we face at x time is an assembly of small problems not resolved previously and that we aren't aware of.\nI decided weeks ago to learn how to do sentiment analysis on streaming Twitter Data, but to do the entire..."
url: "https://hashnode.com/posts/sentiment-analysis-on-streaming-twitter-data-using-kafka-spark-structured-streaming-and-python-part-2/622f77a7df08b9b82341b93e"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Sentiment analysis on streaming Twitter data using Kafka, Spark Structured Streaming & Python (Part 2)](https://lorenagongang.com/sentiment-analysis-on-streaming-twitter-data-using-kafka-spark-structured-streaming-and-python-part-2?utm_source=hashnode&utm_medium=feed)

A friend told me one day that, a problem we face at x time is an assembly of small problems not resolved previously and that we aren't aware of. I decided weeks ago to learn how to do sentiment analysis on streaming Twitter Data, but to do the entire...

Mar 14, 2022 · 6 min read · lorenagongang.com  
Updated Apr 17, 2022  
Read the article

-   [#spark](https://hashnode.com/tag/spark)
-   [#mongodb](https://hashnode.com/tag/mongodb)

## Written by

[Lorena Gongang](https://hashnode.com/@lorenagongang)

@lorenagongang · Cannes, France

  
[View profile](https://hashnode.com/@lorenagongang)

Data enthusiast | Junior Data Engineer | Learning and sharing | Building my online presence.

Junior Data Engineer

## Responses 4

Markdown supported · ⌘↵ to post

[siddhartha M](https://hashnode.com/@siddharthamutyala)

[Jan 7, 2023](https://hashnode.com/posts/sentiment-analysis-on-streaming-twitter-data-using-kafka-spark-structured-streaming-and-python-part-2/622f77a7df08b9b82341b93e/comment/63b9c09095025da0eecdef44)

Hello Lorena,

There is a change in twitter API recently ,it is upgraded to new version V2 . Because of that i was unable to run producer.py. where we have to change the code accordingly. I was unable to change please help me with this. you can mail me at sarissa789@gmail.com

[Minh Nguyen](https://hashnode.com/@benminh1201)

[Apr 29, 2022](https://hashnode.com/posts/sentiment-analysis-on-streaming-twitter-data-using-kafka-spark-structured-streaming-and-python-part-2/622f77a7df08b9b82341b93e/comment/626ba0876072cdb96d1493ba)

Hello Lorena, how can I change your code in pyspark to get full\_text from Twitter? Thank you.

[Minh Nguyen](https://hashnode.com/@benminh1201)

[Apr 17, 2022](https://hashnode.com/posts/sentiment-analysis-on-streaming-twitter-data-using-kafka-spark-structured-streaming-and-python-part-2/622f77a7df08b9b82341b93e/comment/625c14c52f84e0d4fc33e7fa)

Hello, I have a problem "TypeError: write\_row\_in\_mongo() takes 1 positional argument but 2 were given" when I run your code

[Lorena Gongang](https://hashnode.com/@lorenagongang)

[Apr 17, 2022](https://hashnode.com/posts/sentiment-analysis-on-streaming-twitter-data-using-kafka-spark-structured-streaming-and-python-part-2/622f77a7df08b9b82341b93e/comment/625c14c52f84e0d4fc33e7fa#reply-625c1a892f84e0d4fc33e8b0)

Hello [Minh Nguyen](https://hashnode.com/@benminh1201), I know where the problem came from : Just modify write\_row\_in\_mongo and add another parameter, epoch\_id. I just changed the article, and you won't get the error after it.

[Miki Szeles](https://hashnode.com/@mszeles)

[Mar 16, 2022](https://hashnode.com/posts/sentiment-analysis-on-streaming-twitter-data-using-kafka-spark-structured-streaming-and-python-part-2/622f77a7df08b9b82341b93e/comment/62318d14febabbf75388e990)

OMG Lorena. This article is pure awesomeness.

I read about sentiment analysis not so long ago and I was sure I will try some tools after I will have a bigger digital footprint, but I have not considered implementing my own solution. Up till now. 😊

[Lorena Gongang](https://hashnode.com/@lorenagongang)

[Apr 13, 2022](https://hashnode.com/posts/sentiment-analysis-on-streaming-twitter-data-using-kafka-spark-structured-streaming-and-python-part-2/622f77a7df08b9b82341b93e/comment/62318d14febabbf75388e990#reply-62572104e58c4ac41a675a8d)

Thank you [Miki Szeles](https://hashnode.com/@mszeles)
