I have the below data frame
ipdb> csv_data
country_edited sale_edited date_edited transformation_edited
0 India 403171 21091956 1
1 Bhutan 394096 21091956 2
2 Nepal 361372 21091956 3
3 madhya 355883 21091956 4
4 sudan 262949 21091956 5
and below is my code
transfactor_count = 5.6
csv_data["transformation_edited"] = csv_data["transformation_edited"].apply(lambda x: x * transfactor_count)
But the above code was giving me an error
*** NameError: global name 'transfactor_count' is not defined
How to solve this ?
Actual code
for foreign_key in data_mapping_record.csvdatabasecolumnmapping_set.all():
data_type = foreign_key.data_type
trans_factor = foreign_key.tranformation_factor
if data_type == "Decimal":
import ipdb; ipdb.set_trace()
csv_data[foreign_key.table_column_name] = csv_data[foreign_key.table_column_name].apply(lambda x: x * trans_factor )
elif data_type in ["Date", "Datetime"]:
csv_data[foreign_key.table_column_name] = csv_data[foreign_key.table_column_name].apply( lambda d: datetime.strptime(d, dates[date]) )