I have 500 CSV files in this format:
IndicatorA_Name.csv
1900 1901 1902 ...
Norway 3 2
Sweden 1 3 3
Denmark 5 2 3
...
IndicatorB_Name.csv
1900 1901 1902 ...
Norway 1 3 4
Sweden 1 2
Iceland 1 6 3
...
- Years in columns, countries in rows.
- Notice that countries, years and values may differ between files.
I’d like to run through all these files and make a flat table (CSV file) with this structure:
country, year, IndicatorA_Name, IndicatorB_Name, ... Sweden, 1900, 1, 1 Sweden, 1901, 3, 2 Norway, 1900, 3, 1 ...
Preferably in PHP or JavaScript but I’m willing to learn something new.
You should probably code something like following code: