04-17-2023, 03:46 AM
Dictionary of Lists to DataFrame – Python Conversion
<div>
<div class="kk-star-ratings kksr-auto kksr-align-left kksr-valign-top" data-payload='{"align":"left","id":"1296622","slug":"default","valign":"top","ignore":"","reference":"auto","class":"","count":"1","legendonly":"","readonly":"","score":"5","starsonly":"","best":"5","gap":"5","greet":"Rate this post","legend":"5\/5 - (1 vote)","size":"24","title":"Dictionary of Lists to DataFrame - Python Conversion","width":"142.5","_legend":"{score}\/{best} - ({count} {votes})","font_factor":"1.25"}'>
<div class="kksr-stars">
<div class="kksr-stars-inactive">
<div class="kksr-star" data-star="1" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" data-star="2" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" data-star="3" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" data-star="4" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" data-star="5" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
</p></div>
<div class="kksr-stars-active" style="width: 142.5px;">
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
</p></div>
</div>
<div class="kksr-legend" style="font-size: 19.2px;"> 5/5 – (1 vote) </div>
</p></div>
<h2 class="wp-block-heading">Problem Formulation</h2>
<p>Working with Python often involves processing complex data structures such as <a href="https://blog.finxter.com/python-dictionary/" data-type="post" data-id="5232" target="_blank" rel="noreferrer noopener">dictionaries</a> and <a href="https://blog.finxter.com/python-lists/" data-type="post" data-id="7332" target="_blank" rel="noreferrer noopener">lists</a>. In many instances, it becomes necessary to <strong>convert a dictionary of lists</strong> into a more convenient and structured format like a <strong>Pandas DataFrame</strong> <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f43c.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" />. </p>
<p>DataFrames offer numerous benefits, including easier data handling and analysis <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f50d.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" />, as well as an array of built-in functions that make data manipulation much more straightforward.</p>
<p>In this context, the potential challenge arises in figuring out how to correctly convert a dictionary with lists as its values into a DataFrame. Various methods can be employed to achieve this goal, but it is crucial to understand the appropriate approach in each situation to ensure accurate and reliable data representation <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f607.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" />.</p>
<h2 class="wp-block-heading">Method 1: Using DataFrame.from_dict()</h2>
<div class="wp-block-image">
<figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="682" src="https://blog.finxter.com/wp-content/uploads/2023/04/image-144-1024x682.png" alt="" class="wp-image-1293961" srcset="https://blog.finxter.com/wp-content/uploads/2023/04/image-144-1024x682.png 1024w, https://blog.finxter.com/wp-content/uplo...00x200.png 300w, https://blog.finxter.com/wp-content/uplo...68x512.png 768w, https://blog.finxter.com/wp-content/uplo...ge-144.png 1168w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>
</div>
<p class="has-global-color-8-background-color has-background">In this method, we will use the <code>DataFrame.from_dict()</code> function provided by the <code>pandas</code> library to convert a Python dictionary of lists to a DataFrame. This function is quite versatile, as it can construct a DataFrame from a dictionary of array-like or dictionaries data. <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4d8.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>To begin with, let’s import the necessary library:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">import pandas as pd
</pre>
<p>Next, create a dictionary with lists as values. For example, let’s consider the following dictionary:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">data = { 'Name': ['Sam', 'Alex', 'Jamie'], 'Age': [29, 28, 24], 'Country': ['USA', 'UK', 'Canada']
}
</pre>
<p>Now, use the <code><a href="https://blog.finxter.com/pandas-dataframe-from_dict-method/" data-type="post" data-id="344236" target="_blank" rel="noreferrer noopener">from_dict()</a></code> method to create a DataFrame from the dictionary. The process is quite simple, all you have to do is call the method with the dictionary as its argument. <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4a1.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="1" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">df = pd.DataFrame.from_dict(data)
</pre>
<p>And there you have it, a DataFrame created from a dictionary of lists! The resulting DataFrame will look like this:</p>
<pre class="wp-block-preformatted"><code> Name Age Country
0 Sam 29 USA
1 Alex 28 UK
2 Jamie 24 Canada</code>
</pre>
<p>The benefits of using this method are its simplicity and compatibility with different types of dictionary data. However, always remember to maintain a consistent length for the lists within the dictionary to avoid any issues. <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f680.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<h2 class="wp-block-heading">Method 2: Using pd.Series() with DataFrame</h2>
<div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" loading="lazy" width="1024" height="682" src="https://blog.finxter.com/wp-content/uploads/2023/04/image-146-1024x682.png" alt="" class="wp-image-1293963" srcset="https://blog.finxter.com/wp-content/uploads/2023/04/image-146-1024x682.png 1024w, https://blog.finxter.com/wp-content/uplo...00x200.png 300w, https://blog.finxter.com/wp-content/uplo...68x512.png 768w, https://blog.finxter.com/wp-content/uplo...ge-146.png 1168w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>
</div>
<p class="has-global-color-8-background-color has-background">In this method, we will be using the <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f43c.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Pandas library’s <code>pd.Series</code> data structure inside the <code>DataFrame</code> method. It is a useful approach that can help you convert dictionaries with lists into a DataFrame format quickly and efficiently. <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f603.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>To implement this method, you can use Python’s <a rel="noreferrer noopener" href="https://blog.finxter.com/python-dictionary-comprehension/" data-type="post" data-id="13313" target="_blank">dictionary comprehension</a> and the <code><a href="https://blog.finxter.com/python-dict-items-method/" data-type="post" data-id="37673" target="_blank" rel="noreferrer noopener">items()</a></code> method, as shown in the syntax below:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">pd.DataFrame({key: pd.Series(val) for key, val in dictionary.items()})
</pre>
<p>Here, <code>dictionary.items()</code> fetches key-value pairs from the dictionary, and <code>pd.Series(val)</code> creates a series of values from these pairs. The result is a well-structured Pandas DataFrame! <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f389.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>Let’s take a look <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f440.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /> at an example:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">import pandas as pd data = { "Name": ["Alice", "Bob", "Claire"], "Age": [25, 30, 35], "City": ["London", "New York", "Sydney"],
} df = pd.DataFrame({key: pd.Series(val) for key, val in data.items()})
print(df)
</pre>
<p>Executing this code will generate the following DataFrame:</p>
<pre class="wp-block-preformatted"><code> Name Age City
0 Alice 25 London
1 Bob 30 New York
2 Claire 35 Sydney</code>
</pre>
<p>As you can see, using the <code>pd.Series</code> data structure with the DataFrame method provides a clean and effective way to transform your dictionaries with lists into Pandas DataFrames! <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f43c.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /><img src="https://s.w.org/images/core/emoji/14.0.0/72x72/2665.png" alt="♥" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p class="has-base-2-background-color has-background"><img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4a1.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Recommended</strong>: <a href="https://blog.finxter.com/python-dictionary-comprehension/" data-type="URL" data-id="https://blog.finxter.com/python-dictionary-comprehension/" target="_blank" rel="noreferrer noopener">Python Dictionary Comprehension: A Powerful One-Liner Tutorial</a></p>
<figure class="wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube"><a href="https://blog.finxter.com/dictionary-of-lists-to-dataframe-python-conversion/"><img src="https://blog.finxter.com/wp-content/plugins/wp-youtube-lyte/lyteCache.php?origThumbUrl=https%3A%2F%2Fi.ytimg.com%2Fvi%2FTlEC5Jx72Uc%2Fhqdefault.jpg" alt="YouTube Video"></a><figcaption></figcaption></figure>
<h2 class="wp-block-heading">Method 3: json_normalize()</h2>
<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" loading="lazy" width="607" height="911" src="https://blog.finxter.com/wp-content/uploads/2023/04/image-142.png" alt="" class="wp-image-1293959" srcset="https://blog.finxter.com/wp-content/uploads/2023/04/image-142.png 607w, https://blog.finxter.com/wp-content/uplo...00x300.png 200w" sizes="(max-width: 607px) 100vw, 607px" /></figure>
</div>
<p class="has-global-color-8-background-color has-background">In this method, we will use the <code>pd.json_normalize</code> function to convert a Python dict of lists to a Pandas DataFrame. This function is particularly useful for handling semi-structured nested JSON structures, as it can flatten them into flat tables.</p>
<p>To begin, you should first import the Pandas library using the following snippet:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">import pandas as pd
</pre>
<p>Next, create your Python dict of lists like this example:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">data = { 'manoj': ["java", "php", "python"], 'rajesh': ["c", "c++", "java"], 'ravi': ["r", "python", "javascript"]
}
</pre>
<p>With your data ready, you can now use the <code>json_normalize</code> function to convert the <strong>dict of lists</strong> into a DataFrame. </p>
<p>Here’s how:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="1" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">df = pd.json_normalize(data, record_path='manoj', meta=['rajesh', 'ravi'])
</pre>
<p>And that’s it! <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f389.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /> You now have a DataFrame created from the dict of lists. Don’t forget to preview your DataFrame using <code>print(df)</code> or <code><a href="https://blog.finxter.com/pandas-dataframe-head-method/" data-type="post" data-id="343658" target="_blank" rel="noreferrer noopener">df.head()</a></code> to ensure that the data has been converted correctly. <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f60a.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
</p>
<h2 class="wp-block-heading">Method 4: Utilizing DataFrame Constructor with List Comprehension</h2>
<div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" loading="lazy" width="1024" height="682" src="https://blog.finxter.com/wp-content/uploads/2023/04/image-140-1024x682.png" alt="" class="wp-image-1293954" srcset="https://blog.finxter.com/wp-content/uploads/2023/04/image-140-1024x682.png 1024w, https://blog.finxter.com/wp-content/uplo...00x200.png 300w, https://blog.finxter.com/wp-content/uplo...68x512.png 768w, https://blog.finxter.com/wp-content/uplo...ge-140.png 1168w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>
</div>
<p class="has-global-color-8-background-color has-background">In this method, we create a pandas DataFrame from a dictionary of lists using the DataFrame constructor and list comprehension. This approach is quite simple and potentially more efficient for larger datasets.<img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4a1.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>First, we need to import the pandas library:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">python import pandas as pd</pre>
<p>Next, let’s create a sample dictionary of lists containing student data: </p>
<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">data = { 'Name': ['Alice', 'Bob', 'Charlie'], 'Math': [80, 70, 90], 'History': [95, 85, 78] } </pre>
<p>Now, we will use the DataFrame constructor and <a href="https://blog.finxter.com/list-comprehension/" data-type="post" data-id="1171" target="_blank" rel="noreferrer noopener">list comprehension</a> to convert the dictionary of lists into a pandas DataFrame: </p>
<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">df = pd.DataFrame({key: pd.Series(value) for key, value in data.items()}) </pre>
<p>Here’s what’s happening in the code above:</p>
<ul>
<li>The dictionary of lists is iterated using <code>items()</code> method to obtain the key-value pairs<img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f511.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /></li>
<li>Each value is converted to a pandas Series using <code>pd.Series()</code> function<img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4da.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /></li>
<li>A DataFrame is created using the <code>pd.DataFrame()</code> constructor to combine the converted series<img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4c4.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /></li>
</ul>
<p>Once the DataFrame is constructed, it will look something like this: </p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""> Name Math History
0 Alice 80 95
1 Bob 70 85
2 Charlie 90 78 </pre>
<p>Method 4 provides a concise and versatile way to transform a dictionary of lists into a DataFrame, making it convenient for data manipulation and analysis.<img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4c8.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Enjoy working with it!<img src="https://s.w.org/images/core/emoji/14.0.0/72x72/2728.png" alt="✨" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<h2 class="wp-block-heading">Summary</h2>
<p>In this article, we explored the process of converting a Python dictionary with lists as values into a pandas DataFrame. Various methods have been discussed, such as using <a href="https://stackoverflow.com/questions/25292568/converting-a-dictionary-with-lists-for-values-into-a-dataframe"><code>pd.DataFrame.from_dict()</code></a> and <code><a href="https://stackoverflow.com/questions/20638006/convert-list-of-dictionaries-to-a-pandas-dataframe">pd.DataFrame.from_records()</a> </code>to achieve this. <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f31f.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>It’s important to choose a method that fits the specific structure and format of your data. Sometimes, you might need to preprocess the data into separate lists before creating a DataFrame. An example of doing this can be found <a href="https://stackoverflow.com/questions/42869544/dictionary-of-lists-to-dataframe" target="_blank" rel="noreferrer noopener">here</a>. <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4ca.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>Throughout the article, we provided examples and detailed explanations on how to work with complex data structures, including lists of lists and lists of dictionaries. <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f9ed.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Remember to keep the code clean and efficient for better readability!</p>
<p class="has-base-2-background-color has-background"><img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4a1.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Recommended</strong>: <a href="https://blog.finxter.com/how-to-create-a-dataframe-from-lists/" data-type="post" data-id="985131" target="_blank" rel="noreferrer noopener">How to Create a DataFrame From Lists?</a></p>
<p>With the knowledge gained, you’ll be better equipped to handle Python dictionaries containing lists, and successfully transform them into pandas DataFrames for a wide range of data analysis tasks. <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4aa.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /><img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f40d.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Happy coding!</p>
<div class="wp-block-group">
<div class="wp-block-group__inner-container is-layout-flow">
<p><strong>Related Articles:</strong></p>
<ul>
<li><a href="https://blog.finxter.com/collection-5-cheat-sheets-every-python-coder-must-own/" target="_blank" rel="noreferrer noopener" title="[Collection] 11 Python Cheat Sheets Every Python Coder Must Own">[Collection] 11 Python Cheat Sheets Every Python Coder Must Own</a></li>
<li><a href="https://blog.finxter.com/object-oriented-programming-terminology-cheat-sheet/" target="_blank" rel="noreferrer noopener" title="https://blog.finxter.com/object-oriented-programming-terminology-cheat-sheet/">[Python OOP Cheat Sheet] A Simple Overview of Object-Oriented Programming</a></li>
<li><a href="https://blog.finxter.com/machine-learning-cheat-sheets/" title="[Collection] 15 Mind-Blowing Machine Learning Cheat Sheets to Pin to Your Toilet Wall" target="_blank" rel="noreferrer noopener">[Collection] 15 Mind-Blowing Machine Learning Cheat Sheets to Pin to Your Toilet Wall</a></li>
<li><a href="https://blog.finxter.com/python-cheat-sheets/" title="https://blog.finxter.com/python-cheat-sheets/" target="_blank" rel="noreferrer noopener">Your 8+ Free Python Cheat Sheet [Course]</a></li>
<li><a href="https://blog.finxter.com/python-cheat-sheet/" target="_blank" rel="noreferrer noopener" title="Python Beginner Cheat Sheet: 19 Keywords Every Coder Must Know">Python Beginner Cheat Sheet: 19 Keywords Every Coder Must Know</a></li>
<li><a href="https://blog.finxter.com/python-cheat-sheet-functions-and-tricks/" title="Python Functions and Tricks Cheat Sheet" target="_blank" rel="noreferrer noopener">Python Functions and Tricks Cheat Sheet</a></li>
<li><a href="https://blog.finxter.com/python-interview-questions/" target="_blank" rel="noreferrer noopener" title="https://blog.finxter.com/python-interview-questions/">Python Cheat Sheet: 14 Interview Questions</a></li>
<li><a href="https://blog.finxter.com/pandas-cheat-sheets/" title="[PDF Collection] 7 Beautiful Pandas Cheat Sheets — Post Them to Your Wall" target="_blank" rel="noreferrer noopener">Beautiful Pandas Cheat Sheets</a></li>
<li><a href="https://blog.finxter.com/collection-10-best-numpy-cheat-sheets-every-python-coder-must-own/" title="[Collection] 10 Best NumPy Cheat Sheets Every Python Coder Must Own" target="_blank" rel="noreferrer noopener">10 Best NumPy Cheat Sheets</a></li>
<li><a href="https://blog.finxter.com/python-list-methods-cheat-sheet-instant-pdf-download/" title="Python List Methods Cheat Sheet [Instant PDF Download]" target="_blank" rel="noreferrer noopener">Python List Methods Cheat Sheet [Instant PDF Download]</a></li>
<li><a href="https://blog.finxter.com/cheat-sheet-6-pillar-machine-learning-algorithms/" target="_blank" rel="noreferrer noopener" title="[Cheat Sheet] 6 Pillar Machine Learning Algorithms">[Cheat Sheet] 6 Pillar Machine Learning Algorithms</a></li>
</ul>
</div>
</div>
</div>
https://www.sickgaming.net/blog/2023/04/...onversion/
<div>
<div class="kk-star-ratings kksr-auto kksr-align-left kksr-valign-top" data-payload='{"align":"left","id":"1296622","slug":"default","valign":"top","ignore":"","reference":"auto","class":"","count":"1","legendonly":"","readonly":"","score":"5","starsonly":"","best":"5","gap":"5","greet":"Rate this post","legend":"5\/5 - (1 vote)","size":"24","title":"Dictionary of Lists to DataFrame - Python Conversion","width":"142.5","_legend":"{score}\/{best} - ({count} {votes})","font_factor":"1.25"}'>
<div class="kksr-stars">
<div class="kksr-stars-inactive">
<div class="kksr-star" data-star="1" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" data-star="2" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" data-star="3" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" data-star="4" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" data-star="5" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
</p></div>
<div class="kksr-stars-active" style="width: 142.5px;">
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
</p></div>
</div>
<div class="kksr-legend" style="font-size: 19.2px;"> 5/5 – (1 vote) </div>
</p></div>
<h2 class="wp-block-heading">Problem Formulation</h2>
<p>Working with Python often involves processing complex data structures such as <a href="https://blog.finxter.com/python-dictionary/" data-type="post" data-id="5232" target="_blank" rel="noreferrer noopener">dictionaries</a> and <a href="https://blog.finxter.com/python-lists/" data-type="post" data-id="7332" target="_blank" rel="noreferrer noopener">lists</a>. In many instances, it becomes necessary to <strong>convert a dictionary of lists</strong> into a more convenient and structured format like a <strong>Pandas DataFrame</strong> <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f43c.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" />. </p>
<p>DataFrames offer numerous benefits, including easier data handling and analysis <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f50d.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" />, as well as an array of built-in functions that make data manipulation much more straightforward.</p>
<p>In this context, the potential challenge arises in figuring out how to correctly convert a dictionary with lists as its values into a DataFrame. Various methods can be employed to achieve this goal, but it is crucial to understand the appropriate approach in each situation to ensure accurate and reliable data representation <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f607.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" />.</p>
<h2 class="wp-block-heading">Method 1: Using DataFrame.from_dict()</h2>
<div class="wp-block-image">
<figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="682" src="https://blog.finxter.com/wp-content/uploads/2023/04/image-144-1024x682.png" alt="" class="wp-image-1293961" srcset="https://blog.finxter.com/wp-content/uploads/2023/04/image-144-1024x682.png 1024w, https://blog.finxter.com/wp-content/uplo...00x200.png 300w, https://blog.finxter.com/wp-content/uplo...68x512.png 768w, https://blog.finxter.com/wp-content/uplo...ge-144.png 1168w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>
</div>
<p class="has-global-color-8-background-color has-background">In this method, we will use the <code>DataFrame.from_dict()</code> function provided by the <code>pandas</code> library to convert a Python dictionary of lists to a DataFrame. This function is quite versatile, as it can construct a DataFrame from a dictionary of array-like or dictionaries data. <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4d8.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>To begin with, let’s import the necessary library:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">import pandas as pd
</pre>
<p>Next, create a dictionary with lists as values. For example, let’s consider the following dictionary:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">data = { 'Name': ['Sam', 'Alex', 'Jamie'], 'Age': [29, 28, 24], 'Country': ['USA', 'UK', 'Canada']
}
</pre>
<p>Now, use the <code><a href="https://blog.finxter.com/pandas-dataframe-from_dict-method/" data-type="post" data-id="344236" target="_blank" rel="noreferrer noopener">from_dict()</a></code> method to create a DataFrame from the dictionary. The process is quite simple, all you have to do is call the method with the dictionary as its argument. <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4a1.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="1" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">df = pd.DataFrame.from_dict(data)
</pre>
<p>And there you have it, a DataFrame created from a dictionary of lists! The resulting DataFrame will look like this:</p>
<pre class="wp-block-preformatted"><code> Name Age Country
0 Sam 29 USA
1 Alex 28 UK
2 Jamie 24 Canada</code>
</pre>
<p>The benefits of using this method are its simplicity and compatibility with different types of dictionary data. However, always remember to maintain a consistent length for the lists within the dictionary to avoid any issues. <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f680.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<h2 class="wp-block-heading">Method 2: Using pd.Series() with DataFrame</h2>
<div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" loading="lazy" width="1024" height="682" src="https://blog.finxter.com/wp-content/uploads/2023/04/image-146-1024x682.png" alt="" class="wp-image-1293963" srcset="https://blog.finxter.com/wp-content/uploads/2023/04/image-146-1024x682.png 1024w, https://blog.finxter.com/wp-content/uplo...00x200.png 300w, https://blog.finxter.com/wp-content/uplo...68x512.png 768w, https://blog.finxter.com/wp-content/uplo...ge-146.png 1168w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>
</div>
<p class="has-global-color-8-background-color has-background">In this method, we will be using the <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f43c.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Pandas library’s <code>pd.Series</code> data structure inside the <code>DataFrame</code> method. It is a useful approach that can help you convert dictionaries with lists into a DataFrame format quickly and efficiently. <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f603.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>To implement this method, you can use Python’s <a rel="noreferrer noopener" href="https://blog.finxter.com/python-dictionary-comprehension/" data-type="post" data-id="13313" target="_blank">dictionary comprehension</a> and the <code><a href="https://blog.finxter.com/python-dict-items-method/" data-type="post" data-id="37673" target="_blank" rel="noreferrer noopener">items()</a></code> method, as shown in the syntax below:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">pd.DataFrame({key: pd.Series(val) for key, val in dictionary.items()})
</pre>
<p>Here, <code>dictionary.items()</code> fetches key-value pairs from the dictionary, and <code>pd.Series(val)</code> creates a series of values from these pairs. The result is a well-structured Pandas DataFrame! <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f389.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>Let’s take a look <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f440.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /> at an example:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">import pandas as pd data = { "Name": ["Alice", "Bob", "Claire"], "Age": [25, 30, 35], "City": ["London", "New York", "Sydney"],
} df = pd.DataFrame({key: pd.Series(val) for key, val in data.items()})
print(df)
</pre>
<p>Executing this code will generate the following DataFrame:</p>
<pre class="wp-block-preformatted"><code> Name Age City
0 Alice 25 London
1 Bob 30 New York
2 Claire 35 Sydney</code>
</pre>
<p>As you can see, using the <code>pd.Series</code> data structure with the DataFrame method provides a clean and effective way to transform your dictionaries with lists into Pandas DataFrames! <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f43c.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /><img src="https://s.w.org/images/core/emoji/14.0.0/72x72/2665.png" alt="♥" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p class="has-base-2-background-color has-background"><img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4a1.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Recommended</strong>: <a href="https://blog.finxter.com/python-dictionary-comprehension/" data-type="URL" data-id="https://blog.finxter.com/python-dictionary-comprehension/" target="_blank" rel="noreferrer noopener">Python Dictionary Comprehension: A Powerful One-Liner Tutorial</a></p>
<figure class="wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube"><a href="https://blog.finxter.com/dictionary-of-lists-to-dataframe-python-conversion/"><img src="https://blog.finxter.com/wp-content/plugins/wp-youtube-lyte/lyteCache.php?origThumbUrl=https%3A%2F%2Fi.ytimg.com%2Fvi%2FTlEC5Jx72Uc%2Fhqdefault.jpg" alt="YouTube Video"></a><figcaption></figcaption></figure>
<h2 class="wp-block-heading">Method 3: json_normalize()</h2>
<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" loading="lazy" width="607" height="911" src="https://blog.finxter.com/wp-content/uploads/2023/04/image-142.png" alt="" class="wp-image-1293959" srcset="https://blog.finxter.com/wp-content/uploads/2023/04/image-142.png 607w, https://blog.finxter.com/wp-content/uplo...00x300.png 200w" sizes="(max-width: 607px) 100vw, 607px" /></figure>
</div>
<p class="has-global-color-8-background-color has-background">In this method, we will use the <code>pd.json_normalize</code> function to convert a Python dict of lists to a Pandas DataFrame. This function is particularly useful for handling semi-structured nested JSON structures, as it can flatten them into flat tables.</p>
<p>To begin, you should first import the Pandas library using the following snippet:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">import pandas as pd
</pre>
<p>Next, create your Python dict of lists like this example:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">data = { 'manoj': ["java", "php", "python"], 'rajesh': ["c", "c++", "java"], 'ravi': ["r", "python", "javascript"]
}
</pre>
<p>With your data ready, you can now use the <code>json_normalize</code> function to convert the <strong>dict of lists</strong> into a DataFrame. </p>
<p>Here’s how:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="1" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">df = pd.json_normalize(data, record_path='manoj', meta=['rajesh', 'ravi'])
</pre>
<p>And that’s it! <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f389.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /> You now have a DataFrame created from the dict of lists. Don’t forget to preview your DataFrame using <code>print(df)</code> or <code><a href="https://blog.finxter.com/pandas-dataframe-head-method/" data-type="post" data-id="343658" target="_blank" rel="noreferrer noopener">df.head()</a></code> to ensure that the data has been converted correctly. <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f60a.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
</p>
<h2 class="wp-block-heading">Method 4: Utilizing DataFrame Constructor with List Comprehension</h2>
<div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" loading="lazy" width="1024" height="682" src="https://blog.finxter.com/wp-content/uploads/2023/04/image-140-1024x682.png" alt="" class="wp-image-1293954" srcset="https://blog.finxter.com/wp-content/uploads/2023/04/image-140-1024x682.png 1024w, https://blog.finxter.com/wp-content/uplo...00x200.png 300w, https://blog.finxter.com/wp-content/uplo...68x512.png 768w, https://blog.finxter.com/wp-content/uplo...ge-140.png 1168w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>
</div>
<p class="has-global-color-8-background-color has-background">In this method, we create a pandas DataFrame from a dictionary of lists using the DataFrame constructor and list comprehension. This approach is quite simple and potentially more efficient for larger datasets.<img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4a1.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>First, we need to import the pandas library:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">python import pandas as pd</pre>
<p>Next, let’s create a sample dictionary of lists containing student data: </p>
<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">data = { 'Name': ['Alice', 'Bob', 'Charlie'], 'Math': [80, 70, 90], 'History': [95, 85, 78] } </pre>
<p>Now, we will use the DataFrame constructor and <a href="https://blog.finxter.com/list-comprehension/" data-type="post" data-id="1171" target="_blank" rel="noreferrer noopener">list comprehension</a> to convert the dictionary of lists into a pandas DataFrame: </p>
<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">df = pd.DataFrame({key: pd.Series(value) for key, value in data.items()}) </pre>
<p>Here’s what’s happening in the code above:</p>
<ul>
<li>The dictionary of lists is iterated using <code>items()</code> method to obtain the key-value pairs<img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f511.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /></li>
<li>Each value is converted to a pandas Series using <code>pd.Series()</code> function<img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4da.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /></li>
<li>A DataFrame is created using the <code>pd.DataFrame()</code> constructor to combine the converted series<img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4c4.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /></li>
</ul>
<p>Once the DataFrame is constructed, it will look something like this: </p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""> Name Math History
0 Alice 80 95
1 Bob 70 85
2 Charlie 90 78 </pre>
<p>Method 4 provides a concise and versatile way to transform a dictionary of lists into a DataFrame, making it convenient for data manipulation and analysis.<img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4c8.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Enjoy working with it!<img src="https://s.w.org/images/core/emoji/14.0.0/72x72/2728.png" alt="✨" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<h2 class="wp-block-heading">Summary</h2>
<p>In this article, we explored the process of converting a Python dictionary with lists as values into a pandas DataFrame. Various methods have been discussed, such as using <a href="https://stackoverflow.com/questions/25292568/converting-a-dictionary-with-lists-for-values-into-a-dataframe"><code>pd.DataFrame.from_dict()</code></a> and <code><a href="https://stackoverflow.com/questions/20638006/convert-list-of-dictionaries-to-a-pandas-dataframe">pd.DataFrame.from_records()</a> </code>to achieve this. <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f31f.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>It’s important to choose a method that fits the specific structure and format of your data. Sometimes, you might need to preprocess the data into separate lists before creating a DataFrame. An example of doing this can be found <a href="https://stackoverflow.com/questions/42869544/dictionary-of-lists-to-dataframe" target="_blank" rel="noreferrer noopener">here</a>. <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4ca.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>Throughout the article, we provided examples and detailed explanations on how to work with complex data structures, including lists of lists and lists of dictionaries. <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f9ed.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Remember to keep the code clean and efficient for better readability!</p>
<p class="has-base-2-background-color has-background"><img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4a1.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Recommended</strong>: <a href="https://blog.finxter.com/how-to-create-a-dataframe-from-lists/" data-type="post" data-id="985131" target="_blank" rel="noreferrer noopener">How to Create a DataFrame From Lists?</a></p>
<p>With the knowledge gained, you’ll be better equipped to handle Python dictionaries containing lists, and successfully transform them into pandas DataFrames for a wide range of data analysis tasks. <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4aa.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /><img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f40d.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Happy coding!</p>
<div class="wp-block-group">
<div class="wp-block-group__inner-container is-layout-flow">
<p><strong>Related Articles:</strong></p>
<ul>
<li><a href="https://blog.finxter.com/collection-5-cheat-sheets-every-python-coder-must-own/" target="_blank" rel="noreferrer noopener" title="[Collection] 11 Python Cheat Sheets Every Python Coder Must Own">[Collection] 11 Python Cheat Sheets Every Python Coder Must Own</a></li>
<li><a href="https://blog.finxter.com/object-oriented-programming-terminology-cheat-sheet/" target="_blank" rel="noreferrer noopener" title="https://blog.finxter.com/object-oriented-programming-terminology-cheat-sheet/">[Python OOP Cheat Sheet] A Simple Overview of Object-Oriented Programming</a></li>
<li><a href="https://blog.finxter.com/machine-learning-cheat-sheets/" title="[Collection] 15 Mind-Blowing Machine Learning Cheat Sheets to Pin to Your Toilet Wall" target="_blank" rel="noreferrer noopener">[Collection] 15 Mind-Blowing Machine Learning Cheat Sheets to Pin to Your Toilet Wall</a></li>
<li><a href="https://blog.finxter.com/python-cheat-sheets/" title="https://blog.finxter.com/python-cheat-sheets/" target="_blank" rel="noreferrer noopener">Your 8+ Free Python Cheat Sheet [Course]</a></li>
<li><a href="https://blog.finxter.com/python-cheat-sheet/" target="_blank" rel="noreferrer noopener" title="Python Beginner Cheat Sheet: 19 Keywords Every Coder Must Know">Python Beginner Cheat Sheet: 19 Keywords Every Coder Must Know</a></li>
<li><a href="https://blog.finxter.com/python-cheat-sheet-functions-and-tricks/" title="Python Functions and Tricks Cheat Sheet" target="_blank" rel="noreferrer noopener">Python Functions and Tricks Cheat Sheet</a></li>
<li><a href="https://blog.finxter.com/python-interview-questions/" target="_blank" rel="noreferrer noopener" title="https://blog.finxter.com/python-interview-questions/">Python Cheat Sheet: 14 Interview Questions</a></li>
<li><a href="https://blog.finxter.com/pandas-cheat-sheets/" title="[PDF Collection] 7 Beautiful Pandas Cheat Sheets — Post Them to Your Wall" target="_blank" rel="noreferrer noopener">Beautiful Pandas Cheat Sheets</a></li>
<li><a href="https://blog.finxter.com/collection-10-best-numpy-cheat-sheets-every-python-coder-must-own/" title="[Collection] 10 Best NumPy Cheat Sheets Every Python Coder Must Own" target="_blank" rel="noreferrer noopener">10 Best NumPy Cheat Sheets</a></li>
<li><a href="https://blog.finxter.com/python-list-methods-cheat-sheet-instant-pdf-download/" title="Python List Methods Cheat Sheet [Instant PDF Download]" target="_blank" rel="noreferrer noopener">Python List Methods Cheat Sheet [Instant PDF Download]</a></li>
<li><a href="https://blog.finxter.com/cheat-sheet-6-pillar-machine-learning-algorithms/" target="_blank" rel="noreferrer noopener" title="[Cheat Sheet] 6 Pillar Machine Learning Algorithms">[Cheat Sheet] 6 Pillar Machine Learning Algorithms</a></li>
</ul>
</div>
</div>
</div>
https://www.sickgaming.net/blog/2023/04/...onversion/