Jovian
⭐️
Sign In
In [10]:
import jovian
import tensorflow
import pandas as pd
In [56]:
df_unspsc = pd.read_csv('data/unspsc.csv', encoding='utf-8')
df_unspsc.sort_values(by=['Commodity'])
df_unspsc.head(10)
Out[56]:
In [88]:
df_unspsc_mod = pd.DataFrame(index=None, data=None, columns=['DisplayName', 'Code', 'Type'])
In [87]:
df_segment = pd.DataFrame(df_unspsc.drop_duplicates(['SegmentName','Segment'])[['SegmentName','Segment']]).reset_index(drop=True)
df_segment = df_segment.rename(columns={"SegmentName": "DisplayName", "Segment": "Code"})
df_segment['Type'] = 'Segment'
In [86]:
df_family = pd.DataFrame(df_unspsc.drop_duplicates(['FamilyName','Family'])[['FamilyName','Family']]).reset_index(drop=True)
df_family = df_family.rename(columns={"FamilyName": "DisplayName", "Family": "Code"})
df_family['Type'] = 'Family'
In [85]:
df_class = pd.DataFrame(df_unspsc.drop_duplicates(['ClassName','Class'])[['ClassName','Class']]).reset_index(drop=True)
df_class = df_class.rename(columns={"ClassName": "DisplayName", "Class": "Code"})
df_class['Type'] = 'Class'
In [84]:
df_commodity = pd.DataFrame(df_unspsc.drop_duplicates(['CommodityName','Commodity'])[['CommodityName','Commodity']]).reset_index(drop=True)
df_commodity = df_commodity.rename(columns={"CommodityName": "DisplayName", "Commodity": "Code"})
df_commodity['Type'] = 'Commodity'
In [91]:
df_unspsc_mod = pd.concat([df_segment, df_family, df_class, df_commodity], ignore_index=True)
In [93]:
df_unspsc_mod.to_csv('data/unspsc_processed.csv')
In [5]:
jovian.commit()
[jovian] Saving notebook..
[jovian] Updating notebook "910822e857744b1aa7cf048c48a1681e" on https://jvn.io [jovian] Uploading notebook.. [jovian] Capturing environment.. [jovian] Committed successfully! https://jvn.io/vshlpunjabi/910822e857744b1aa7cf048c48a1681e
In [ ]: