ChatGPT (GPT-4) Advanced Data Analysis (formerly Code Interpreter), how to output graphs, images, and PDF files with Japanese fonts to analyze X (formerly Twitter)
Introduction
Last weekend, original article published on Jul 2023, there was an announcement from OpenAI, and a ChatGPT (GPT-4) function called Code Interpreter was released. It is a convenient service programmed in Python that allows you to analyze data without code just by giving instructions in Japanese or English.
Japanese text cannot be displayed when drawing graphs or doing other tasks, but I have found a way to display Any fonts, and I will explain it in this article.
Code Interpreter had its name changed to Advanced Data Analysis on August 29, but it is called Code Interpreter in this article
In this article, you can replace Japanese font with any fonts which you prefer to use on ChatGPT.
What You Can Learn from This Article
- The steps to outputting graphs, images, and PDF files with Japanese fonts using Advanced Data Analysis (formerly Code Interpreter)
- How to analyze X (formerly Twitter) log analytics with Advanced Data Analysis (formerly Code Interpreter)
If you don't need an introduction and just want to know how to output graphs, images, and PDFs with Japanese fonts in Code Interpreter, click here.
Self-Introduction
Though it's a belated introduction, I am Aoi Nakanishi, the lead engineer of KINTO FACTORY. In addition to development, which is my main job, I manage events, the Tech Blog, and the official account from X (formerly Twitter), so I also manage Technical Public Relation activities in our company.
Prerequisites
- To have paid for ChatGPT (ChatGPT Plus)
- To have Code Interpreter enabled
Only the above two are required
Enabling Code Interpreter
Enable Code Interpreter from Settings -> Beta Features -> Code Interpreter
as shown in the image below.
You can skip this step. Advanced Data Analysis is already regular feature on GTP-4
Steps to Switching to Japanese
We know that Code Interpreter does not draw in Japanese automatically without instructions, so let's explore ChatGPT and what it can do.
Draw this in Japanese!
First of all, I tried instructing "Draw this in Japanese" but it returned that Japanese fonts cannot be embedded in the current environment.
Try to Find Out Why It Cannot Draw Japanese Font
Notice that it says, in Japanese, “in the current environment
.” Let's ask how the graph image is generated.
Ask How to Draw Japanese Font
Since we know that it uses Python and Matplotlib, I will ask it how to display Japanese.
As an example, here is the code that came out.
It said that I could not download fonts or change my system settings because my Internet access was disabled. I can upload files, but it seems that I cannot download them. I did a separate check, and it seems that I cannot use system functions.
Uploading Japanese Font Files
It says, "Cannot download
", so I will immediately ask if I can upload, instead.
It is possible to upload files, so I will try it right away.
Downloading Japanese Fonts
The font Noto Sans was written in the sample code that ChatGPT taught me, so I will use Noto Sans.
Download fonts from:
(There are other usable fonts, although I haven't tested them)Uploading Japanese Fonts and Switching matplotlib to Japanese
Let's try generating a graph in Japanese, or any language's fonts.
Uploading Japanese(any) Fonts
Upload a file by clicking the plus button at the bottom of the screen. In addition, instruct it to use the Japanese font that was uploaded when drawing graphs by telling it, "Please use this Japanese font when drawing graphs
."
↓ ↓ ↓
Summary of How to Use Japanese Fonts in ChatGPT (GPT-4)'s Code Interpreter
You can now display graphs in Japanese by following the steps below.
- Download Japanese(any) fonts locally
- Upload the fonts to ChatGPT
- Specify a font to use when drawing graphs in ChatGPT
- Upload the required data and draw a graph
Also, if the title is not in Japanese when the graph is drawn, you can say;
Switch the title to Japanese,
and see that the title are regenerated in Japanese. Remember to instruct ChatGPT to draw in Japanese using the uploaded Japanese font file. You can use these steps for PDFs and other file types to output files that can display Japanese correctly.
Analyzing Logs from X (formerly Twitter)
Now that you are ready to output results of analyses in Japanese, let’s start analyzing logs from X right away.
We will analyze data for this X account. You can download detailed data from X Analytics and perform various analyses, but today we will do conduct them using publicly available data. We will use the following information:
- Main body of the tweet
- Date and time of the tweet
- Number of retweets
- Number of replies
- Number of likes
This data is publicly available and can be accessed by anyone, not just the owner of the account.
Uploading a CSV File
Select a file by clicking on the Upload button just like when uploading a font, and upload the data you want to analyze. I uploaded a CSV file this time, but it seems that it is possible to read basically any data that can be handled by Python. Also, when I checked the maximum file size that can be uploaded, it did not give the exact number, but it said that several hundred MB were acceptable.
I upload the file to ChatGPT and ask it to analyze the file. After answering some questions from ChatGPT, it gave the following analysis results. The following are the results, including explanations of the analyses of the number of impressions, number of retweets, number of likes, and main body.
Analysis of Impressions
ChatGPT: There is no clear trend at any particular time of day or day of the week. However, it seems that the number of impressions is slightly higher at a particular time on Tuesdays than at other times.
KINTO Technologies often posts articles on Tuesdays and makes a tweet when they are published. That seems to be the reason for this result.
Analysis of the Number of Retweets
ChatGPT: Again, there is no clear trend at any particular time of day or day of the week. However, it seems that the number of retweets is slightly higher at a particular time on Tuesdays than at other times.
It seems that the number of retweets is proportional to the number of impressions.
Analyzing the Number of Likes
ChatGPT: There is no clear trend at any particular time of day or day of the week regarding the number of likes, as well. However, it seems that the number of likes is slightly higher at a particular time on Tuesdays than at other times.
You can see that impressions, retweets, and likes are correlated.
ChatGPT: Since the number of Tweets in this analysis is relatively small, it is recommended that you keep these results for reference only.
This is stated because there are parts that are difficult to understand even if you look at the heat map in the results of the analysis, and it seems that it is necessary to increase the number of tweets and followers first.
Analyzing the Main Body of the Tweet
Here are the results of a topic modeling analysis of the top ten tweets with the most impressions made with ChatGPT. You can see that our desired information is in the results of the analysis.
Item | Description |
---|---|
Visual element that attracts attention | Attracts users' attention and increases engagement |
Use of hashtags | Makes tweets easier to find |
Clear explanation of the subject of the article | Explains the subject of the article clearly |
Specific call to action | Includes the specific call to action, "If you are having trouble building and managing your development environment, please take a look!" |
Advance notice of upcoming articles | Garners interest from users and increases engagement by notifying them when a new article is published |
Emphasize a specific theme | Emphasizing themes will attract users who are interested in an event or the company's activities |
Summary of the Results of the Tweet Analysis
From the analysis thus far, we found that the time posted, content, and use of URLs are key factors in optimizing Tweets.
Item | Description |
---|---|
Post time optimization | Although it is not obvious, engagement tends to be higher on Thursday and Friday nights. It is possible that users have more free time and search for content more when it is close to the weekend |
Tweet content optimization | A Tweet that is related to an event or the topic of a new article has a high level of engagement |
Tweets that contain a URL | Tweets with a URL to the Tech Blog have a high level of engagement |
Summary
In this article, I explained how to analyze data with ChatGPT's Code Interpreter and create graphs and other files in Japanese. I hope that it will be useful to you in your daily analyses.
We will continue to publish useful articles. If you are interested in reading the latest news, please follow us here.
KINTO Technologies is looking for talent to contribute in shaping the future of mobility together. If you are interested, please feel free to contact us for a casual interview.
関連記事 | Related Posts
ChatGPT(GPT-4)のAdvanced Data Analysis(旧Code Interpreter)、日本語フォントでグラフや画像、PDFファイルを出力する方法とTwitterの分析
言葉で語れば現れるデータの世界 - Amazon QuickSight Generative BIの魔法
ChatGPTにSlackカスタム絵文字を作ってもらった
「GitLabに学ぶ 世界最先端のリモート組織のつくりかた」輪読会が最高だったのでシェアしたい
Box SDKを使って勤怠予定のSlack報告を自動化してみました
Wow! I Spontaneously created a Company Anthem Using AI
We are hiring!
【データサイエンティスト(リーダークラス)】分析G/東京・名古屋
分析グループについてKINTOにおいて開発系部門発足時から設置されているチームであり、それほど経営としても注力しているポジションです。決まっていること、分かっていることの方が少ないぐらいですので、常に「なぜ」を考えながら、未知を楽しめるメンバーが集まっております。
【データエンジニア】分析G/名古屋・大阪
分析グループについてKINTOにおいて開発系部門発足時から設置されているチームであり、それほど経営としても注力しているポジションです。決まっていること、分かっていることの方が少ないぐらいですので、常に「なぜ」を考えながら、未知を楽しめるメンバーが集まっております。