Skip to content

Commit

Permalink
adjust column numbers of tables, #851
Browse files Browse the repository at this point in the history
  • Loading branch information
lisphilar committed Jul 27, 2021
1 parent 8b644f2 commit 23b9317
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions docs/markdown/LOADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ If we have records as CSV files (time series data of vairables), we can read the

As an example, we have records in "./japan.csv" as shown in the next table. (Data is from [COVID-19 Data Hub]((https://covid19datahub.io/).)

| | | confirmed | fatal | province | population | date |
| -- | -- | -- | -- | -- | -- |
| 0 | 966287 | 17979 | Illinois | 12671821 | 2021-01-01 |
| 1 | 977677 | 18217 | Illinois | 12671821 | 2021-01-02 |
| 2 | 982105 | 18322 | Illinois | 12671821 | 2021-01-03 |
| | confirmed | fatal | province | population | date |
| -- | -- | -- | -- | -- | -- |
| 0 | 966287 | 17979 | Illinois | 12671821 | 2021-01-01 |
| 1 | 977677 | 18217 | Illinois | 12671821 | 2021-01-02 |
| 2 | 982105 | 18322 | Illinois | 12671821 | 2021-01-03 |

We can read it with `DataLoader.read_csv()` method. Argument `parse_dates` (list of columns of dates) and `dayfirst` (whether date and month are formatted with DD/MM or not) are optional, but it is suggested to use them to read date information correctly. The read data is saved as a `pandas.DataFrame` and it can be checked with `DataLoader.local` property.

Expand Down Expand Up @@ -125,11 +125,11 @@ We can set variables using `DataLoader.assign()`. This use `pandas.DataFrame.ass

Let's say, we have the following dataset as `loader.local`. We want to assign country name (string "USA") and the number of vaccinations as the total value of vaccinated_once and vaccinated_full. (Note that the values of vaccinated_once and vaccinated_full are not actual values. They are just simplified example values.)

| | | confirmed | fatal | province | population | date | vaccinated_once | vaccinated_full |
| -- | -- | -- | -- | -- | -- | -- | -- |
| 0 | 966287 | 17979 | Illinois | 12671821 | 2021-01-01 | 1000 | 500 |
| 1 | 977677 | 18217 | Illinois | 12671821 | 2021-01-02 | 2000 | 700 |
| 2 | 982105 | 18322 | Illinois | 12671821 | 2021-01-03 | 3000 | 800 |
| | confirmed | fatal | province | population | date | vaccinated_once | vaccinated_full |
| -- | -- | -- | -- | -- | -- | -- | -- |
| 0 | 966287 | 17979 | Illinois | 12671821 | 2021-01-01 | 1000 | 500 |
| 1 | 977677 | 18217 | Illinois | 12671821 | 2021-01-02 | 2000 | 700 |
| 2 | 982105 | 18322 | Illinois | 12671821 | 2021-01-03 | 3000 | 800 |

We can assign them as follows.

Expand All @@ -140,11 +140,11 @@ print(loader.local)

Two columns will be added.

| | | confirmed | fatal | province | population | date | vaccinated_once | vaccinated_full | country | vaccinations |
| -- | -- | -- | -- | -- | -- | -- | -- | -- | -- |
| 0 | 966287 | 17979 | Illinois | 12671821 | 2021-01-01 | 1000 | 500 | USA | 1500 |
| 1 | 977677 | 18217 | Illinois | 12671821 | 2021-01-02 | 2000 | 700 | USA | 2700 |
| 2 | 982105 | 18322 | Illinois | 12671821 | 2021-01-03 | 3000 | 800 | USA | 3800 |
| | confirmed | fatal | province | population | date | vaccinated_once | vaccinated_full | country | vaccinations |
| -- | -- | -- | -- | -- | -- | -- | -- | -- | -- |
| 0 | 966287 | 17979 | Illinois | 12671821 | 2021-01-01 | 1000 | 500 | USA | 1500 |
| 1 | 977677 | 18217 | Illinois | 12671821 | 2021-01-02 | 2000 | 700 | USA | 2700 |
| 2 | 982105 | 18322 | Illinois | 12671821 | 2021-01-03 | 3000 | 800 | USA | 3800 |

## 3. Perform database lock

Expand Down

0 comments on commit 23b9317

Please sign in to comment.