How to use convert_data_types method in localstack

Best Python code snippet using localstack_python

data_reader.py

Source:data_reader.py Github

copy

Full Screen

...25 26 inv_dictionary = {v: k for k, v in dictionary.items()} 27 self.data = self.data.rename(inv_dictionary, axis = 'columns')28 29 def convert_data_types(self, ths_separator = ' ', decimal_separator = ','): 30 self.data['Amount'] = self.data['Amount'].str.replace(ths_separator, '')31 self.data['Amount'] = self.data['Amount'].str.replace(decimal_separator, '.')32 self.data = self.data.astype({'Amount': 'float'}) 33 self.data['Transaction time'] = pd.to_datetime(self.data['Transaction time'])34 35 def reshape_data(self, dictionary, 36 ths_separator = ' ', decimal_separator = ',', date_format = '%Y.%m.%d. %H:%M:S'):37 self.identify_columns(dictionary)38 39 if self.fileType=='csv':40 self.convert_data_types(ths_separator=ths_separator, decimal_separator = decimal_separator)41 42########################43data_reader = dataReader()44data_reader.read_data(path ='E:\\Software Engineering\\SmartPurse\\testing things\\2021_input_b_csv2.csv',45 file_type='csv', sep=';', header=14)46example_dictionary = {47 'Transaction type' : 'Forgalom típusa',48 'Transaction time' : 'Tranzakció időpontja',49 'Amount' : 'Összeg',50 'Counterparty account number' : 'Ellenoldali számlaszám',51 'Counterparty account name' : 'Ellenoldali név',52 'Description' : 'Közlemény' 53 }54data_reader.reshape_data(example_dictionary)...

Full Screen

Full Screen

geographic_objects.py

Source:geographic_objects.py Github

copy

Full Screen

...11 def __init__(self, FILE_ADDRESS, FOLDER_ADDRESS):12 #latitude szerokość geograficzna (Y)13 #longitude długosć geograficzna (X)14 data = DataImport(FILE_ADDRESS, "dict", FOLDER_ADDRESS)15 self.data = self.convert_data_types(data(), "float")16 self.calculate_radians_for_latitude_and_longitude()17 def __call__(self):18 return self.data19 def convert_data_types(self, data_list, DATA_TYPE):20 output = {}21 for key in data_list:22 value = data_list[key]23 output[key] = self.convert_data_type(value, DATA_TYPE)24 return output25 def convert_data_type(self, input, data_type):26 if input == "N/A" or input == "None":27 return None28 elif data_type == "str":29 return input30 elif data_type == "int":31 return int(input)32 elif data_type == "float":33 return float(input)34 def calculate_radians_for_latitude_and_longitude(self):35 self.data["latitude_rad"] = deg_to_rad(self.data["latitude_deg"])36 self.data["longitude_rad"] = deg_to_rad(self.data["longitude_deg"])37#--------------------------------------------------------------------------------------------38class Ship(GeographicObject):39 def __init__(self, FILE_ADDRESS, FOLDER_ADDRESS):40 #latitude szerokość geograficzna (Y)41 #longitude długosć geograficzna (X)42 data = DataImport(FILE_ADDRESS, "dict", FOLDER_ADDRESS)43 self.data = self.convert_data_types(data(), "float")44 self.calculate_radians_for_latitude_and_longitude()45 self.calculate_heading_rad()46 def calculate_heading_rad(self):47 self.data["heading_rad"] = deg_to_rad(self.data["heading_deg"])48#--------------------------------------------------------------------------------------------49if __name__ == "__main__":50 test = 351 os.chdir("..")52 if test == 1:53 ship = GeographicObject("SHIP_DATA_INPUT.txt", "data_files")54 print(ship())55 if test == 2:56 point = GeographicObject("POINT_DATA_INPUT.txt", "data_files")57 print(point())...

Full Screen

Full Screen

test_handler.py

Source:test_handler.py Github

copy

Full Screen

...14 "store_and_fwd_flag": "N"15 }16 17 def test_given_valid_route_IT_should_succeed(self):18 result = convert_data_types([self.ROUTE])19 self.assertEqual(1, result[0]['vendor_id'])20 self.assertEqual(datetime(2016, 6, 30, 23, 59, 58), result[0]['pickup_datetime'])21 self.assertEqual(-73.9881286621094, result[0]['pickup_longitude'])22 23if __name__ == '__main__':...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful