Data structure conversion method and apparatus, electronic device, and storage medium
By traversing each data item in the dictionary data structure, combining its original keys and converting it into a two-dimensional data structure, the problem of incomparable data conversion methods between different dictionary structures is solved, and efficient and general data structure conversion is achieved.
Patent Information
- Application Number
- PCT/CN2023/115932
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-08-30
- Publication Date
- 2025-03-06
AI Technical Summary
The existing data structure conversion methods vary due to different dictionary structures, resulting in the incomparable data conversion methods between different dictionary structures, and there is a problem of low structural conversion processing efficiency.
A common data structure conversion scheme is provided, by traversing each data item in the dictionary data structure, determining multiple original keys and values of each data item, combining multiple original keys of each data item, generating merge keys, and converting each data item into a two-dimensional data structure.
The universality of data conversion between different dictionary structures is realized, the processing efficiency of data structure conversion is improved, and the conversion operation is simplified.
Smart Images

Figure CN2023115932_06032025_PF_FP_ABST
Abstract
Description
Data structure conversion method, device, electronic device and storage medium Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a data structure conversion method, device, electronic device, storage medium and computer program. Background Art
[0002] A dictionary structure is an abstract data structure that stores data in the form of key-value pairs. Specifically, each key-value pair (often also called an "item") in a dictionary may include multiple keys and a corresponding value for each of the multiple keys. In some cases, the dictionary structure may be very complex and have many branches. Therefore, when performing data analysis processing, it is usually necessary to extract the data to be analyzed or useful data from the dictionary structure and convert all the extracted data into a flat data structure.
[0003] However, most existing data structure conversion methods vary depending on the dictionary structure. That is, the data conversion methods between different dictionary structures are not universal, resulting in low efficiency in structure conversion processing.
[0004] Summary of the Invention
[0005] In view of this, the present application provides a universal data structure conversion solution that can uniformly convert any form of complex dictionary data structure into a simple two-dimensional data structure.
[0006] According to a first aspect of an embodiment of the present application, a data structure conversion method is provided, comprising: traversing each data item in a dictionary data structure to determine multiple original keys and one value for each data item; merging at least two of the multiple original keys of each data item to generate at least one merged key for each data item; and generating a two-dimensional data structure for each data item based on the at least one merged key of each data item, each unmerged original key, and the value.
[0007] According to a second aspect of an embodiment of the present application, a data structure conversion device is provided, including: a traversal module for traversing each data item in a dictionary data structure and determining multiple original keys and one value of each data item; a merging module for merging at least two of the multiple original keys of each data item to generate at least one merged key for each data item; and a conversion module for generating a two-dimensional data structure for each data item based on at least one merged key of each data item, each original key that has not been merged, and the value.
[0008] According to the third aspect of an embodiment of the present application, an electronic device is provided, comprising: a processor, a memory, a communication interface and a bus, wherein the processor, the memory and the communication interface communicate with each other through the bus; the memory is used to store at least one program, and the program enables the processor to perform operations corresponding to the data structure conversion method described in the first aspect above.
[0009] According to the fourth aspect of the embodiment of the present application, a computer-readable storage medium is provided, on which computer instructions are stored. When the computer instructions are executed by a processor, the processor executes the data structure conversion method described in the first aspect above.
[0010] According to a fifth aspect of an embodiment of the present application, a computer program product is provided, comprising computer instructions, wherein the computer instructions instruct a computing device to perform operations corresponding to the data structure conversion method described in the first aspect.
[0011] As can be seen from the above technical solution, the present application determines multiple original keys for each data item in a dictionary data structure and performs a merge process on at least a portion of the original keys in each data item, thereby converting each data item into a flat, two-dimensional data structure based on each merge key, each unmerged original key, and the value of each data item. The technical solution of the present application is not only applicable to data structure conversion processing for different dictionary structures, thus having strong versatility, but also has the advantage of high data structure conversion efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] FIG1 is a flow chart of a data structure conversion method according to an exemplary embodiment of the present application;
[0013] FIG2 is a flow chart of a data structure conversion method according to another exemplary embodiment of the present invention;
[0014] FIG3 is a schematic diagram of the architecture of a data structure conversion device according to an exemplary embodiment of the present application;
[0015] FIG. 4 is a schematic diagram of an electronic device according to an exemplary embodiment of the present application.
[0016] List of reference numerals:
[0017] 100. Data structure conversion method
[0018] 102. Traverse each data item in the dictionary data structure and determine multiple original keys and a value for each data item
[0019] 104. Merge at least two of the multiple original keys of each data item to generate at least one merged key for each data item.
[0020] 106. Generate a two-dimensional data structure for each data item based on at least one merge key of each data item and each original key and value that are not merged.
[0021] 200. Data structure conversion method
[0022] 202. Integrate the two-dimensional data structure of each data item to generate a data source list containing all data items, and generate each cell value in the data source list based on each merge key, each unmerged original key, and the value of each data item.
[0023] 204. According to the actual analysis requirements, determine a data column in the data source list as the target column
[0024] 206. Based on the target column and each cell value of the data source list, perform row and column conversion on the data source list to generate a pivot table that meets actual analysis needs
[0025] 300, data structure conversion device 302, traversal module 304, merging module
[0026] 306, conversion module 400, electronic device 402, processor
[0027] 404, communication interface 406, memory 408, bus
[0028] 410. Procedure DETAILED DESCRIPTION
[0029] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the embodiments of the present application, all other embodiments obtained by ordinary technicians in this field should fall within the scope of protection of the embodiments of the present application.
[0030] The following describes some embodiments of the present application in detail with reference to the accompanying drawings. The following embodiments and features thereof may be combined with one another unless they conflict with each other. The steps in the following method embodiments are for illustrative purposes only and are not intended to limit the present invention.
[0031] Due to the high complexity and numerous branches of the dictionary structure, data analysis requires converting the data to be analyzed in the dictionary structure into a flat data structure. However, in existing technologies, data conversion operations between different dictionary structures are not universal, resulting in low efficiency in structure conversion processing.
[0032] In view of this, the embodiments of the present application provide a data structure conversion solution, which obtains the key and value of each data item in the dictionary data structure and merges at least a part of the original key of each data item to convert each data item in the dictionary data structure into a two-dimensional data structure. It is not only applicable to different dictionary structures and has the advantage of strong versatility, but also the conversion processing operation is simple, which can improve the efficiency of data structure conversion processing.
[0033] The data structure conversion method, device, electronic device and storage medium provided in the embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0034] Data structure conversion method
[0035] FIG1 is a flow chart 100 of a data structure conversion method according to an exemplary embodiment of the present application. As shown in FIG1 , the data structure conversion method 100 of this embodiment mainly includes the following steps:
[0036] Step 102: traverse each data item in the dictionary data structure to determine multiple original keys and a value for each data item.
[0037] In some embodiments, each original key for each data item may be determined as follows:
[0038] Read each data item in the dictionary data structure, obtain the complete path of each data item, identify each node in the complete path of each data item, and determine each original key of each data item.
[0039] In dictionary structure data, a pair of curly braces "{}" can be used as boundaries, each data item (also called an element) is separated by a comma ",", and the key and value of each data item are separated by a colon ":". Refer to the dictionary data structure shown in Example 1 below:
[0040] In this embodiment, each symbol in the complete path of each data item can be identified in sequence according to the established symbol usage rules in the dictionary data structure to determine each node in the complete path of each data item, and then determine each original key of each data item.
[0041] In some embodiments, when the dictionary data structure includes at least one branch, the root node of the dictionary data structure can be determined, and based on the root node, each data item under each branch of the dictionary data structure can be read cyclically to obtain the complete path of each data item. That is, when the comma "," used to separate each data item in the dictionary data structure is read, it means that the reading of the current data item in the dictionary data structure is completed, and then the root node is started again to read the next data item in the dictionary data structure.
[0042] Taking the dictionary data structure of Example 1 as an example, based on the root node "root", each data item under each branch of the dictionary data structure (for example, "ab" branch, "data" branch, "c" branch, etc.) can be read in a loop to obtain the complete path of each data item under each branch.
[0043] For example, when the comma after "ulqdzf" is read, it means that the current data item has been read completely, then it starts again from the root node "root" and reads the next data item until the comma after "mpaccp" is read, and so on, until each data item under each branch in the dictionary data structure is read, and the complete path of each data item is obtained.
[0044] By traversing each data item in the dictionary data structure of Example 1, multiple original keys and a value of each data item are determined, as shown in Example 2 below:
[0045] [[('root','ab','data','LIST_000000','@a1'),'ulqdzf']
[0046] [('root','ab','data','LIST_000000','@a2'),'mpaccp']
[0047] [('root','ab','data','LIST_000000','data_@b1'),'qrfeel']
[0048] [('root','ab','data','LIST_000000','data_@b2'),'hyhxgb']
[0049] [('root','ab','data','LIST_000001','@a1'),'ouvrcf']
[0050] [('root','ab','data','LIST_000001','@a2'),'qohfsh']
[0051] [('root','ab','data','LIST_000001','data_@b1'),'ulwofp']
[0052] [('root','ab','data','LIST_000001','data_@b2'),'qzwmlg']
[0053] [('root', 'c', 'LIST_000000', '@a1'), 'zmjqqe']
[0054] [('root', 'c', 'LIST_000000', '@a2'), 'duxjaz']
[0055] [('root', 'c', 'LIST_000000', 'data_@b1'), 'jkxoke']
[0056] [('root', 'c', 'LIST_000000', 'data_@b2'), 'ryhifu']]
[0057] Step 104: Merge at least two of the multiple original keys of each data item to generate at least one merged key for each data item.
[0058] In some embodiments, for any current item among the data items, the category of each original key of the current item is identified, each original key with the same category is determined as each key to be merged for the current item, each key to be merged for the current item is merged, and at least one merged key for the current item is generated.
[0059] Taking Example 2 as an example, according to the category of each original key of each data item, if each original key except the last original key in each data item has the same category, then each original key except the last original key in each data item is determined to be the key to be merged for each data item.
[0060] For example, in the data item [('root', 'ab', 'data', 'LIST_000000', '@a1'), 'ulqdzf'], if the original keys "root", "ab", "data", and "LIST_000000" have the same category, the original keys "root", "ab", "data", and "LIST_000000" can be determined as the keys to be merged of the data item.
[0061] In some embodiments, each key to be merged for each data item may also be determined by manual setting.
[0062] In some embodiments, a merge key for the current item may be generated as follows:
[0063] According to the category of each to-be-merged key of the current item, a target category is determined, and each to-be-merged key corresponding to the target category is determined as a target key. A connector can be created between each pair of adjacent target keys, and based on each target key connected by the connector, a merge key corresponding to the target category of the current item is generated.
[0064] In some embodiments, “ / ” can be used as a connector to connect any two adjacent target keys.
[0065] For example, in the data item [('root', 'ab', 'data', 'LIST_000000', '@a1'), 'ulqdzf'] of Example 2, if the original keys "root", "ab", "data", and "LIST_000000" are determined to be the target keys of the data item corresponding to the target category, a connector " / " can be created between each pair of adjacent target keys "root", "ab", "data", and "LIST_000000" to generate a merge key "root / ab / data / LIST_000000" corresponding to the target category.
[0066] Step 106: Generate a two-dimensional data structure for each data item based on at least one merge key of each data item and each unmerged original key and value.
[0067] For example, after performing the merge process on each to-be-merged key of each data item in Example 2, each merged key of each data item, each unmerged original key, and value generated can be as shown in Example 3 below:
[0068] [('root / ab / data / LIST_000000', '@a1', 'ulqdzf'),
[0069] ('root / ab / data / LIST_000000', '@a2', 'mpaccp'),
[0070] ('root / ab / data / LIST_000000', 'data_@b1', 'qrfeel'),
[0071] ('root / ab / data / LIST_000000', 'data_@b2', 'hyhxgb'),
[0072] ('root / ab / data / LIST_000001', '@a1', 'ouvrcf'),
[0073] ('root / ab / data / LIST_000001', '@a2', 'qohfsh'),
[0074] ('root / ab / data / LIST_000001', 'data_@b1', 'ulwofp'),
[0075] ('root / ab / data / LIST_000001', 'data_@b2', 'qzwmlg'),
[0076] ('root / c / LIST_000000', '@a1', 'zmjqqe'),
[0077] ('root / c / LIST_000000', '@a2', 'duxjaz'),
[0078] ('root / c / LIST_000000', 'data_@b1', 'jkxoke'),
[0079] ('root / c / LIST_000000', 'data_@b2', 'ryhifu')]
[0080] In some embodiments, for any current item in each data item, when each original key of the current item is determined as a key to be merged, that is, all original keys of the current item are merged, the current item may not include original keys that have not been merged.
[0081] In some embodiments, the two-dimensional data structure of each data item may include a data frame structure.
[0082] In some embodiments, the number of one-dimensional data in the two-dimensional data structure of each data item is the same.
[0083] The data structure conversion solution provided in this embodiment determines multiple original keys and values for each data item in the dictionary data structure, merges at least a portion of the original keys for each data item, and converts each data item in the complex dictionary structure into a simple two-dimensional data structure based on each merged key and each unmerged original key and value. This technical solution not only offers the advantages of simple structure conversion operations, thereby improving data structure conversion processing efficiency, but also is applicable to a variety of different dictionary data structures, demonstrating its high versatility.
[0084] The data structure conversion solution provided in this embodiment is based on the root node of the dictionary data structure, and cyclically reads each data item in the dictionary data structure to obtain the complete path of each data item, and determines all the original keys of each data item accordingly. This can improve the accuracy of the data structure conversion processing and avoid the problem of data loss during the structure conversion process.
[0085] The data structure conversion solution provided in this embodiment can achieve the technical effect of automatic data structure conversion without human intervention by identifying the category of each original key of each data item to automatically determine the key to be merged in each original key.
[0086] FIG2 shows a process flow chart of a data structure conversion method 200 according to another embodiment of the present application. This embodiment can continue to execute the above step 108. As shown in FIG2 , the data structure conversion method 200 of this embodiment mainly includes the following steps:
[0087] Step 202: Integrate the two-dimensional data structure of each data item to generate a data source list containing all data items, and generate each unit value in the data source list according to each merge key, each unmerged original key and value of each data item.
[0088] In this embodiment, the two-dimensional data structure of each data item may include a data frame structure.
[0089] In this embodiment, the number of one-dimensional data contained in the two-dimensional data structure of each data item is equal. Therefore, each row of the data source list can be generated based on the two-dimensional data structure of each data item, and each merge key, each unmerged original key and value of each data item (that is, each one-dimensional data in the two-dimensional data structure of each data item) is filled in each column in each row of the data source list (that is, each cell in each row), thereby generating a data source list corresponding to all data items and each cell value in the data source list.
[0090] For example, by integrating the two-dimensional data structure of each data item in Example 2, a data source list of all data items is generated, as shown in Example 4 below:
[0091] Step 204: According to actual analysis requirements, a data column in the data source list is determined as a target column.
[0092] For example, any one of “column 0”, “column 1”, and “column 2” in Example 4 may be determined as the target column to be analyzed.
[0093] Step 206 : Based on the target column of the data source list, the number of rows and the number of columns of each cell value, perform row-column conversion on the data source list to generate a pivot table that meets actual analysis requirements.
[0094] For example, based on "column 1" in Example 4 and each cell value, row-column conversion is performed on the data source list. The generated pivot table can refer to the following Example 5:
[0095] The data structure conversion solution provided in this embodiment generates a two-dimensional data source list by integrating the two-dimensional data structure of each data item. According to the actual data analysis needs, any data column in the data source list is determined as the target column, and row-column conversion is performed to generate a pivot table that meets the actual data analysis needs. This can improve the efficiency of data analysis processing and provide a better data analysis experience.
[0096] Data structure conversion device
[0097] Corresponding to the above method embodiment, FIG3 shows a schematic diagram of a data structure conversion device according to an embodiment of the present application. As shown in FIG3 , the data structure conversion device 300 includes:
[0098] A traversal module 302 is configured to traverse each data item in the dictionary data structure and determine a plurality of original keys and a value for each data item;
[0099] a merging module 304 for merging at least two of the multiple original keys of each data item to generate at least one merged key for each data item;
[0100] The conversion module 306 is configured to generate a two-dimensional data structure for each data item according to at least one merge key, each unmerged original key, and the value of each data item.
[0101] Optionally, the traversal module 302 is further configured to read each data item in the dictionary data structure to obtain a complete path of each data item; identify each node in the complete path of each data item, and determine each original key of each data item.
[0102] Optionally, when the dictionary data structure includes at least one branch, the traversal module 302 is further configured to determine a root node of the dictionary data structure; based on the root node, cyclically read each data item under each branch of the dictionary data structure to obtain a complete path for each data item.
[0103] Optionally, the merging module 304 is also used to identify the category of each original key of any current item in each data item, and determine each original key with the same category as each key to be merged of the current item; merge each key to be merged of the current item to generate at least one merged key of the current item.
[0104] Optionally, the merging module 304 is also used to determine a target category based on the category of each key to be merged of the current item, and determine each key to be merged corresponding to the target category as a target key; create a connector between each pair of adjacent target keys, and generate a merge key for the current item corresponding to the target category based on each target key connected by the connector.
[0105] Optionally, the conversion module 306 is further used to integrate the two-dimensional data structure of each data item, generate a data source list containing all data items, and generate each cell value in the data source list based on each merge key, each unmerged original key and the value of each data item; according to actual analysis requirements, determine a data column in the data source list as a target column; based on the target column of the data source list, the number of rows and the number of columns of each cell value, perform row-to-column conversion on the data source list to generate a pivot table that meets the actual analysis requirements.
[0106] Optionally, the two-dimensional data structure of each data item includes a data frame structure.
[0107] It should be noted that the information interaction, execution process, etc. between the various units in the above-mentioned data structure conversion device are based on the same concept as the above-mentioned data structure conversion method embodiment. The specific content can be found in the description of the above-mentioned data structure conversion method embodiment and will not be repeated here.
[0108] electronic devices
[0109] FIG4 is a schematic diagram of an electronic device provided in Example 4 of the present application. The specific embodiments of the present application do not limit the specific implementation of the electronic device. Referring to FIG4 , the electronic device 400 provided in the embodiment of the present application includes: a processor 402, a communications interface 404, a memory 406, and a bus 408. Among them:
[0110] The processor 402 , the communication interface 404 , and the memory 406 communicate with each other via a bus 408 .
[0111] The communication interface 404 is used to communicate with other electronic devices or servers.
[0112] The processor 402 is configured to execute the program 410 , and specifically may execute the relevant steps in the above-mentioned data structure conversion method embodiment.
[0113] Specifically, the program 410 may include program codes, which include computer operation instructions.
[0114] Processor 402 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application. The one or more processors included in the smart device may be processors of the same type, such as one or more CPUs, or may be processors of different types, such as one or more CPUs and one or more ASICs.
[0115] The memory 406 is used to store the program 410. The memory 406 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0116] The program 410 may be specifically configured to enable the processor 402 to execute the data structure conversion method in any of the aforementioned embodiments.
[0117] The specific implementation of each step in program 410 can be found in the corresponding descriptions of the corresponding steps and units in the above-mentioned data structure conversion method embodiment, and will not be repeated here. Those skilled in the art will clearly understand that for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding process descriptions in the above-mentioned method embodiment, and will not be repeated here.
[0118] Computer-readable storage medium
[0119] The present application also provides a computer-readable storage medium storing instructions for causing a machine to execute the data structure conversion method described herein. Specifically, a system or device equipped with a storage medium can be provided, on which software program code implementing the functions of any of the above-described embodiments is stored, and a computer (or CPU or MPU) of the system or device can read and execute the program code stored in the storage medium.
[0120] In this case, the program code read from the storage medium itself can realize the function of any one of the above embodiments, so the program code and the storage medium storing the program code constitute part of this application.
[0121] Examples of storage media for providing program code include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), magnetic tapes, non-volatile memory cards, and ROMs. Alternatively, the program code can be downloaded from a server computer via a communication network.
[0122] Computer program product
[0123] An embodiment of the present application also provides a computer program product, including computer instructions, which instruct a computing device to perform any corresponding operation in the above-mentioned multiple method embodiments.
[0124] It should be pointed out that, according to the needs of implementation, the various components / steps described in the embodiments of the present application can be split into more components / steps, or two or more components / steps or partial operations of components / steps can be combined into new components / steps to achieve the purpose of the embodiments of the present application.
[0125] The above-mentioned method according to the embodiment of the present application can be implemented in hardware, firmware, or can be implemented as software or computer code that can be stored in a recording medium (such as CD ROM, RAM, floppy disk, hard disk or magneto-optical disk), or can be implemented as computer code that is originally stored in a remote recording medium or a non-temporary machine-readable medium downloaded via a network and will be stored in a local recording medium, so that the method described herein can be stored in such software processing on a recording medium using a general-purpose computer, a special-purpose processor or programmable or special-purpose hardware (such as ASIC or FPGA). It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component (e.g., RAM, ROM, flash memory, etc.) that can store or receive software or computer code, and when the software or computer code is accessed and executed by a computer, a processor or hardware, the method described herein is implemented. In addition, when a general-purpose computer accesses the code for implementing the method shown here, the execution of the code converts the general-purpose computer into a special-purpose computer for executing the method shown here.
[0126] It should be noted that not all steps and modules in the above processes and system structure diagrams are required, and certain steps or modules can be omitted according to actual needs. The execution order of each step is not fixed and can be adjusted as needed. The system structure described in the above embodiments can be a physical structure or a logical structure, that is, some modules may be implemented by the same physical entity, or some modules may be implemented by multiple physical entities, or may be implemented by certain components in multiple independent devices.
[0127] Nouns and pronouns referring to persons in this patent application are not limited to a specific gender.
[0128] In the above embodiments, the hardware module can be implemented mechanically or electrically. For example, a hardware module can include a permanent dedicated circuit or logic (such as a dedicated processor, FPGA or ASIC) to complete the corresponding operation. The hardware module can also include programmable logic or circuits (such as a general-purpose processor or other programmable processors), which can be temporarily set by software to complete the corresponding operation. The specific implementation method (mechanical method, or dedicated permanent circuit, or temporarily set circuit) can be determined based on cost and time considerations.
[0129] The present invention has been shown and described in detail above through the accompanying drawings and preferred embodiments. However, the present invention is not limited to these disclosed embodiments. Based on the above multiple embodiments, those skilled in the art can know that the code review methods in the above different embodiments can be combined to obtain more embodiments of the present invention, and these embodiments are also within the scope of protection of the present invention.
[0130] Nouns and pronouns referring to persons in this patent application are not limited to a specific gender.
Claims
1. A data structure conversion method (100), comprising: Traversing each data item in the dictionary data structure, determining a plurality of original keys and a value for each data item (102); Merging at least two of the plurality of original keys for each data item to generate at least one merged key for each data item (104); A two-dimensional data structure (106) is generated for each data item based on at least one merge key of each data item, each original key that was not merged, and the value.
2. The method (100) according to claim 1, wherein: Each original key for each data item is determined by: Read each data item in the dictionary data structure to obtain a complete path for each data item; Each node in the complete path of each data item is identified, and each original key of each data item is determined.
3. The method (100) according to claim 2, wherein: In the case where the dictionary data structure includes at least one branch, reading each data item in the dictionary data structure to obtain a complete path of each data item includes: Determining a root node of the dictionary data structure; Based on the root node, each data item under each branch of the dictionary data structure is read cyclically to obtain a complete path of each data item.
4. The method (100) according to any one of claims 1 to 3, wherein: The step of merging at least two of the multiple original keys of each data item to generate at least one merged key for each data item includes: For any current item in each data item, Identify the category of each original key of the current item, and determine each original key with the same category as each to-be-merged key of the current item; Each to-be-merged key of the current item is merged to generate at least one merged key of the current item.
5. The method (100) according to claim 4, wherein: Generate a merge key for the current item in the following way: Determine a target category according to the category of each to-be-merged key of the current item, and determine each to-be-merged key corresponding to the target category as a target key; A connector is created between each pair of two adjacent target keys, and a merge key corresponding to the target category of the current item is generated based on each target key connected by the connector.
6. The method (100) of claim 1, wherein: The method (100) further comprises: Integrate the two-dimensional data structure of each data item to generate a data source list containing all data items, and generate each unit value in the data source list according to each merge key, each unmerged original key and the value of each data item; According to actual analysis requirements, a data column in the data source list is determined as a target column; Based on the target column, the number of rows and the number of columns of each cell value of the data source list, the data source list is executed The rows and columns are transformed to generate a pivot table that meets the actual analysis needs.
7. The method (100) according to claim 1 or 6, wherein: The two-dimensional data structure of each data item includes a data frame structure.
8. A data structure conversion device (300), comprising: A traversal module (302) is used to traverse each data item in the dictionary data structure and determine a plurality of original keys and a value for each data item; A merge module (304) for merging at least two of the plurality of original keys of each data item to generate at least one merged key for each data item; The conversion module (306) is used to generate a two-dimensional data structure for each data item according to at least one merge key of each data item, each original key that has not been merged, and the value.
9. An electronic device (400), comprising: A processor (402), a communication interface (404), a memory (406) and a bus (408), wherein the processor (402), the communication interface (404) and the memory (406) communicate with each other via the bus (408); The memory (406) is used to store at least one program (410), and the program (410) enables the processor to perform operations corresponding to the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having computer instructions stored thereon, wherein when the computer instructions are executed by a processor, the processor is caused to execute the method (100) as claimed in any one of claims 1 to 7.
11. A computer program product, comprising computer instructions, wherein the computer instructions instruct a computing device to execute operations corresponding to the method (100) according to any one of claims 1 to 7.
Citation Information
Patent Citations
Data storage method, data storage device, electronic equipment and storage medium
CN110399104A
Nested data merging method and device and electronic equipment
CN110516122A
Data type mapping processing method and device, equipment, medium and product
CN114661726A
Data processing method and system
CN115291860A
Term consolidation for indices
US20150278261A1