splatoon\_league\_corr
======================

Correlation coefficient table is created from the data of league matches
in Nintendo's competitive game "Splatoon 2".

Description
-----------

The output from ikaWidget2 is a tscv file that calculates the
correlation coefficient table of Kill/Death etc. in a league, and
outputs it in Excel.

App Store : https://apps.apple.com/jp/app/ikawidget-2/id1271025591

Google Play :
https://play.google.com/store/apps/details?id=com.flapg.ikawidget2&hl=ja

Example of output (GUT area)

.. figure:: https://user-images.githubusercontent.com/62247164/95659914-5ae9c300-0b5f-11eb-8c16-6d0db9a90f2d.jpg
   :alt: 

Dependencies
------------

-  Python
-  pandas
-  DateTime
-  openpyxl

Install
-------

.. code:: sh

    pip install splatoon_league_corr

or

.. code:: sh

    pip install splatoon_league_corr-x.x.x.tar.gz

Usage
-----

***splatoon\_league\_corr*** provides the following classes and
functions.

class ika\_data
~~~~~~~~~~~~~~~

Class for storing player data.

Constructor

.. code:: python

    def __init__(self,pid,jpname,usname)

+---------+---------------------------------------------------------------+
| Member  | Description                                                   |
+=========+===============================================================+
| pid     | The player's PrincipalIDPrincipalID is internal data and      |
|         | cannot be confirmed in the game, but can be obtained from the |
|         | tcsv file and other documents generated by ikaWidget2.        |
+---------+---------------------------------------------------------------+
| jpname  | Name to be displayed in the correlation coefficient table     |
|         | output force                                                  |
+---------+---------------------------------------------------------------+
| usname  | The name displayed in the list of record data.                |
+---------+---------------------------------------------------------------+

Example

.. code:: python

    player = splatoon_league_corr.ika_data('824a58fc35365d11','まるや','maruya')

class team\_data
~~~~~~~~~~~~~~~~

A team class consisting of four ika\_data.

The constructor

.. code:: python

    def __init__(self,player,friend1,friend2,friend3)

+--------------+-----------------------------------------------+
| Member       | Description                                   |
+==============+===============================================+
| player       | Data of the person who output the tscv file   |
+--------------+-----------------------------------------------+
| friend1～3   | Friend data for the same team                 |
+--------------+-----------------------------------------------+

Example

.. code:: python

    myteam = splatoon_league_corr.team_data(player,friend1,friend2,friend3)

calc\_corr\_number\_of\_games(filename,save\_dir,myteam,n)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Outputs an Excel file (result.xlsx) of the correlation coefficient table
with the **number of games** as an argument.

+----------+--------------------------------------------------------+-----------+
| Argument | Description.                                           | Type      |
+==========+========================================================+===========+
| filename | The path of the tcsv file to enter                     | str       |
+----------+--------------------------------------------------------+-----------+
| save\_di | Directory name to store the output data (automatically | str       |
| r        | generated)                                             |           |
+----------+--------------------------------------------------------+-----------+
| myteam   | The team\_data class                                   | team\_dat |
|          |                                                        | a         |
+----------+--------------------------------------------------------+-----------+
| n        | The number of games for calculating the correlation    | int       |
|          | coefficient table                                      |           |
+----------+--------------------------------------------------------+-----------+

Example

.. code:: python

    splatoon_league_corr.calc_corr_number_of_games('ikaWidgetCSV_20201009231053.tcsv','output',myteam,50)

calc\_corr\_days(filename,save\_dir,myteam,datemin,datemax)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Outputs an Excel file (result.xlsx) of a correlation coefficient table
with **the period of a games** as an argument.

+---------------+---------------------------------------------------+----------+
| Argument      | Description.                                      | Type     |
+===============+===================================================+==========+
| filename      | The path of the tcsv file to enter                | str      |
+---------------+---------------------------------------------------+----------+
| save\_dir     | Directory name to store the output data           | str      |
|               | (automatically generated)                         |          |
+---------------+---------------------------------------------------+----------+
| myteam        | The team\_data class                              | team\_da |
|               |                                                   | ta       |
+---------------+---------------------------------------------------+----------+
| datemin,      | The period of the games (datemin to datemax)      | str      |
| datemax       | described in YYMMDD when calculating the          |          |
|               | correlation coefficient table.                    |          |
+---------------+---------------------------------------------------+----------+

Example

.. code:: python

    splatoon_league_corr.calc_corr_days('ikaWidgetCSV_20201009231053.tcsv','output_date',myteam,'20200901','20201030')

Note
----

Because of the difficulty in obtaining data from others' ikaWidget2,
debugging in various patterns was not performed.

Author
------

https://qiita.com/JmpM
