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

Code for combining all contact sheets into one. #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions dcds.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@

# coding: utf-8

# In[53]:


import os
os.getcwd()
os.chdir('C:/Users/jingcong/Desktop/py')

import csv

'''
with open('DataDC-guests-2017.02.01-10.45.csv - DataDC-guests-2017.02.01-10.45.csv.csv', "r") as f:
reader = csv.reader(f,delimiter=":")
for row in reader:
print(row)
'''

import numpy as np
import pandas as pd
replaceDict = {"Training" : "Get Training","New Job":"Get Hired","Volunteering":"Volunteering","Teaching":"Give Training","Hiring":"Hiring","Speaking": "Event Speaking","Sponsoring":"Sponsoring","None":"None"}

filename = 'DataDC-guests-2017.02.01-10.45.csv - DataDC-guests-2017.02.01-10.45.csv.csv'

dsdc = pd.read_csv(filename)

def replaceVal(x):
helpValue = ''
temp = x
if not isinstance(x,str):
temp = "None"
line = temp.replace("\n","")
line_split = line.split(",")
for i in line_split:
helpValue = replaceDict[i] + "," + helpValue
return helpValue

dsdc["What may we help with?"] = dsdc["What may we help with?"].apply(replaceVal)
dsdc.to_csv("test.csv")


# In[4]:

dsdc.head()


# In[55]:




# In[50]:

dsdc.helpUpdated


# In[48]: