Last active
December 11, 2017 23:05
-
-
Save Kedrigern/0f30796e7f855ee51df0f536bf928c97 to your computer and use it in GitHub Desktop.
Transform CSV
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
import pandas as pd | |
def main(): | |
prefix = 'p7-2016' | |
names = ["DOKLAD_ROK","DOKLAD_DATUM","DOKLAD_AGENDA","DOKLAD_CISLO","ORGANIZACE","ORGANIZACE_NAZEV","ORJ","ORJ_NAZEV","PARAGRAF","PARAGRAF_NAZEV","POLOZKA","POLOZKA_NAZEV","SUBJEKT_IC","SUBJEKT_NAZEV","CASTKA_MD","CASTKA_DAL","POZNAMKA"] | |
to_del = ['DOKLAD_ROK', 'ORGANIZACE_NAZEV', 'ORJ', 'ORJ_NAZEV', 'PARAGRAF_NAZEV', 'DOKLAD_CISLO', 'POLOZKA_NAZEV'] | |
to_use = ["DOKLAD_ROK", "DOKLAD_DATUM"] | |
sr = pd.read_csv(prefix + '/SR.csv', sep=';', header=1, names=names, usecols=to_use) | |
print(sr.head()) | |
#ru = pd.read_csv(prefix + '/RU.csv', sep=';') | |
#sk = pd.read_csv(prefix + '/SK.csv', sep=';') | |
#merged = sr.append([ru, sk], ignore_index=True) | |
#merged.set_index(inplace=True) | |
#merged.drop(to_del, axis=1, inplace=True) | |
#print(merged.head()) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment