Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pulitura libro codice da google colaboratory #14

Open
ghost opened this issue Nov 23, 2018 · 1 comment
Open

Pulitura libro codice da google colaboratory #14

ghost opened this issue Nov 23, 2018 · 1 comment

Comments

@ghost
Copy link

ghost commented Nov 23, 2018

import numpy as np
def pulisci_librocodice(x):
    x = x.replace("\n", "")
    x = x.replace(".", ",")
    x = x.replace('“', '"')
    x = x.replace('”', '"')
    x = x.replace('np,nan','np.nan')
    x = eval(x)
    return x

def recode(x, dizionario):
    try:
        return dizionario[x]
    except:
        return x




def recode_indice(distribuzione, libro_codice_cella):
    recode_index = []
    for item in distribuzione.index.tolist():
        lib_cod = pulisci_librocodice(libro_codice_cella)
        recode_index.append(recode(item , lib_cod))
    distribuzione.index = recode_index
    return distribuzione

@ghost
Copy link
Author

ghost commented Nov 23, 2018

libro_codice = download_gspread("Libro Codice Niccolò", sheet_name='Codifica delle variabili', virgola_italiano=False, gc = gc, )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants