# Can we convert exponential or scientific notation number to a whole number?

I have a number 3.43E-6 and i need to convert it into 0.00000343. Is that possible with PHP? I tried PHP number_format but not worked as expected. Number:- 3.43E-6 Expected result:- 0.00000343 >Solution : yes it is possible try this and you can modify this 8 if u want more decimal ‘%.8f \$number = 3.43E-6;… Read More Can we convert exponential or scientific notation number to a whole number?

# How can I convert numeric(16) formatted as yyyyMMddHHmmss00 to Datetime in SQL

I want to convert start_date numeric(16) to datetime for example: 2023032012121201 to Datetime I tried this SELECT CONVERT(datetime, SUBSTRING(CAST(start_date AS varchar(16)), 1, 8) + ‘ ‘ + STUFF(STUFF(STUFF(RIGHT(‘0000000000’ + CAST(start_date AS varchar(16)), 10), 3, 0, ‘:’), 6, 0, ‘:’), 9, 0, ‘.’)) FROM table but it gives Conversion failed when converting date and/or time from… Read More How can I convert numeric(16) formatted as yyyyMMddHHmmss00 to Datetime in SQL

# Convert dictionary to string (PHP)

I need to write a function that converts a dictionary (array) [‘a’ => 1, ‘b’ => 2] to a string ‘[a => 1, b => 2]’. I am trying to iterate over the array and just build a string from its items: function dictToString(array \$dict): string { foreach(\$dict as \$key => \$value) { echo \$key… Read More Convert dictionary to string (PHP)

# Convert unicode to decimal

I have a string like this which i want to convert to only decimal data: "\u0006;\u0003\u001588D402" I’m not sure what the output should look like, but I imagine it should be like this: "631588D402" I have tried to separate each hexadecimal data and then join them but have been unable to either separate them or… Read More Convert unicode to decimal

# Can I round a PANDAS dataframe column in the same line that I edit the column?

Using Python 3.9 Using PANDAS, I’m trying to convert a column from feet to meters and then round the answer to three decimals. I currently have this: df[‘col_m’] = df[col_f] * 0.3048 df[‘col_m’] = df[‘col_m’].round(3) It gets the job done but is there a more efficient way to do this? Is it possible to do… Read More Can I round a PANDAS dataframe column in the same line that I edit the column?

# 0x%016llX from C to python?

I am using the following expression in C code: sprintf(message, "0x%016llX; ", someIntValue); How do I do the same in python? I know in C what it means. the mandatory % character a 0 flag for padding the 16 as "minimum field width" the ll as "length modifiers" the x conversion specifier What I don’t… Read More 0x%016llX from C to python?

# How to get Year Mont and Quarter from time series in python

I have this dataset: date_time srch_id 2013-04-04 08:32:15 1 2013-04-04 08:32:15 1 .. 2013-06-30 19:55:18 332785 2013-06-30 19:55:18 332785 And I want to separate date_time into: YM (Year_Month),YMQ(Year_Month_Quarter),Y and M: date_time srch_id YMQ YM Y M 2013-04-04 08:32:15 1 2013-04-2 2013-04 2013 4 2013-04-04 08:32:15 1 2013-04-2 2013-04 2013 4 .. 2013-06-30 19:55:18 332785 2013-06-2… Read More How to get Year Mont and Quarter from time series in python

# How to convert data from Array of Objects efficiently

I am getting an array of objects like this from my API [ { […] time: "2022-01-27T18:21Z", attributes: { […] temp1: 12, temp2: 49, […], tempN: 23 […] }, […] }, { […] time: "2022-01-27T18:26Z", attributes: { […] temp1: 13, temp2: 49, […], tempN: 22 […] }, […] }, […] ] And I need to… Read More How to convert data from Array of Objects efficiently

# How to convert string booleans expressed in local language into boolean

I have a large dataset collected in local language, where each bolean column use the word "PRAWDA" for TRUE and "FAŁSZ" for FALSE. So far, the dataframe stores those values as a column with factors with 2 levels: "FAŁSZ" and "PRAWDA". My aim is to have the column which will be full of booleans, not… Read More How to convert string booleans expressed in local language into boolean