[PYTHON] [Celebration: Market capitalization $ 2 trillion] I tried to visualize Apple's patent

Apple2.png

0. In a word

(1) Apple's market capitalization has exceeded $ 2 trillion (2) I tried to visualize the patents of the world's number one company (3) I was able to reconfirm that I value the interface with the user by using software while being mainly hardware.

1. 1. Overall picture

What I did was the following 3 steps. (1) Preparation: Extract Apple patents with Google Patents (2) Work 1: Visualization with wordcloud (3) Work 2: Mask with the Apple logo and then match the colors

2. Preparation: Extract Apple patents with Google Patents

Apple's market capitalization has exceeded $ 2 trillion. Apple was the first to reach a market capitalization of $ 1 trillion, but this is 2018. Market capitalization has doubled in just three years. There is too much money and the investment destinations are limited. Moreover, when it comes to IT that can be expected to consume nests, the promising thing about Corona is that it is Apple. By the way, Warren Buffett, the world's number one investor, is listed as a major shareholder. As expected!

Now, in order to confirm what is amazing about Apple, I tried to visualize the situation of Apple's intellectual property rights (patents). First, download Apple's US patent application as csv data on Google Patents. In the upper left display of Google Patents, there should be about 20,000 data since 2010, but when downloaded to csv, it is about half, 9,000. I wasn't sure what the maximum number of cases was.

3. 3. Task 1: Visualize with wordcloud

First, load csv with a pandas data frame. When downloading to csv with Google Patents, the extraction condition is on the first line, in this case, https://patents.google.com/?assignee=Apple+Inc.&country=US&after=priority:20100101 Is entered, so set header = 1 when reading.

python


import pandas as pd
df=pd.read_csv("data.csv",header=1)
df.columns

This time, only the patent name (title) is used.

python


Title=df["title"]
Text=''
for i in Title:
    Text+=i

Now, wordcloud is finally here.

python


import wordcloud
word_cloud=wordcloud.WordCloud(background_color="white")
word_cloud.generate(Text)
import matplotlib.pyplot as plt
plt.figure(figsize=(16,10))
plt.imshow(word_cloud)
plt.axis("off")
plt.show()

Let's load the text of the patent name prepared earlier into wordcloud and draw it with matplotlib. Then, it becomes as follows.

wordcloud1.png

Use the word you want to remove as an argument as stopwords so that the same word does not appear twice.

python


stopwords={"method","using","portion","thereof","based","multiple","multi","and","of","in","for","with","to","or","providing","on","by","an"}

word_cloud=wordcloud.WordCloud(background_color="white",collocations=False,stopwords=stopwords)
word_cloud.generate(Text)
plt.figure(figsize=(16,10))
plt.imshow(word_cloud)
plt.axis("off")
plt.show()

wordcloud2.png

It was a little refreshing.

4. Task 2: Mask with the Apple logo and then match the colors

Let's mask it with the Apple logo that I personally like. Note that this uses numpy's array.

python


from PIL import Image
import numpy as np
mask_array = np.array(Image.open('Apple.jpg'))

word_cloud=wordcloud.WordCloud(mask=mask_array,background_color="white",collocations=False,stopwords=stopwords)
word_cloud.generate(Text)
plt.figure(figsize=(16,10))
plt.imshow(word_cloud)
plt.axis("off")
plt.show()

The results are as follows. It became like Apple (laughs)

Apple1.png

Since it's a big deal, let's make a wordcloud using the color scheme of the Apple logo that shines in rainbow colors.

python


from wordcloud import ImageColorGenerator
image_color = ImageColorGenerator(mask_array)

word_cloud=wordcloud.WordCloud(mask=mask_array,color_func=image_color,background_color="white",collocations=False,stopwords=stopwords)
word_cloud.generate(Text)
plt.figure(figsize=(16,10))
plt.imshow(word_cloud)
plt.axis("off")
plt.show()

At this time, note that the Wordcloud ImageColor Generator is required. The results are as listed at the beginning, but I will repost them. Apple is fashionable: apple:

Apple2.png

5. Summary

Apple is amazing. At one point I lost to Microsoft and thought that it would be a PC only for enthusiasts, but I changed the world with the iPhone. But recently, I'm really surprised that the market capitalization has doubled in just three years. It is a fabless company that does not have a factory by fusing hardware and software, and values the user interface, which matches the times.

Recommended Posts

[Celebration: Market capitalization $ 2 trillion] I tried to visualize Apple's patent
I tried to visualize AutoEncoder with TensorFlow
I implemented DCGAN and tried to generate apples
I tried to debug.
I tried to paste
I tried to visualize the spacha information of VTuber
[First data science ⑥] I tried to visualize the market price of restaurants in Tokyo
I tried to learn PredNet
I tried to implement PCANet
[Python] I tried to visualize tweets about Corona with WordCloud
[Python] I tried to visualize the follow relationship of Twitter
[TF] I tried to visualize the learning result using Tensorboard
I tried to introduce Pylint
I tried to summarize SparseMatrix
I tried to touch jupyter
I tried to implement StarGAN (1)
I tried to visualize bookmarks flying to Slack with Doc2Vec and PCA
I tried to visualize the Beverage Preference Dataset by tensor decomposition.
I tried to visualize the common condition of VTuber channel viewers
I tried to implement Deep VQE
I tried to create Quip API
I tried to touch Python (installation)
I tried to implement adversarial validation
I tried Watson Speech to Text
I tried to touch Tesla's API
I tried to implement hierarchical clustering
I tried to organize about MCMC.
I tried to implement Realness GAN
I tried to move the ball
I tried to estimate the interval.
[Python] I tried to visualize the night on the Galactic Railroad with WordCloud!
I tried to visualize the age group and rate distribution of Atcoder
I tried to visualize Google's general object recognition NN, Inception-v3 with Tensorboard
I tried to visualize the text of the novel "Weathering with You" with WordCloud
I tried to visualize the model with the low-code machine learning library "PyCaret"
I tried to visualize all decision trees of random forest with SVG
I tried to create a linebot (implementation)
I tried to implement Autoencoder with TensorFlow
I tried to summarize the umask command
I tried to implement permutation in Python
I tried to create a linebot (preparation)
I tried to recognize the wake word
I tried to get started with Hy
I tried to implement PLSA in Python 2
Python3 standard input I tried to summarize
I tried to classify text using TensorFlow
I tried to summarize the graphical modeling.
I tried adding post-increment to CPython Implementation
I tried to implement ADALINE in Python
I tried to let optuna solve Sudoku
I tried to estimate the pi stochastically
I tried to touch the COTOHA API
I tried to implement CVAE with PyTorch
I tried to make a Web API
I tried to solve TSP with QAOA
[Python] I tried to calculate TF-IDF steadily
I tried to touch Python (basic syntax)
I tried my best to return to Lasso
I tried to summarize Ansible modules-Linux edition
I tried to predict Covid-19 using Darts
[Patent analysis] I tried to make a patent map with Python without spending money