diff options
author | CoprDistGit <infra@openeuler.org> | 2023-05-29 10:23:15 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-05-29 10:23:15 +0000 |
commit | e513c999c06efb1b809fa26bd40f5594d76da15e (patch) | |
tree | e4ce7c9a1738cb3386db2dda20ba965d5183319f | |
parent | 29c029c2d7c3c5563b0cc2d95391de3ae92d4e67 (diff) |
automatic import of python-iops
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-iops.spec | 282 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 284 insertions, 0 deletions
@@ -0,0 +1 @@ +/iops-0.5.1.tar.gz diff --git a/python-iops.spec b/python-iops.spec new file mode 100644 index 0000000..8a372dc --- /dev/null +++ b/python-iops.spec @@ -0,0 +1,282 @@ +%global _empty_manifest_terminate_build 0 +Name: python-iops +Version: 0.5.1 +Release: 1 +Summary: Open-source Python release of the IO-PS package +License: MIT License +URL: https://github.com/WoutersResearchGroup/py-IO-PS +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/3b/07/05bbfac58aa25ef5e35c281cef8fb0bd3689a8f6abeff19bd2e682b93b49/iops-0.5.1.tar.gz +BuildArch: noarch + + +%description +# py-IO-PS +Public repository of developmental Python code related to research on the input-output product space (IO-PS) +[Described in Bam, W., & De Bruyne, K. (2019). Improving Industrial Policy Intervention: The Case of Steel in South Africa. The Journal of Development Studies, 55(11), 2460–2475. https://doi.org/10.1080/00220388.2018.1528354] + +## Package + +### Installation +The package is available from the Python Package Index: https://pypi.org/project/iops/ + +```text +pip install iops +pip install ecomplexity +``` + +### Usage +CEPII-BACI trade data is a required input (.csv). The BACI data is available at: http://www.cepii.fr/CEPII/fr/bdd_modele/presentation.asp?id=37 + +Full IO-PS analysis requires a value chain input (.csv). Three columns are required: 'Tier', 'Category' and 'HS Trade Code'. + +```python +import pandas as pd +from iops import main + +tradedata_df = pd.read_csv('BACI_HSXX_YXXXX_V202001.csv') +valuechain_df = pd.read_csv('X_Value_Chain.csv') + +main.iops(tradedata_df,valuechain_df) +``` + +### Value Chain Output +Results are generated at tier, category and product level. Results are written to an Excel spreadsheet and headless CSV for each. +```text +Tier_Results.csv +Tier_Results.xlsx +Product_Category_Results.csv +Product_Category_Results.xlsx +Product_Results.csv +Product_Results.xlsx +``` + +### Function +```Python +def iops(tradedata, valuechain=None, countrycode=710, tradedigit=6, statanorm=False): + """ IO-PS calculation function that writes the results to .xls and .csv + Arguments: + tradedata: pandas dataframe containing raw CEPII-BACI trade data. + valuechain: .csv of the value chain the IO-PS will map. + columns - 'Tier', 'Category', 'HS Trade Code' + default - None + countrycode: integer indicating which country the IO-PS will map. + default - 710 + tradedigit: Integer of 6 or 4 to indicate the raw trade digit summation level. + default - 6 + statanorm: Boolean indicator of literature based or CID-Harvard STATA normalization. + default - False + """ +``` +## Future Considerations +* User error warnings +* Investigate use of ecomplexity package fork +* Additional IO-PS metrics +* ECI and distance alignment +## References +### IO-PS + +* Bam, W., & De Bruyne, K. (2017). Location policy and downstream mineral processing: A research agenda. Extractive Industries and Society, 4(3), 443–447. https://doi.org/10.1016/j.exis.2017.06.009 +* Marais, M., & Bam, W. (2019). Developmental potential of the aerospace industry: the case of South Africa. In 2019 IEEE International Conference on Engineering, Technology and Innovation (ICE/ITMC) (pp. 1–9). IEEE. https://doi.org/10.1109/ICE.2019.8792812 + +### Economic Complexity and Product Complexity +This packages uses a modified copy of the Growth Lab at Harvard's Center for International Development py-ecomplexity package. The ecomplexity package is used to calculate economic complexity indices: https://github.com/cid-harvard/py-ecomplexity + + +%package -n python3-iops +Summary: Open-source Python release of the IO-PS package +Provides: python-iops +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-iops +# py-IO-PS +Public repository of developmental Python code related to research on the input-output product space (IO-PS) +[Described in Bam, W., & De Bruyne, K. (2019). Improving Industrial Policy Intervention: The Case of Steel in South Africa. The Journal of Development Studies, 55(11), 2460–2475. https://doi.org/10.1080/00220388.2018.1528354] + +## Package + +### Installation +The package is available from the Python Package Index: https://pypi.org/project/iops/ + +```text +pip install iops +pip install ecomplexity +``` + +### Usage +CEPII-BACI trade data is a required input (.csv). The BACI data is available at: http://www.cepii.fr/CEPII/fr/bdd_modele/presentation.asp?id=37 + +Full IO-PS analysis requires a value chain input (.csv). Three columns are required: 'Tier', 'Category' and 'HS Trade Code'. + +```python +import pandas as pd +from iops import main + +tradedata_df = pd.read_csv('BACI_HSXX_YXXXX_V202001.csv') +valuechain_df = pd.read_csv('X_Value_Chain.csv') + +main.iops(tradedata_df,valuechain_df) +``` + +### Value Chain Output +Results are generated at tier, category and product level. Results are written to an Excel spreadsheet and headless CSV for each. +```text +Tier_Results.csv +Tier_Results.xlsx +Product_Category_Results.csv +Product_Category_Results.xlsx +Product_Results.csv +Product_Results.xlsx +``` + +### Function +```Python +def iops(tradedata, valuechain=None, countrycode=710, tradedigit=6, statanorm=False): + """ IO-PS calculation function that writes the results to .xls and .csv + Arguments: + tradedata: pandas dataframe containing raw CEPII-BACI trade data. + valuechain: .csv of the value chain the IO-PS will map. + columns - 'Tier', 'Category', 'HS Trade Code' + default - None + countrycode: integer indicating which country the IO-PS will map. + default - 710 + tradedigit: Integer of 6 or 4 to indicate the raw trade digit summation level. + default - 6 + statanorm: Boolean indicator of literature based or CID-Harvard STATA normalization. + default - False + """ +``` +## Future Considerations +* User error warnings +* Investigate use of ecomplexity package fork +* Additional IO-PS metrics +* ECI and distance alignment +## References +### IO-PS + +* Bam, W., & De Bruyne, K. (2017). Location policy and downstream mineral processing: A research agenda. Extractive Industries and Society, 4(3), 443–447. https://doi.org/10.1016/j.exis.2017.06.009 +* Marais, M., & Bam, W. (2019). Developmental potential of the aerospace industry: the case of South Africa. In 2019 IEEE International Conference on Engineering, Technology and Innovation (ICE/ITMC) (pp. 1–9). IEEE. https://doi.org/10.1109/ICE.2019.8792812 + +### Economic Complexity and Product Complexity +This packages uses a modified copy of the Growth Lab at Harvard's Center for International Development py-ecomplexity package. The ecomplexity package is used to calculate economic complexity indices: https://github.com/cid-harvard/py-ecomplexity + + +%package help +Summary: Development documents and examples for iops +Provides: python3-iops-doc +%description help +# py-IO-PS +Public repository of developmental Python code related to research on the input-output product space (IO-PS) +[Described in Bam, W., & De Bruyne, K. (2019). Improving Industrial Policy Intervention: The Case of Steel in South Africa. The Journal of Development Studies, 55(11), 2460–2475. https://doi.org/10.1080/00220388.2018.1528354] + +## Package + +### Installation +The package is available from the Python Package Index: https://pypi.org/project/iops/ + +```text +pip install iops +pip install ecomplexity +``` + +### Usage +CEPII-BACI trade data is a required input (.csv). The BACI data is available at: http://www.cepii.fr/CEPII/fr/bdd_modele/presentation.asp?id=37 + +Full IO-PS analysis requires a value chain input (.csv). Three columns are required: 'Tier', 'Category' and 'HS Trade Code'. + +```python +import pandas as pd +from iops import main + +tradedata_df = pd.read_csv('BACI_HSXX_YXXXX_V202001.csv') +valuechain_df = pd.read_csv('X_Value_Chain.csv') + +main.iops(tradedata_df,valuechain_df) +``` + +### Value Chain Output +Results are generated at tier, category and product level. Results are written to an Excel spreadsheet and headless CSV for each. +```text +Tier_Results.csv +Tier_Results.xlsx +Product_Category_Results.csv +Product_Category_Results.xlsx +Product_Results.csv +Product_Results.xlsx +``` + +### Function +```Python +def iops(tradedata, valuechain=None, countrycode=710, tradedigit=6, statanorm=False): + """ IO-PS calculation function that writes the results to .xls and .csv + Arguments: + tradedata: pandas dataframe containing raw CEPII-BACI trade data. + valuechain: .csv of the value chain the IO-PS will map. + columns - 'Tier', 'Category', 'HS Trade Code' + default - None + countrycode: integer indicating which country the IO-PS will map. + default - 710 + tradedigit: Integer of 6 or 4 to indicate the raw trade digit summation level. + default - 6 + statanorm: Boolean indicator of literature based or CID-Harvard STATA normalization. + default - False + """ +``` +## Future Considerations +* User error warnings +* Investigate use of ecomplexity package fork +* Additional IO-PS metrics +* ECI and distance alignment +## References +### IO-PS + +* Bam, W., & De Bruyne, K. (2017). Location policy and downstream mineral processing: A research agenda. Extractive Industries and Society, 4(3), 443–447. https://doi.org/10.1016/j.exis.2017.06.009 +* Marais, M., & Bam, W. (2019). Developmental potential of the aerospace industry: the case of South Africa. In 2019 IEEE International Conference on Engineering, Technology and Innovation (ICE/ITMC) (pp. 1–9). IEEE. https://doi.org/10.1109/ICE.2019.8792812 + +### Economic Complexity and Product Complexity +This packages uses a modified copy of the Growth Lab at Harvard's Center for International Development py-ecomplexity package. The ecomplexity package is used to calculate economic complexity indices: https://github.com/cid-harvard/py-ecomplexity + + +%prep +%autosetup -n iops-0.5.1 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-iops -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon May 29 2023 Python_Bot <Python_Bot@openeuler.org> - 0.5.1-1 +- Package Spec generated @@ -0,0 +1 @@ +4e76b95c8c1b74dcafa97f59f50b3d1d iops-0.5.1.tar.gz |