[Solved] C# Convert currency to string, remove decimal point but keep decimals, prepend 0s to have fixed width

You can use string.Format() with custom format specifiers. See details here. double dollars = 38.50; // your value int temp = (int)(dollars * 100); // multiplication to get an integer string result = string.Format(“{0:000000000}”, temp); // Output: 000003850 1 solved C# Convert currency to string, remove decimal point but keep decimals, prepend 0s to have … Read more

[Solved] Convert pandas column with currency values like €118.5M or €60K to integers or floats [closed]

Damn, a quick google search finds: def convert_si_to_number(x): total_stars = 0 x = x.replace(‘€’, ”) if ‘k’ in x: if len(x) > 1: total_stars = float(x.replace(‘k’, ”)) * 1000 # convert k to a thousand elif ‘M’ in x: if len(x) > 1: total_stars = float(x.replace(‘M’, ”)) * 1000000 # convert M to a million … Read more