0

Ok, so I may be attacking this all wrong and am eager to hear any suggestions that would provide a more efficient solution.

I have a csv_file and in that csv_file I have a column that has a two-letter str in each row. I have built a dictionary that is intended to correlate a given two-letter str with an int. I'd like to output a new column in my original df that lists the int I have associated with the str in my dictionary.

import pandas as pd
import numpy as np

#Import csv_file.
df1 = pd.read_csv(r'C:\example.csv')

Watts = {"T8":29,"DT":80,"Co":1000,...}
if df1['Stamp'] == Watts
'print numeric values of Watts here'

Thanks in advance.

0 Answers0