Shiny for Python

R Shiny is Now Available in Python

By Adam Bozman in Theme Features R package

August 15, 2022

Twitter Sentimant Analyzer


Building a Web Framework

As a finance PhD, I’m often irrationally irritated by my restriction in publishable coding languages. In my experience, SAS and Python are the most commonly accepted for any sort of statistical or technical analysis in the field. While I’ve done my best to adopt SAS, it still feels like nothing more than a remnant of generations past – something that while not quite as clunky as SPSS, still offers little adaptability and customization. I do understand the need for reproducibility, which is why I believe that any journal calculations should be done in an open-source, object-oriented language – something available to the masses.

While I’ve been restricted to Python (and some SAS) for most of my academic work, I regularly dabble in other scripting languages that have more breadth and personalization to them. For example, this website is built using primarily R and Hugo. For this reason, I was very excited to see earlier this month the introduction of Shiny for Python, an adaptation to Shiny in R.

Shiny for Python | Twitter Sentiment

Shiny was one of the first low-code web frameworks for either R or Python, and Python still (in my opinion) doesn’t have the great UI of something like Shiny or Dash in R. This makes it challenging to share projects, collaborate with peers, or demonstrate coding applications to students.

This “Twitter Sentiment Analyzer” project is an initial application of Shiny in Python – something only available for the last few weeks. This app uses snscrape to combine tweets in real time and calculate the sentiment surrounding keywords using NLP and Sklearn. While this is a relatively simple example, it does have applications in my future research. It also utilizes snscrape (a library currently exclusive to python) and Shiny (formerly exclusive to R). Keep in mind, Shiny for Python is currently in Alpha, and changes to their APIs will likely occur. If this application has any issues when you try to access it, I am likely just lazy in updating APIs – all the codes should still be reproducible though.

RStudio Rebranded

This endeavor by RStudio seems to be the next step in their coming October rebrand. RStudio will be rebranded as Posit, an extension of their current IDE to what they call “A Single Home for R & Python”. This rebrand is part of a broader expansion that appears to be happening. Recently, RStudio announced Quarto, a “scientific and technical publishing system” very similar to RMarkdown. They’re also extending the platform to Julia and other languages as they transform from the default home for R to a completer and more purposeful IDE for statisticians and developers.

I do have additional thoughts on the blend of RStudio and Python here. For me, and I imagine for anyone frequently working with data, this is a very interesting time.

Posted on:
August 15, 2022
Length:
3 minute read, 474 words
Categories:
Theme Features R package
Tags:
hugo-site
See Also:
Financial Modeling
Discounted Cash Flows
Getting Started with Python and WRDS