data-conversion

Python convert switch data (text) to dict

Python convert switch data (text) to dict Question: I have the following data, which I recieve via a ssh session to a switch. I wish to convert the input which is text to a dict for easy access and the possiblity to monitor certain values. I cannot get the data extracted without a ton of …

Total answers: 1

How can I convert CSV to JSON with data type in python or node.js?

How can I convert CSV to JSON with data type in python or node.js? Question: I wanna convert CSV to JSON correct data type csv file 2nd row is data type. data has over 300 properties example data: Name DMG HP Human string number number boolean knight 100 500 true archer 50 200 true dog …

Total answers: 2

Convert python to C# Revit API

Convert python to C# Revit API Question: I am beginer in C# and Api, so it some difficult for me to convert useful solutions to my code. Please help understand how do it? In goal need find shortest way. Have some elements which connected each other by connectors. With this in hand I can find …

Total answers: 1

Is there a Python command to convert a string to an integer?

Is there a Python command to convert a string to an integer? Question: I am a newbie, please forgive my ignorance. I tried researching and reading other articles and questions, but nothing seems to give a proper answer. If the answer is simply no, please just tell me. Basically, I’m working on a project for …

Total answers: 3

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

Can I round a PANDAS dataframe column in the same line that I edit the column? Question: 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 …

Total answers: 1

0x%016llX from C to python?

0x%016llX from C to python? Question: 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 …

Total answers: 1

Convert nested JSON to CSV file in Python

Convert nested JSON to CSV file in Python Question: I know this question has been asked many times. I tried several solutions but I couldn’t solve my problem. I have a large nested JSON file (1.4GB) and I would like to make it flat and then convert it to a CSV file. The JSON structure …

Total answers: 5

Convert Pandas dataframe to Dask dataframe

Convert Pandas dataframe to Dask dataframe Question: Suppose I have pandas dataframe as: df=pd.DataFrame({‘a’:[1,2,3],’b’:[4,5,6]}) When I convert it into dask dataframe what should name and divisions parameter consist of: from dask import dataframe as dd sd=dd.DataFrame(df.to_dict(),divisions=1,meta=pd.DataFrame(columns=df.columns,index=df.index)) TypeError: init() missing 1 required positional argument: ‘name’ Edit : Suppose I create a pandas dataframe like: pd.DataFrame({‘a’:[1,2,3],’b’:[4,5,6]}) Similarly …

Total answers: 1