Git Product home page Git Product logo

labelproduct's Introduction

labelproduct

Labelling each entry for tables including various products and specifications regarding them

The raw data which used for this study included information of; date of importation, active pharmaceutical ingredient (API), brand name, product quantity for the related importation, manufacturer’s name, and name of the market authorization holder. For the purpose of the study, import dates, APIs, and quantities are extracted to an excel table. And then each entry labelled regarding the name of the API using an algorithm, which is shown below, in Python, version 3.9.7.


import pandas as pd

dict = {}

df = pd.DataFrame()
data = pd.read_excel("filename.xlsx")
df = df.append(data)

product_code = 0

for index, row in df.iterrows():
    active_ingredient = row['Active Ingredient']
    if(active_ingredient in dict):
        df.at[index,'Product Code'] = dict[active_ingredient]
        
    else:
        dict[active_ingredient] = product_code
        df.at[index,'Product Code'] = product_code
        product_code += 1
        
df.to_excel('./result.xlsx')

Also for labelling each pharmaceutical product according to its API and manufacturer:


import pandas as pd
import numpy as np

dict = {}

df = pd.DataFrame()
data = pd.read_excel("filename.xlsx")
df = df.append(data)

product_code = 0

for index, row in df.iterrows():
        
    active_ingredient = row['Active Ingredient']
    if(active_ingredient in dict):
        numbered_ingredient = dict[active_ingredient]
        exporter = row['Exporter']
        code = 0
        if(exporter in numbered_ingredient):
            code = numbered_ingredient[exporter]
        else:
            code = product_code
            numbered_ingredient[exporter] = code
            dict[active_ingredient] = numbered_ingredient
            product_code += 1
        
        df.at[index,'Product Code'] = code
    else:
        numbered_ingredient = {}
        exporter = row['Exporter']
        numbered_ingredient[exporter] = product_code
        df.at[index,'Product Code'] = product_code
        product_code += 1
        dict[active_ingredient] = numbered_ingredient
    
df.to_excel('./albaniaimport_result.xlsx')

labelproduct's People

Contributors

ozgenozan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.