How to Generate OpenAI GPT Output in JSON Format Using Python for Legal Text Analysis

Generating consistent JSON output is now possible thanks to function calling feature in OpenAI’s gpt-4-0613 andĀ gpt-3.5-turbo-0613 models. Function calling introduces a systematic approach to generating structured data. This capability allows for the precise definition of functions within the models, which then produce outputs in JSON format, as opposed to unstructured text. This development addresses the […]
If using all scalar values you must pass an index

The Problem: When you try to create a pandas dataframe using only scalar values without passing an index, you will get a ValueError: If using all scalar values, you must pass an index. In this article, I will provide an explanation of the problem and three easy and different solutions. First, let’s understand the root […]
š How to Combine Pandas Dataframe Columns Easily

In Python based data analysis projects, it is quite common to combine dataframe columns. Actually, it is super easy to to this. In this blog post, I am going to show you how to combine pandas dataframe columns easily. There are more than one ways to combine multiple pandas dataframe columns. Luckily, the easiest method […]
[Step-by-Step] How to Install TaLib Library on Linux?

TaLib is a high quality technical analysis library, originally written in C language. Thanks to its developers, there is a Python wrapper which allows us to use in Python, too. However, installing it is a bit tricky and requires more steps than simply installing it with pip. In this post, I am going to show […]
How to Fix “TypeError: can’t use a string pattern on a bytes-like object in re.findall()” Error

In this article I am going to show you how to fix “TypeError: can’t use a string pattern on a bytes-like object in re.findall()” error. In my case, this error was caused by the following line of code: This code firstly encodes the string into bytes and subsequently tries to apply regular expression to it. […]
Python How To Remove Everything Except Letters & Numbers

Letters and numbers are technically called alphanumeric characters. In this article, I am going to show you how to remove everything except letters and numbers from a string in Python. So you will keep only alphanumeric characters (letters and numbers) and delete everything else. For this, we will use Python regular expression module. It is […]
bs4.FeatureNotFound: Couldn’t find a tree builder with the features you requested: lxml. Do you need to install a parser library?

OK, you have got the bs4.FeatureNotFound: Couldn’t find a tree builder with the features you requested: lxml. Do you need to install a parser library? error when trying to scrape a website. BeautifulSoup supports the HTML parser by default. If you want to use any other third-party Python parsers you need to install that external […]
[6 Lines Of Code] How To Connect Oracle Database In Python

Oracle is generous to give everyone a full cloud database for free. I am frequently using this database because Oracle SQL is really a powerful tool for data analysis. Currently, I create many CSV files, from webscraping, financial data from APIs, etc.. So, a connection between Python and Oracle database is an absolute requirement for […]
[SOLVED!] How to convertĀ frame.append() toĀ pandas.concat()?

I was using frame.append method to add rows to a dataframe, yet it is deprecated and going to be removed from pandas. So, in this article, I will tell you how to convert DataFrame.append() to pandas.concat(). It’s easy. This is my original code with append method. With this code, I was appending a dataframe to b dataframe. […]
How to Get Rid of the “e Notation” in Pandas Dataframe?

I’m now going to show you how to get rid of this “e letter” or “e notation” in your pandas dataframe, with using one line of code. So easy. Just add one line of code: All sorted.