{"id":2225,"date":"2019-09-13T11:35:28","date_gmt":"2019-09-13T09:35:28","guid":{"rendered":"http:\/\/jakisproblem.pl\/?p=2225"},"modified":"2019-09-13T11:35:28","modified_gmt":"2019-09-13T09:35:28","slug":"joining-dataframes-in-pandas","status":"publish","type":"post","link":"http:\/\/u239160.webh.me\/jakisproblem.pl\/index.php\/2019\/09\/13\/joining-dataframes-in-pandas\/","title":{"rendered":"Joining DataFrames in Pandas"},"content":{"rendered":"\n<p>In this tutorial, you\u2019ll learn various ways in which multiple DataFrames could be merged in python using Pandas library.<\/p>\n\n\n\n<p>Have you ever tried solving a Kaggle challenge? If yes, you might have noticed that in most of the challenges, the data provided to you is present in multiple files, with some of the columns present in more than one files. Well, what is the first thing that comes to your mind? Join them of course!<\/p>\n\n\n\n<p>Joining and merging DataFrames is the core process to start with data analysis and machine learning tasks. It is one of the toolkits which every Data Analyst or Data Scientist should master because in almost all the cases data comes from multiple source and files. You may need to bring all the data in one place by some sort of join logic and then start your analysis. People who work with SQL like query languages might know the importance of this task. Even if you want to build some machine learning models on some data, you may need to merge multiple&nbsp;<code>csv<\/code>&nbsp;files together in a single DataFrame.<\/p>\n\n\n\n<p>Thankfully you have the most popular library in python,&nbsp;<code>pandas<\/code>&nbsp;to your rescue!&nbsp;<code>pandas<\/code>&nbsp;provides various facilities for easily combining together Series, DataFrames, and Panel objects with various kinds of set logic for the indexes and relational algebra functionality in the case of join \/ merge-type operations.<\/p>\n\n\n\n<p>In this tutorial, you will practice a few standard techniques. More specifically, you will learn to:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Concatenate DataFrames along row and column.<\/li><li>Merge DataFrames on specific keys by different join logics like left-join, inner-join, etc.<\/li><li>Time-series friendly merging provided in pandas<\/li><\/ul>\n\n\n\n<p>Along the way, you will also learn a few tricks which you require before and after joining.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"concatenate-dataframes\">Concatenate DataFrames<\/h2>\n\n\n\n<p>Start by importing the library you will be using throughout the tutorial:&nbsp;<code>pandas<\/code><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import pandas as pd\n<\/code><\/pre>\n\n\n\n<p>You will be performing all the operations in this tutorial on the dummy DataFrames that you will create. To create a DataFrame you can use python dictionary like:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dummy_data1 = {\n        'id': ['1', '2', '3', '4', '5'],\n        'Feature1': ['A', 'C', 'E', 'G', 'I'],\n        'Feature2': ['B', 'D', 'F', 'H', 'J']}\n<\/code><\/pre>\n\n\n\n<p>Here the keys of the dictionary&nbsp;<code>dummy_data1<\/code>&nbsp;are the column names and the values in the list are the data corresponding to each observation or row. To transform this into a pandas DataFrame, you will use the&nbsp;<code>DataFrame()<\/code>&nbsp;function of pandas, along with its&nbsp;<code>columns<\/code>&nbsp;argument to name your columns:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>df1 = pd.DataFrame(dummy_data1, columns = ['id', 'Feature1', 'Feature2'])\n\ndf1\n<\/code><\/pre>\n\n\n\n<table class=\"wp-block-table\"><thead><tr><th>id<\/th><th>Feature1<\/th><th>Feature2<\/th><\/tr><\/thead><tbody><tr><th>0<\/th><td>1<\/td><td>A<\/td><td>B<\/td><\/tr><tr><th>1<\/th><td>2<\/td><td>C<\/td><td>D<\/td><\/tr><tr><th>2<\/th><td>3<\/td><td>E<\/td><td>F<\/td><\/tr><tr><th>3<\/th><td>4<\/td><td>G<\/td><td>H<\/td><\/tr><tr><th>4<\/th><td>5<\/td><td>I<\/td><td>J<\/td><\/tr><\/tbody><\/table>\n\n\n\n<p>As you can notice, you now have a DataFrame with 3 columns&nbsp;<code>id<\/code>,&nbsp;<code>Feature1<\/code>, and&nbsp;<code>Feature2<\/code>. There is an additional un-named column which pandas intrinsically creates as the row labels. Similar to the previous DataFrame&nbsp;<code>df1<\/code>, you will create two more DataFrames&nbsp;<code>df2<\/code>&nbsp;and&nbsp;<code>df3<\/code>&nbsp;:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dummy_data2 = {\n        'id': ['1', '2', '6', '7', '8'],\n        'Feature1': ['K', 'M', 'O', 'Q', 'S'],\n        'Feature2': ['L', 'N', 'P', 'R', 'T']}\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>df2 = pd.DataFrame(dummy_data2, columns = ['id', 'Feature1', 'Feature2'])\n\ndf2\n<\/code><\/pre>\n\n\n\n<table class=\"wp-block-table\"><thead><tr><th>id<\/th><th>Feature1<\/th><th>Feature2<\/th><\/tr><\/thead><tbody><tr><th>0<\/th><td>1<\/td><td>K<\/td><td>L<\/td><\/tr><tr><th>1<\/th><td>2<\/td><td>M<\/td><td>N<\/td><\/tr><tr><th>2<\/th><td>6<\/td><td>O<\/td><td>P<\/td><\/tr><tr><th>3<\/th><td>7<\/td><td>Q<\/td><td>R<\/td><\/tr><tr><th>4<\/th><td>8<\/td><td>S<\/td><td>T<\/td><\/tr><\/tbody><\/table>\n\n\n\n<pre class=\"wp-block-code\"><code>dummy_data3 = {\n        'id': ['1', '2', '3', '4', '5', '7', '8', '9', '10', '11'],\n        'Feature3': [12, 13, 14, 15, 16, 17, 15, 12, 13, 23]}\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>df3 = pd.DataFrame(dummy_data3, columns = ['id', 'Feature3'])\n\ndf3\n<\/code><\/pre>\n\n\n\n<table class=\"wp-block-table\"><thead><tr><th>id<\/th><th>Feature3<\/th><\/tr><\/thead><tbody><tr><th>0<\/th><td>1<\/td><td>12<\/td><\/tr><tr><th>1<\/th><td>2<\/td><td>13<\/td><\/tr><tr><th>2<\/th><td>3<\/td><td>14<\/td><\/tr><tr><th>3<\/th><td>4<\/td><td>15<\/td><\/tr><tr><th>4<\/th><td>5<\/td><td>16<\/td><\/tr><tr><th>5<\/th><td>7<\/td><td>17<\/td><\/tr><tr><th>6<\/th><td>8<\/td><td>15<\/td><\/tr><tr><th>7<\/th><td>9<\/td><td>12<\/td><\/tr><tr><th>8<\/th><td>10<\/td><td>13<\/td><\/tr><tr><th>9<\/th><td>11<\/td><td>23<\/td><\/tr><\/tbody><\/table>\n\n\n\n<p>To simply concatenate the DataFrames along the row you can use the&nbsp;<code>concat()<\/code>&nbsp;function in&nbsp;<code>pandas<\/code>. You will have to pass the names of the DataFrames in a list as the argument to the&nbsp;<code>concat()<\/code>&nbsp;function:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>df_row = pd.concat([df1, df2])\n\ndf_row\n<\/code><\/pre>\n\n\n\n<table class=\"wp-block-table\"><thead><tr><th>id<\/th><th>Feature1<\/th><th>Feature2<\/th><\/tr><\/thead><tbody><tr><th>0<\/th><td>1<\/td><td>A<\/td><td>B<\/td><\/tr><tr><th>1<\/th><td>2<\/td><td>C<\/td><td>D<\/td><\/tr><tr><th>2<\/th><td>3<\/td><td>E<\/td><td>F<\/td><\/tr><tr><th>3<\/th><td>4<\/td><td>G<\/td><td>H<\/td><\/tr><tr><th>4<\/th><td>5<\/td><td>I<\/td><td>J<\/td><\/tr><tr><th>0<\/th><td>1<\/td><td>K<\/td><td>L<\/td><\/tr><tr><th>1<\/th><td>2<\/td><td>M<\/td><td>N<\/td><\/tr><tr><th>2<\/th><td>6<\/td><td>O<\/td><td>P<\/td><\/tr><tr><th>3<\/th><td>7<\/td><td>Q<\/td><td>R<\/td><\/tr><tr><th>4<\/th><td>8<\/td><td>S<\/td><td>T<\/td><\/tr><\/tbody><\/table>\n\n\n\n<p>You can notice that the two DataFrames&nbsp;<code>df1<\/code>&nbsp;and&nbsp;<code>df2<\/code>&nbsp;are now concatenated into a single DataFrame&nbsp;<code>df_row<\/code>&nbsp;along the row. However, the row labels seem to be wrong! If you want the row labels to adjust automatically according to the join, you will have to set the argument&nbsp;<code>ignore_index<\/code>&nbsp;as&nbsp;<code>True<\/code>&nbsp;while calling the&nbsp;<code>concat()<\/code>&nbsp;function:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>df_row_reindex = pd.concat([df1, df2], ignore_index=True)\n\ndf_row_reindex\n<\/code><\/pre>\n\n\n\n<table class=\"wp-block-table\"><thead><tr><th>id<\/th><th>Feature1<\/th><th>Feature2<\/th><\/tr><\/thead><tbody><tr><th>0<\/th><td>1<\/td><td>A<\/td><td>B<\/td><\/tr><tr><th>1<\/th><td>2<\/td><td>C<\/td><td>D<\/td><\/tr><tr><th>2<\/th><td>3<\/td><td>E<\/td><td>F<\/td><\/tr><tr><th>3<\/th><td>4<\/td><td>G<\/td><td>H<\/td><\/tr><tr><th>4<\/th><td>5<\/td><td>I<\/td><td>J<\/td><\/tr><tr><th>5<\/th><td>1<\/td><td>K<\/td><td>L<\/td><\/tr><tr><th>6<\/th><td>2<\/td><td>M<\/td><td>N<\/td><\/tr><tr><th>7<\/th><td>6<\/td><td>O<\/td><td>P<\/td><\/tr><tr><th>8<\/th><td>7<\/td><td>Q<\/td><td>R<\/td><\/tr><tr><th>9<\/th><td>8<\/td><td>S<\/td><td>T<\/td><\/tr><\/tbody><\/table>\n\n\n\n<p>Now the row labels are correct!<\/p>\n\n\n\n<p><code>pandas<\/code>&nbsp;also provides you with an option to label the DataFrames, after the concatenation, with a key so that you may know which data came from which DataFrame. You can achieve the same by passing additional argument&nbsp;<code>keys<\/code>&nbsp;specifying the label names of the DataFrames in a list. Here you will perform the same concatenation with keys as&nbsp;<code>x<\/code>&nbsp;and&nbsp;<code>y<\/code>&nbsp;for DataFrames&nbsp;<code>df1<\/code>&nbsp;and&nbsp;<code>df2<\/code>respectively.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>frames = [df1,df2]\ndf_keys = pd.concat(frames, keys=['x', 'y'])\n\ndf_keys\n<\/code><\/pre>\n\n\n\n<table class=\"wp-block-table\"><thead><tr><th>id<\/th><th>Feature1<\/th><th>Feature2<\/th><\/tr><\/thead><tbody><tr><th>x<\/th><th>0<\/th><td>1<\/td><td>A<\/td><td>B<\/td><\/tr><tr><th>1<\/th><td>2<\/td><td>C<\/td><td>D<\/td><\/tr><tr><th>2<\/th><td>3<\/td><td>E<\/td><td>F<\/td><\/tr><tr><th>3<\/th><td>4<\/td><td>G<\/td><td>H<\/td><\/tr><tr><th>4<\/th><td>5<\/td><td>I<\/td><td>J<\/td><\/tr><tr><th>y<\/th><th>0<\/th><td>1<\/td><td>K<\/td><td>L<\/td><\/tr><tr><th>1<\/th><td>2<\/td><td>M<\/td><td>N<\/td><\/tr><tr><th>2<\/th><td>6<\/td><td>O<\/td><td>P<\/td><\/tr><tr><th>3<\/th><td>7<\/td><td>Q<\/td><td>R<\/td><\/tr><tr><th>4<\/th><td>8<\/td><td>S<\/td><td>T<\/td><\/tr><\/tbody><\/table>\n\n\n\n<p>Mentioning the keys also makes it easy to retrieve data corresponding to a particular DataFrame. You can retrieve the data of DataFrame&nbsp;<code>df2<\/code>&nbsp;which had the label&nbsp;<code>y<\/code>&nbsp;by using the&nbsp;<code>loc<\/code>&nbsp;method:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>df_keys.loc['y']\n<\/code><\/pre>\n\n\n\n<table class=\"wp-block-table\"><thead><tr><th>id<\/th><th>Feature1<\/th><th>Feature2<\/th><\/tr><\/thead><tbody><tr><th>0<\/th><td>1<\/td><td>K<\/td><td>L<\/td><\/tr><tr><th>1<\/th><td>2<\/td><td>M<\/td><td>N<\/td><\/tr><tr><th>2<\/th><td>6<\/td><td>O<\/td><td>P<\/td><\/tr><tr><th>3<\/th><td>7<\/td><td>Q<\/td><td>R<\/td><\/tr><tr><th>4<\/th><td>8<\/td><td>S<\/td><td>T<\/td><\/tr><\/tbody><\/table>\n\n\n\n<p>You can also pass a dictionary to&nbsp;<code>concat()<\/code>, in which case the dictionary keys will be used for the&nbsp;<code>keys<\/code>&nbsp;argument (unless other keys are specified):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pieces = {'x': df1, 'y': df2}\n\ndf_piece = pd.concat(pieces)\n\ndf_piece\n<\/code><\/pre>\n\n\n\n<table class=\"wp-block-table\"><thead><tr><th>id<\/th><th>Feature1<\/th><th>Feature2<\/th><\/tr><\/thead><tbody><tr><th>x<\/th><th>0<\/th><td>1<\/td><td>A<\/td><td>B<\/td><\/tr><tr><th>1<\/th><td>2<\/td><td>C<\/td><td>D<\/td><\/tr><tr><th>2<\/th><td>3<\/td><td>E<\/td><td>F<\/td><\/tr><tr><th>3<\/th><td>4<\/td><td>G<\/td><td>H<\/td><\/tr><tr><th>4<\/th><td>5<\/td><td>I<\/td><td>J<\/td><\/tr><tr><th>y<\/th><th>0<\/th><td>1<\/td><td>K<\/td><td>L<\/td><\/tr><tr><th>1<\/th><td>2<\/td><td>M<\/td><td>N<\/td><\/tr><tr><th>2<\/th><td>6<\/td><td>O<\/td><td>P<\/td><\/tr><tr><th>3<\/th><td>7<\/td><td>Q<\/td><td>R<\/td><\/tr><tr><th>4<\/th><td>8<\/td><td>S<\/td><td>T<\/td><\/tr><\/tbody><\/table>\n\n\n\n<p>It is worth noting that&nbsp;<code>concat()<\/code>&nbsp;makes a full copy of the data, and continuosly reusing this function can create a significant performance hit. If you need to use the operation over several datasets, use a list comprehension.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>frames = [ process_your_file(f) for f in files ]\nresult = pd.concat(frames)\n<\/code><\/pre>\n\n\n\n<p>To concatenate DataFrames along column, you can specify the&nbsp;<code>axis<\/code>&nbsp;parameter as&nbsp;<code>1<\/code>&nbsp;:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>df_col = pd.concat([df1,df2], axis=1)\n\ndf_col\n<\/code><\/pre>\n\n\n\n<table class=\"wp-block-table\"><thead><tr><th>id<\/th><th>Feature1<\/th><th>Feature2<\/th><th>id<\/th><th>Feature1<\/th><th>Feature2<\/th><\/tr><\/thead><tbody><tr><th>0<\/th><td>1<\/td><td>A<\/td><td>B<\/td><td>1<\/td><td>K<\/td><td>L<\/td><\/tr><tr><th>1<\/th><td>2<\/td><td>C<\/td><td>D<\/td><td>2<\/td><td>M<\/td><td>N<\/td><\/tr><tr><th>2<\/th><td>3<\/td><td>E<\/td><td>F<\/td><td>6<\/td><td>O<\/td><td>P<\/td><\/tr><tr><th>3<\/th><td>4<\/td><td>G<\/td><td>H<\/td><td>7<\/td><td>Q<\/td><td>R<\/td><\/tr><tr><th>4<\/th><td>5<\/td><td>I<\/td><td>J<\/td><td>8<\/td><td>S<\/td><td>T<\/td><\/tr><\/tbody><\/table>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"merge-dataframes\">Merge DataFrames<\/h2>\n\n\n\n<p>Another ubiquitous operation related to DataFrames is the merging operation. Two DataFrames might hold different kinds of information about the same entity and linked by some common feature\/column. To join these DataFrames, pandas provides multiple functions like&nbsp;<code>concat()<\/code>,&nbsp;<code>merge()<\/code>&nbsp;,&nbsp;<code>join()<\/code>, etc. In this section, you will practice using&nbsp;<code>merge()<\/code>&nbsp;function of pandas.<\/p>\n\n\n\n<p>You can join DataFrames&nbsp;<code>df_row<\/code>&nbsp;(which you created by concatenating&nbsp;<code>df1<\/code>&nbsp;and&nbsp;<code>df2<\/code>&nbsp;along the row) and&nbsp;<code>df3<\/code>&nbsp;on the common column (or key)&nbsp;<code>id<\/code>. To do so, pass the names of the DataFrames and an additional argument&nbsp;<code>on<\/code>&nbsp;as the name of the common column, here&nbsp;<code>id<\/code>, to the&nbsp;<code>merge()<\/code>function:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>df_merge_col = pd.merge(df_row, df3, on='id')\n\ndf_merge_col\n<\/code><\/pre>\n\n\n\n<table class=\"wp-block-table\"><thead><tr><th>id<\/th><th>Feature1<\/th><th>Feature2<\/th><th>Feature3<\/th><\/tr><\/thead><tbody><tr><th>0<\/th><td>1<\/td><td>A<\/td><td>B<\/td><td>12<\/td><\/tr><tr><th>1<\/th><td>1<\/td><td>K<\/td><td>L<\/td><td>12<\/td><\/tr><tr><th>2<\/th><td>2<\/td><td>C<\/td><td>D<\/td><td>13<\/td><\/tr><tr><th>3<\/th><td>2<\/td><td>M<\/td><td>N<\/td><td>13<\/td><\/tr><tr><th>4<\/th><td>3<\/td><td>E<\/td><td>F<\/td><td>14<\/td><\/tr><tr><th>5<\/th><td>4<\/td><td>G<\/td><td>H<\/td><td>15<\/td><\/tr><tr><th>6<\/th><td>5<\/td><td>I<\/td><td>J<\/td><td>16<\/td><\/tr><tr><th>7<\/th><td>7<\/td><td>Q<\/td><td>R<\/td><td>17<\/td><\/tr><tr><th>8<\/th><td>8<\/td><td>S<\/td><td>T<\/td><td>15<\/td><\/tr><\/tbody><\/table>\n\n\n\n<p>You can notice that the DataFrames are now merged into a single DataFrame based on the common values present in the&nbsp;<code>id<\/code>&nbsp;column of both the DataFrames. For example, here&nbsp;<code>id<\/code>&nbsp;value&nbsp;<code>1<\/code>was present with both&nbsp;<code>A<\/code>,&nbsp;<code>B<\/code>&nbsp;and&nbsp;<code>K<\/code>,&nbsp;<code>L<\/code>&nbsp;in the DataFrame&nbsp;<code>df_row<\/code>&nbsp;hence this&nbsp;<code>id<\/code>&nbsp;got repeated twice in the final DataFrame&nbsp;<code>df_merge_col<\/code>&nbsp;with repeated value&nbsp;<code>12<\/code>&nbsp;of&nbsp;<code>Feature3<\/code>&nbsp;which came from DataFrame&nbsp;<code>df3<\/code>.<\/p>\n\n\n\n<p>It might happen that the column on which you want to merge the DataFrames have different names (unlike in this case). For such merges, you will have to specify the arguments&nbsp;<code>left_on<\/code>&nbsp;as the left DataFrame name and&nbsp;<code>right_on<\/code>&nbsp;as the right DataFrame name, like :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>df_merge_difkey = pd.merge(df_row, df3, left_on='id', right_on='id')\n\ndf_merge_difkey\n<\/code><\/pre>\n\n\n\n<table class=\"wp-block-table\"><thead><tr><th>id<\/th><th>Feature1<\/th><th>Feature2<\/th><th>Feature3<\/th><\/tr><\/thead><tbody><tr><th>0<\/th><td>1<\/td><td>A<\/td><td>B<\/td><td>12<\/td><\/tr><tr><th>1<\/th><td>1<\/td><td>K<\/td><td>L<\/td><td>12<\/td><\/tr><tr><th>2<\/th><td>2<\/td><td>C<\/td><td>D<\/td><td>13<\/td><\/tr><tr><th>3<\/th><td>2<\/td><td>M<\/td><td>N<\/td><td>13<\/td><\/tr><tr><th>4<\/th><td>3<\/td><td>E<\/td><td>F<\/td><td>14<\/td><\/tr><tr><th>5<\/th><td>4<\/td><td>G<\/td><td>H<\/td><td>15<\/td><\/tr><tr><th>6<\/th><td>5<\/td><td>I<\/td><td>J<\/td><td>16<\/td><\/tr><tr><th>7<\/th><td>7<\/td><td>Q<\/td><td>R<\/td><td>17<\/td><\/tr><tr><th>8<\/th><td>8<\/td><td>S<\/td><td>T<\/td><td>15<\/td><\/tr><\/tbody><\/table>\n\n\n\n<p>You can also append rows to a DataFrame by passing a Series or dict to&nbsp;<code>append()<\/code>&nbsp;function which returns a new DataFrame:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>add_row = pd.Series(['10', 'X1', 'X2', 'X3'],\n                    index=['id','Feature1', 'Feature2', 'Feature3'])\n\ndf_add_row = df_merge_col.append(add_row, ignore_index=True)\n\ndf_add_row\n<\/code><\/pre>\n\n\n\n<table class=\"wp-block-table\"><thead><tr><th>id<\/th><th>Feature1<\/th><th>Feature2<\/th><th>Feature3<\/th><\/tr><\/thead><tbody><tr><th>0<\/th><td>1<\/td><td>A<\/td><td>B<\/td><td>12<\/td><\/tr><tr><th>1<\/th><td>1<\/td><td>K<\/td><td>L<\/td><td>12<\/td><\/tr><tr><th>2<\/th><td>2<\/td><td>C<\/td><td>D<\/td><td>13<\/td><\/tr><tr><th>3<\/th><td>2<\/td><td>M<\/td><td>N<\/td><td>13<\/td><\/tr><tr><th>4<\/th><td>3<\/td><td>E<\/td><td>F<\/td><td>14<\/td><\/tr><tr><th>5<\/th><td>4<\/td><td>G<\/td><td>H<\/td><td>15<\/td><\/tr><tr><th>6<\/th><td>5<\/td><td>I<\/td><td>J<\/td><td>16<\/td><\/tr><tr><th>7<\/th><td>7<\/td><td>Q<\/td><td>R<\/td><td>17<\/td><\/tr><tr><th>8<\/th><td>8<\/td><td>S<\/td><td>T<\/td><td>15<\/td><\/tr><tr><th>9<\/th><td>10<\/td><td>X1<\/td><td>X2<\/td><td>X3<\/td><\/tr><\/tbody><\/table>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"join-dataframes\">Join DataFrames<\/h2>\n\n\n\n<p>In this section, you will practice the various join logics available to merge pandas DataFrames based on some common column\/key. The logic behind these joins is very much the same that you have in SQL when you join tables.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"full-outer-join\">Full Outer Join<\/h3>\n\n\n\n<p>The&nbsp;<code>FULL OUTER JOIN<\/code>&nbsp;combines the results of both the left and the right outer joins. The joined DataFrame will contain all records from both the DataFrames and fill in&nbsp;<code>NaN<\/code>s for missing matches on either side. You can perform a full outer join by specifying the&nbsp;<code>how<\/code>&nbsp;argument as&nbsp;<code>outer<\/code>&nbsp;in the&nbsp;<code>merge()<\/code>&nbsp;function:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>df_outer = pd.merge(df1, df2, on='id', how='outer')\n\ndf_outer\n<\/code><\/pre>\n\n\n\n<table class=\"wp-block-table\"><thead><tr><th>id<\/th><th>Feature1_x<\/th><th>Feature2_x<\/th><th>Feature1_y<\/th><th>Feature2_y<\/th><\/tr><\/thead><tbody><tr><th>0<\/th><td>1<\/td><td>A<\/td><td>B<\/td><td>K<\/td><td>L<\/td><\/tr><tr><th>1<\/th><td>2<\/td><td>C<\/td><td>D<\/td><td>M<\/td><td>N<\/td><\/tr><tr><th>2<\/th><td>3<\/td><td>E<\/td><td>F<\/td><td>NaN<\/td><td>NaN<\/td><\/tr><tr><th>3<\/th><td>4<\/td><td>G<\/td><td>H<\/td><td>NaN<\/td><td>NaN<\/td><\/tr><tr><th>4<\/th><td>5<\/td><td>I<\/td><td>J<\/td><td>NaN<\/td><td>NaN<\/td><\/tr><tr><th>5<\/th><td>6<\/td><td>NaN<\/td><td>NaN<\/td><td>O<\/td><td>P<\/td><\/tr><tr><th>6<\/th><td>7<\/td><td>NaN<\/td><td>NaN<\/td><td>Q<\/td><td>R<\/td><\/tr><tr><th>7<\/th><td>8<\/td><td>NaN<\/td><td>NaN<\/td><td>S<\/td><td>T<\/td><\/tr><\/tbody><\/table>\n\n\n\n<p>You can notice that the resulting DataFrame had all the entries from both the tables with&nbsp;<code>NaN<\/code>values for missing matches on either side. However, one more thing to notice is the suffix which got appended to the column names to show which column came from which DataFrame. The default suffixes are&nbsp;<code>x<\/code>&nbsp;and&nbsp;<code>y<\/code>, however, you can modify them by specifying the&nbsp;<code>suffixes<\/code>argument in the&nbsp;<code>merge()<\/code>&nbsp;function:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>df_suffix = pd.merge(df1, df2, left_on='id',right_on='id',how='outer',suffixes=('_left','_right'))\n\ndf_suffix\n<\/code><\/pre>\n\n\n\n<table class=\"wp-block-table\"><thead><tr><th>id<\/th><th>Feature1_left<\/th><th>Feature2_left<\/th><th>Feature1_right<\/th><th>Feature2_right<\/th><\/tr><\/thead><tbody><tr><th>0<\/th><td>1<\/td><td>A<\/td><td>B<\/td><td>K<\/td><td>L<\/td><\/tr><tr><th>1<\/th><td>2<\/td><td>C<\/td><td>D<\/td><td>M<\/td><td>N<\/td><\/tr><tr><th>2<\/th><td>3<\/td><td>E<\/td><td>F<\/td><td>NaN<\/td><td>NaN<\/td><\/tr><tr><th>3<\/th><td>4<\/td><td>G<\/td><td>H<\/td><td>NaN<\/td><td>NaN<\/td><\/tr><tr><th>4<\/th><td>5<\/td><td>I<\/td><td>J<\/td><td>NaN<\/td><td>NaN<\/td><\/tr><tr><th>5<\/th><td>6<\/td><td>NaN<\/td><td>NaN<\/td><td>O<\/td><td>P<\/td><\/tr><tr><th>6<\/th><td>7<\/td><td>NaN<\/td><td>NaN<\/td><td>Q<\/td><td>R<\/td><\/tr><tr><th>7<\/th><td>8<\/td><td>NaN<\/td><td>NaN<\/td><td>S<\/td><td>T<\/td><\/tr><\/tbody><\/table>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"inner-join\">Inner Join<\/h3>\n\n\n\n<p>The&nbsp;<code>INNER JOIN<\/code>&nbsp;produces only the set of records that match in both DataFrame A and DataFrame B. You have to pass&nbsp;<code>inner<\/code>&nbsp;in the&nbsp;<code>how<\/code>&nbsp;argument of&nbsp;<code>merge()<\/code>&nbsp;function to do inner join:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>df_inner = pd.merge(df1, df2, on='id', how='inner')\n\ndf_inner\n<\/code><\/pre>\n\n\n\n<table class=\"wp-block-table\"><thead><tr><th>id<\/th><th>Feature1_x<\/th><th>Feature2_x<\/th><th>Feature1_y<\/th><th>Feature2_y<\/th><\/tr><\/thead><tbody><tr><th>0<\/th><td>1<\/td><td>A<\/td><td>B<\/td><td>K<\/td><td>L<\/td><\/tr><tr><th>1<\/th><td>2<\/td><td>C<\/td><td>D<\/td><td>M<\/td><td>N<\/td><\/tr><\/tbody><\/table>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"right-join\">Right Join<\/h3>\n\n\n\n<p>The&nbsp;<code>RIGHT JOIN<\/code>&nbsp;produces a complete set of records from DataFrame B (right DataFrame), with the matching records (where available) in DataFrame A (left DataFrame). If there is no match, the right side will contain null. You have to pass&nbsp;<code>right<\/code>&nbsp;in the&nbsp;<code>how<\/code>&nbsp;argument of&nbsp;<code>merge()<\/code>&nbsp;function to do right join:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>df_right = pd.merge(df1, df2, on='id', how='right')\n\ndf_right\n<\/code><\/pre>\n\n\n\n<table class=\"wp-block-table\"><thead><tr><th>id<\/th><th>Feature1_x<\/th><th>Feature2_x<\/th><th>Feature1_y<\/th><th>Feature2_y<\/th><\/tr><\/thead><tbody><tr><th>0<\/th><td>1<\/td><td>A<\/td><td>B<\/td><td>K<\/td><td>L<\/td><\/tr><tr><th>1<\/th><td>2<\/td><td>C<\/td><td>D<\/td><td>M<\/td><td>N<\/td><\/tr><tr><th>2<\/th><td>6<\/td><td>NaN<\/td><td>NaN<\/td><td>O<\/td><td>P<\/td><\/tr><tr><th>3<\/th><td>7<\/td><td>NaN<\/td><td>NaN<\/td><td>Q<\/td><td>R<\/td><\/tr><tr><th>4<\/th><td>8<\/td><td>NaN<\/td><td>NaN<\/td><td>S<\/td><td>T<\/td><\/tr><\/tbody><\/table>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"left-join\">Left Join<\/h3>\n\n\n\n<p>The&nbsp;<code>LEFT JOIN<\/code>&nbsp;produces a complete set of records from DataFrame A (left DataFrame), with the matching records (where available) in DataFrame B (right DataFrame). If there is no match, the left side will contain null. You have to pass&nbsp;<code>left<\/code>&nbsp;in the&nbsp;<code>how<\/code>&nbsp;argument of&nbsp;<code>merge()<\/code>&nbsp;function to do left join:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>df_left = pd.merge(df1, df2, on='id', how='left')\n\ndf_left\n<\/code><\/pre>\n\n\n\n<table class=\"wp-block-table\"><thead><tr><th>id<\/th><th>Feature1_x<\/th><th>Feature2_x<\/th><th>Feature1_y<\/th><th>Feature2_y<\/th><\/tr><\/thead><tbody><tr><th>0<\/th><td>1<\/td><td>A<\/td><td>B<\/td><td>K<\/td><td>L<\/td><\/tr><tr><th>1<\/th><td>2<\/td><td>C<\/td><td>D<\/td><td>M<\/td><td>N<\/td><\/tr><tr><th>2<\/th><td>3<\/td><td>E<\/td><td>F<\/td><td>NaN<\/td><td>NaN<\/td><\/tr><tr><th>3<\/th><td>4<\/td><td>G<\/td><td>H<\/td><td>NaN<\/td><td>NaN<\/td><\/tr><tr><th>4<\/th><td>5<\/td><td>I<\/td><td>J<\/td><td>NaN<\/td><td>NaN<\/td><\/tr><\/tbody><\/table>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"joining-on-index\">Joining on index<\/h3>\n\n\n\n<p>Sometimes you may have to perform the join on the indexes or the row labels. To do so, you have to specify&nbsp;<code>right_index<\/code>&nbsp;(for the indexes of the right DataFrame) and&nbsp;<code>left_index<\/code>&nbsp;(for the indexes of the left DataFrame) as&nbsp;<code>True<\/code>&nbsp;:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>df_index = pd.merge(df1, df2, right_index=True, left_index=True)\n\ndf_index\n<\/code><\/pre>\n\n\n\n<table class=\"wp-block-table\"><thead><tr><th>id_x<\/th><th>Feature1_x<\/th><th>Feature2_x<\/th><th>id_y<\/th><th>Feature1_y<\/th><th>Feature2_y<\/th><\/tr><\/thead><tbody><tr><th>0<\/th><td>1<\/td><td>A<\/td><td>B<\/td><td>1<\/td><td>K<\/td><td>L<\/td><\/tr><tr><th>1<\/th><td>2<\/td><td>C<\/td><td>D<\/td><td>2<\/td><td>M<\/td><td>N<\/td><\/tr><tr><th>2<\/th><td>3<\/td><td>E<\/td><td>F<\/td><td>6<\/td><td>O<\/td><td>P<\/td><\/tr><tr><th>3<\/th><td>4<\/td><td>G<\/td><td>H<\/td><td>7<\/td><td>Q<\/td><td>R<\/td><\/tr><tr><th>4<\/th><td>5<\/td><td>I<\/td><td>J<\/td><td>8<\/td><td>S<\/td><td>T<\/td><\/tr><\/tbody><\/table>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"time-series-friendly-merging\">Time-series friendly merging<\/h2>\n\n\n\n<p>Pandas provides special functions for merging Time-series DataFrames. Perhaps the most useful and popular one is the&nbsp;<code>merge_asof()<\/code>&nbsp;function. The&nbsp;<code>merge_asof()<\/code>&nbsp;is similar to an ordered left-join except that you match on nearest key rather than equal keys. For each row in the left DataFrame, you select the last row in the right DataFrame whose&nbsp;<code>on<\/code>&nbsp;key is less than the left\u2019s key. Both DataFrames must be sorted by the key.<\/p>\n\n\n\n<p>Optionally an asof merge can perform a group-wise merge. This matches the&nbsp;<code>by<\/code>&nbsp;key equally, in addition to the nearest match on the&nbsp;<code>on<\/code>&nbsp;key.<\/p>\n\n\n\n<p>For example, you might have trades and quotes, and you want to asof merge them. Here the left DataFrame is chosen as&nbsp;<code>trades<\/code>&nbsp;and right DataFrame as&nbsp;<code>quotes<\/code>. They are asof merged on key&nbsp;<code>time<\/code>&nbsp;and group-wise merged by their&nbsp;<code>ticker<\/code>&nbsp;symbol.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>trades = pd.DataFrame({\n    'time': pd.to_datetime(['20160525 13:30:00.023',\n                            '20160525 13:30:00.038',\n                            '20160525 13:30:00.048',\n                            '20160525 13:30:00.048',\n                            '20160525 13:30:00.048']),\n    'ticker': ['MSFT', 'MSFT','GOOG', 'GOOG', 'AAPL'],\n    'price': [51.95, 51.95,720.77, 720.92, 98.00],\n    'quantity': [75, 155,100, 100, 100]},\n    columns=['time', 'ticker', 'price', 'quantity'])\n\nquotes = pd.DataFrame({\n    'time': pd.to_datetime(['20160525 13:30:00.023',\n                            '20160525 13:30:00.023',\n                            '20160525 13:30:00.030',\n                            '20160525 13:30:00.041',\n                            '20160525 13:30:00.048',\n                            '20160525 13:30:00.049',\n                            '20160525 13:30:00.072',\n                            '20160525 13:30:00.075']),\n    'ticker': ['GOOG', 'MSFT', 'MSFT','MSFT', 'GOOG', 'AAPL', 'GOOG','MSFT'],\n    'bid': [720.50, 51.95, 51.97, 51.99,720.50, 97.99, 720.50, 52.01],\n    'ask': [720.93, 51.96, 51.98, 52.00,720.93, 98.01, 720.88, 52.03]},\n    columns=['time', 'ticker', 'bid', 'ask'])\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>trades\n<\/code><\/pre>\n\n\n\n<table class=\"wp-block-table\"><thead><tr><th>time<\/th><th>ticker<\/th><th>price<\/th><th>quantity<\/th><\/tr><\/thead><tbody><tr><th>0<\/th><td>2016-05-25 13:30:00.023<\/td><td>MSFT<\/td><td>51.95<\/td><td>75<\/td><\/tr><tr><th>1<\/th><td>2016-05-25 13:30:00.038<\/td><td>MSFT<\/td><td>51.95<\/td><td>155<\/td><\/tr><tr><th>2<\/th><td>2016-05-25 13:30:00.048<\/td><td>GOOG<\/td><td>720.77<\/td><td>100<\/td><\/tr><tr><th>3<\/th><td>2016-05-25 13:30:00.048<\/td><td>GOOG<\/td><td>720.92<\/td><td>100<\/td><\/tr><tr><th>4<\/th><td>2016-05-25 13:30:00.048<\/td><td>AAPL<\/td><td>98.00<\/td><td>100<\/td><\/tr><\/tbody><\/table>\n\n\n\n<pre class=\"wp-block-code\"><code>quotes\n<\/code><\/pre>\n\n\n\n<table class=\"wp-block-table\"><thead><tr><th>time<\/th><th>ticker<\/th><th>bid<\/th><th>ask<\/th><\/tr><\/thead><tbody><tr><th>0<\/th><td>2016-05-25 13:30:00.023<\/td><td>GOOG<\/td><td>720.50<\/td><td>720.93<\/td><\/tr><tr><th>1<\/th><td>2016-05-25 13:30:00.023<\/td><td>MSFT<\/td><td>51.95<\/td><td>51.96<\/td><\/tr><tr><th>2<\/th><td>2016-05-25 13:30:00.030<\/td><td>MSFT<\/td><td>51.97<\/td><td>51.98<\/td><\/tr><tr><th>3<\/th><td>2016-05-25 13:30:00.041<\/td><td>MSFT<\/td><td>51.99<\/td><td>52.00<\/td><\/tr><tr><th>4<\/th><td>2016-05-25 13:30:00.048<\/td><td>GOOG<\/td><td>720.50<\/td><td>720.93<\/td><\/tr><tr><th>5<\/th><td>2016-05-25 13:30:00.049<\/td><td>AAPL<\/td><td>97.99<\/td><td>98.01<\/td><\/tr><tr><th>6<\/th><td>2016-05-25 13:30:00.072<\/td><td>GOOG<\/td><td>720.50<\/td><td>720.88<\/td><\/tr><tr><th>7<\/th><td>2016-05-25 13:30:00.075<\/td><td>MSFT<\/td><td>52.01<\/td><td>52.03<\/td><\/tr><\/tbody><\/table>\n\n\n\n<pre class=\"wp-block-code\"><code>df_merge_asof = pd.merge_asof(trades, quotes,\n              on='time',\n              by='ticker')\n\ndf_merge_asof\n<\/code><\/pre>\n\n\n\n<table class=\"wp-block-table\"><thead><tr><th>time<\/th><th>ticker<\/th><th>price<\/th><th>quantity<\/th><th>bid<\/th><th>ask<\/th><\/tr><\/thead><tbody><tr><th>0<\/th><td>2016-05-25 13:30:00.023<\/td><td>MSFT<\/td><td>51.95<\/td><td>75<\/td><td>51.95<\/td><td>51.96<\/td><\/tr><tr><th>1<\/th><td>2016-05-25 13:30:00.038<\/td><td>MSFT<\/td><td>51.95<\/td><td>155<\/td><td>51.97<\/td><td>51.98<\/td><\/tr><tr><th>2<\/th><td>2016-05-25 13:30:00.048<\/td><td>GOOG<\/td><td>720.77<\/td><td>100<\/td><td>720.50<\/td><td>720.93<\/td><\/tr><tr><th>3<\/th><td>2016-05-25 13:30:00.048<\/td><td>GOOG<\/td><td>720.92<\/td><td>100<\/td><td>720.50<\/td><td>720.93<\/td><\/tr><tr><th>4<\/th><td>2016-05-25 13:30:00.048<\/td><td>AAPL<\/td><td>98.00<\/td><td>100<\/td><td>NaN<\/td><td>NaN<\/td><\/tr><\/tbody><\/table>\n\n\n\n<p>If you observe carefully, you can notice the reason behind&nbsp;<code>NaN<\/code>&nbsp;appearing in the&nbsp;<code>AAPL<\/code>&nbsp;ticker row. Since the right DataFrame&nbsp;<code>quotes<\/code>&nbsp;didn&#8217;t have any&nbsp;<code>time<\/code>&nbsp;value less than&nbsp;<code>13:30:00.048<\/code>&nbsp;(the&nbsp;<code>time<\/code>in the left table) for&nbsp;<code>AAPL<\/code>&nbsp;ticker,&nbsp;<code>NaN<\/code>s were introduced in the&nbsp;<code>bid<\/code>&nbsp;and&nbsp;<code>ask<\/code>&nbsp;columns.<\/p>\n\n\n\n<p>You can also set a predefined tolerance level for&nbsp;<code>time<\/code>&nbsp;column. Suppose you only want asof merge within 2ms between the&nbsp;<code>quote<\/code>&nbsp;time and the&nbsp;<code>trade<\/code>&nbsp;time, then you will have to specify&nbsp;<code>tolerance<\/code>&nbsp;argument:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>df_merge_asof_tolerance = pd.merge_asof(trades, quotes,\n              on='time',\n              by='ticker',\n              tolerance=pd.Timedelta('2ms'))\n\ndf_merge_asof_tolerance\n<\/code><\/pre>\n\n\n\n<table class=\"wp-block-table\"><thead><tr><th>time<\/th><th>ticker<\/th><th>price<\/th><th>quantity<\/th><th>bid<\/th><th>ask<\/th><\/tr><\/thead><tbody><tr><th>0<\/th><td>2016-05-25 13:30:00.023<\/td><td>MSFT<\/td><td>51.95<\/td><td>75<\/td><td>51.95<\/td><td>51.96<\/td><\/tr><tr><th>1<\/th><td>2016-05-25 13:30:00.038<\/td><td>MSFT<\/td><td>51.95<\/td><td>155<\/td><td>NaN<\/td><td>NaN<\/td><\/tr><tr><th>2<\/th><td>2016-05-25 13:30:00.048<\/td><td>GOOG<\/td><td>720.77<\/td><td>100<\/td><td>720.50<\/td><td>720.93<\/td><\/tr><tr><th>3<\/th><td>2016-05-25 13:30:00.048<\/td><td>GOOG<\/td><td>720.92<\/td><td>100<\/td><td>720.50<\/td><td>720.93<\/td><\/tr><tr><th>4<\/th><td>2016-05-25 13:30:00.048<\/td><td>AAPL<\/td><td>98.00<\/td><td>100<\/td><td>NaN<\/td><td>NaN<\/td><\/tr><\/tbody><\/table>\n\n\n\n<p>Notice the difference between the above and previous result. Rows are not merged if the time tolerance didn&#8217;t match&nbsp;<code>2ms<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"conclusion\">Conclusion<\/h2>\n\n\n\n<p>Hurray! You have come to the end of the tutorial. In this tutorial, you learned to concatenate and merge DataFrames based on several logics using the\u00a0<code>concat()<\/code>\u00a0and\u00a0<code>merge()<\/code>\u00a0functions of\u00a0<code>pandas<\/code>library. Towards the end, you also practiced the special function\u00a0<code>merge_asof()<\/code>\u00a0for merging Time-series DataFrames. Along the way, you also learned to play with indexes of the DataFrames. There are several other options you can explore for joining DataFrames in pandas, and I encourage you to look at its fantastic documentation. Happy exploring!<\/p>\n\n\n\n<p>\u017bdr\u00f3d\u0142o:  <br><a href=\"https:\/\/www.datacamp.com\/community\/tutorials\/joining-dataframes-pandas\">https:\/\/www.datacamp.com\/community\/tutorials\/joining-dataframes-pandas<\/a> <\/p>\n","protected":false},"excerpt":{"rendered":"<p class=\"excerpt\">In this tutorial, you\u2019ll learn various ways in which multiple DataFrames could be merged in python using Pandas library. Have you ever tried solving a Kaggle challenge? If yes, you might have noticed that in most of the challenges, the data provided to you is present in multiple files, with some of the columns present&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"http:\/\/u239160.webh.me\/jakisproblem.pl\/index.php\/2019\/09\/13\/joining-dataframes-in-pandas\/\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[105,102,77],"class_list":["post-2225","post","type-post","status-publish","format-standard","hentry","category-bez-kategorii","tag-dataframe","tag-pandas","tag-python"],"_links":{"self":[{"href":"http:\/\/u239160.webh.me\/jakisproblem.pl\/index.php\/wp-json\/wp\/v2\/posts\/2225","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/u239160.webh.me\/jakisproblem.pl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/u239160.webh.me\/jakisproblem.pl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/u239160.webh.me\/jakisproblem.pl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/u239160.webh.me\/jakisproblem.pl\/index.php\/wp-json\/wp\/v2\/comments?post=2225"}],"version-history":[{"count":1,"href":"http:\/\/u239160.webh.me\/jakisproblem.pl\/index.php\/wp-json\/wp\/v2\/posts\/2225\/revisions"}],"predecessor-version":[{"id":2226,"href":"http:\/\/u239160.webh.me\/jakisproblem.pl\/index.php\/wp-json\/wp\/v2\/posts\/2225\/revisions\/2226"}],"wp:attachment":[{"href":"http:\/\/u239160.webh.me\/jakisproblem.pl\/index.php\/wp-json\/wp\/v2\/media?parent=2225"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/u239160.webh.me\/jakisproblem.pl\/index.php\/wp-json\/wp\/v2\/categories?post=2225"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/u239160.webh.me\/jakisproblem.pl\/index.php\/wp-json\/wp\/v2\/tags?post=2225"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}