Datasets:
Update README.md
Browse files
README.md
CHANGED
|
@@ -47,11 +47,12 @@ It is as easy as:
|
|
| 47 |
from datasets import load_dataset
|
| 48 |
import polars as pl
|
| 49 |
|
| 50 |
-
# This line will download 6.6GB+ of RFSD data and store it in a cache folder
|
| 51 |
RFSD = load_dataset('irlspbru/RFSD')
|
| 52 |
|
| 53 |
-
# Alternatively,
|
| 54 |
-
|
|
|
|
| 55 |
```
|
| 56 |
|
| 57 |
We provide a file in `aux/descriptive_names_dict.csv` in [GitHub repository](https://github.com/irlcode/RFSD) which can be used to change the original names of financial variables to user-friendly ones, e.g. `B_revenue` and `CFo_materials` in lieu of `line_2110` and `line_4121`, respectively. Prefixes are for disambiguation purposes: `B_` stands for balance sheet variables, `PL_` — profit and loss statement, `CFi_` and `CFo` — cash inflows and cash outflows, etc. (One can find all the variable definitions in the supplementary materials table in the accompanying paper and [consult](https://www.consultant.ru/document/cons_doc_LAW_32453/) the original statement forms used by firms: full is `KND 0710099`, simplified — `KND 0710096`.)
|
|
@@ -62,21 +63,6 @@ renaming_df = pl.read_csv('https://raw.githubusercontent.com/irlcode/RFSD/main/a
|
|
| 62 |
RFSD = RFSD.rename({item[0]: item[1] for item in zip(renaming_df['original'], renaming_df['descriptive'])})
|
| 63 |
```
|
| 64 |
|
| 65 |
-
You can also query the dataset in a streaming fashion to download and import only a subset of rows or columns into memory:
|
| 66 |
-
``` Python
|
| 67 |
-
from datasets import load_dataset
|
| 68 |
-
import polars as pl
|
| 69 |
-
|
| 70 |
-
# Load dataset in streaming mode
|
| 71 |
-
RFSD_stream = load_dataset("irlspbru/RFSD", streaming = True)
|
| 72 |
-
|
| 73 |
-
# Load only 2019 data into memory
|
| 74 |
-
RFSD_2019 = pl.DataFrame([row for row in RFSD_stream if row['year'] == 2019])
|
| 75 |
-
|
| 76 |
-
# Load only revenue for firms in 2019, identified by taxpayer id
|
| 77 |
-
RFSD_2019_revenue = pl.DataFrame([row for row in RFSD_stream.select_columns(['inn', 'line_2110']) if row['year'] == 2019])
|
| 78 |
-
```
|
| 79 |
-
|
| 80 |
Please note that the data is not shuffled within year, meaning that streaming first __n__ rows will not yield a random sample.
|
| 81 |
|
| 82 |
### R
|
|
|
|
| 47 |
from datasets import load_dataset
|
| 48 |
import polars as pl
|
| 49 |
|
| 50 |
+
# This line will download 6.6GB+ of all RFSD data and store it in a 🤗 cache folder
|
| 51 |
RFSD = load_dataset('irlspbru/RFSD')
|
| 52 |
|
| 53 |
+
# Alternatively, this will download ~540MB with all financial statements for 2023
|
| 54 |
+
# to a Polars DataFrame (requires about 8GB or RAM)
|
| 55 |
+
RFSD_2023 = pl.read_parquet('hf://datasets/irlspbru/RFSD/RFSD/year=2023/*.parquet')
|
| 56 |
```
|
| 57 |
|
| 58 |
We provide a file in `aux/descriptive_names_dict.csv` in [GitHub repository](https://github.com/irlcode/RFSD) which can be used to change the original names of financial variables to user-friendly ones, e.g. `B_revenue` and `CFo_materials` in lieu of `line_2110` and `line_4121`, respectively. Prefixes are for disambiguation purposes: `B_` stands for balance sheet variables, `PL_` — profit and loss statement, `CFi_` and `CFo` — cash inflows and cash outflows, etc. (One can find all the variable definitions in the supplementary materials table in the accompanying paper and [consult](https://www.consultant.ru/document/cons_doc_LAW_32453/) the original statement forms used by firms: full is `KND 0710099`, simplified — `KND 0710096`.)
|
|
|
|
| 63 |
RFSD = RFSD.rename({item[0]: item[1] for item in zip(renaming_df['original'], renaming_df['descriptive'])})
|
| 64 |
```
|
| 65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
Please note that the data is not shuffled within year, meaning that streaming first __n__ rows will not yield a random sample.
|
| 67 |
|
| 68 |
### R
|