<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: jpetoskey</title>
    <description>The latest articles on Forem by jpetoskey (@jpetoskey).</description>
    <link>https://forem.com/jpetoskey</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F764553%2Fa9daa6f3-ed4a-4f77-9830-4350e3a92ecf.png</url>
      <title>Forem: jpetoskey</title>
      <link>https://forem.com/jpetoskey</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/jpetoskey"/>
    <language>en</language>
    <item>
      <title>Learn to Kaggle</title>
      <dc:creator>jpetoskey</dc:creator>
      <pubDate>Thu, 09 Jun 2022 17:20:02 +0000</pubDate>
      <link>https://forem.com/jpetoskey/learn-to-kaggle-c86</link>
      <guid>https://forem.com/jpetoskey/learn-to-kaggle-c86</guid>
      <description></description>
    </item>
    <item>
      <title>Time Series Decomposition - Spotting Seasonality</title>
      <dc:creator>jpetoskey</dc:creator>
      <pubDate>Mon, 02 May 2022 20:39:55 +0000</pubDate>
      <link>https://forem.com/jpetoskey/time-series-decomposition-spotting-seasonality-4e71</link>
      <guid>https://forem.com/jpetoskey/time-series-decomposition-spotting-seasonality-4e71</guid>
      <description>&lt;p&gt;The results fascinated me -- seasonal patterns when none were visible in the raw data.&lt;/p&gt;

&lt;p&gt;I had looked at trends in this visualization of the median price of homes by zip code: &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wtTH8UI6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kcqia3xoztukbsy36pxl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wtTH8UI6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kcqia3xoztukbsy36pxl.png" alt="median price of homes" width="880" height="589"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And, mainly noticed the upward and downward trend in the median price.&lt;/p&gt;

&lt;p&gt;However, when I performed and plotted a seasonal decomposition with statsmodels.tsa.seasonal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Import and apply seasonal_decompose()
from statsmodels.tsa.seasonal import seasonal_decompose
decomposition = seasonal_decompose(np.log(percent1))

# Gather the trend, seasonality, and residuals 
trend = decomposition.trend
seasonal = decomposition.seasonal
residual = decomposition.resid

# Plot gathered statistics
plt.figure(figsize=(12,8))
plt.subplot(411)
plt.plot(np.log(m1), label='Original', color='blue')
plt.legend(loc='best')
plt.subplot(412)
plt.plot(trend, label='Trend', color='blue')
plt.legend(loc='best')
plt.subplot(413)
plt.plot(seasonal,label='Seasonality', color='blue')
plt.legend(loc='best')
plt.subplot(414)
plt.plot(residual, label='Residuals', color='blue')
plt.legend(loc='best')
plt.tight_layout()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I noticed something surprising in the seasonality output - seasonality! &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pVesiVmP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mm54anw4oo7hn948t0qt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pVesiVmP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mm54anw4oo7hn948t0qt.png" alt="seasonality! :)" width="863" height="568"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I enjoyed seeing the seasonal pattern.  I had always heard that prices were slightly higher in the spring/summer months, but it is confirming to see it in the decomposition.&lt;/p&gt;

&lt;p&gt;I am now wondering about the magnitude of the trend.  I know the magnitude can't be too large, but I'm not sure how large.  &lt;/p&gt;

&lt;p&gt;I am curious about how I would figure this out.&lt;/p&gt;

&lt;p&gt;So far I have tried reversing the log transformation that was part of the process of decomposing the original data, but then I am left with a result of 1, as the magnitude of the seasonal trend oscillates between -0.001 and 0.0005.  I'm guessing the seasonal difference is greater than $1 in the real estate market with median prices varying in the data for this zip code between $120,000 and $700,000.&lt;/p&gt;

&lt;p&gt;If anyone reads this and has answers, please message me or comment - &lt;a href="mailto:Jim.Petoskey.146@gmail.com"&gt;Jim.Petoskey.146@gmail.com&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>datascience</category>
      <category>patterns</category>
    </item>
    <item>
      <title>Use Random Forest Feature Importance for Feature Selection</title>
      <dc:creator>jpetoskey</dc:creator>
      <pubDate>Tue, 29 Mar 2022 16:43:13 +0000</pubDate>
      <link>https://forem.com/jpetoskey/use-random-forest-feature-importance-for-feature-selection-1l38</link>
      <guid>https://forem.com/jpetoskey/use-random-forest-feature-importance-for-feature-selection-1l38</guid>
      <description>&lt;p&gt;Saving on computation is a priority for me, as I am practicing data science on an old machine, and don't currently have access to cloud computing software.&lt;/p&gt;

&lt;p&gt;So, what to do when recursive feature selection (RFE) runs for 20 minutes while I take a snack break and is still spinning when I return?&lt;/p&gt;

&lt;p&gt;The answer is scikitlearn's model.feature_importances_.&lt;/p&gt;

&lt;p&gt;My Random Forest models are among my best, so this feature is a really nice way to save on computation and still return a high-performing model.&lt;/p&gt;

&lt;p&gt;After fitting, predicting, running a confusion matrix, and a classification report, I turn to feature importance so I am able to iterate and improve my model by running it on fewer features, or report the feature importance to my superiors.&lt;/p&gt;

&lt;p&gt;See this bit of documentation code from &lt;a href="https://scikit-learn.org/stable/auto_examples/ensemble/plot_forest_importances.html" rel="noopener noreferrer"&gt;sklearn's Feature importances with a forest of trees web page&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One of my favorite things to do with this information, is produce a top ten features bar chart that plots the features by importance.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwc1d4hxoq2haaw9v3asz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwc1d4hxoq2haaw9v3asz.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And, here is the code I copied or wrote to produce it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Feature importance
features = pd.DataFrame(forest6.feature_importances_)
features['Feature'] = X_train.columns.values
features['Feature Importance'] = features[0]
features = features.drop(0, axis=1)
features = features.sort_values(by=['Feature Importance'], ascending=True)
features = features.nlargest(n=10, columns=['Feature Importance'])
features

import matplotlib.style as style
# style.available
style.use('fivethirtyeight')

plt.figure(figsize=(8,8))
plt.barh(range(10), features['Feature Importance'], align='center') 
plt.yticks(np.arange(10), features['Feature']) 
plt.xlabel('Feature importance (Weight)')
plt.ylabel('Feature')
plt.title('Top Ten Features by Importance')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I hope this helps you enjoy feature_importances_ by scikitlearn!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Interpreting Coefficients  to Reap Return on Renovation</title>
      <dc:creator>jpetoskey</dc:creator>
      <pubDate>Fri, 25 Feb 2022 20:09:29 +0000</pubDate>
      <link>https://forem.com/jpetoskey/interpreting-coefficients-1c35</link>
      <guid>https://forem.com/jpetoskey/interpreting-coefficients-1c35</guid>
      <description>&lt;p&gt;Summary: This post is about the benefits and drawbacks of using raw, logged, and normalized data for interpreting coefficients of multiple linear regressions.&lt;/p&gt;

&lt;p&gt;Coefficients, in this case, are the numbers in front of X, represented by the letter B, in a multiple linear regression equation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Txt_Nh06--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m8ndwq04bklrdtplyg52.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Txt_Nh06--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m8ndwq04bklrdtplyg52.jpeg" alt="Image description" width="516" height="98"&gt;&lt;/a&gt;&lt;br&gt;
-image from towardsdatascience.com&lt;/p&gt;

&lt;p&gt;See an example of a statsmodels Ordinary Least Squares Regression Analysis with coefficients below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WsBdp2c8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/blre5pnw886kkoaieb5m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WsBdp2c8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/blre5pnw886kkoaieb5m.png" alt="Image description" width="599" height="723"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The coefficients provide insight into how certain features impact the slope of the trend line in a multiple linear regression.  They are important for understanding which features correlate well with the dependent variable and how much they influence the slope of the model.&lt;/p&gt;

&lt;p&gt;However, interpreting the coefficients is not simple and they shouldn't be accepted at face value.&lt;/p&gt;

&lt;p&gt;For example, after logging, normalizing, and modeling numerical data on a King County Housing data set, I noticed that an increase in square footage strongly influenced the price of a house in  positive terms, while adding a bedroom influenced the price in negative terms.  Interpreting this at face value, it could be said that adding bedrooms will decrease the price of a home. However, knowing that this is likely not true based on background knowledge, and the fact that adding a bedroom would typically add square footage, it can be surmised that the negative correlation for bedrooms to price is likely the result of a conflating variable, such as location.  I'm imagining a lot of homes with fewer bedrooms that are closer to city-centers in King County with higher prices causing this trend.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;For this model, I was thinking about how dividing an existing room into two bedrooms would decrease price, as square footage would stay constant. So, maybe don't divide an existing room into two bedrooms in your next home remodel.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is a good example of how understanding source data of the coefficients allows them to be interpreted accurately.&lt;/p&gt;

&lt;p&gt;In addition, linear models can be built of a combination of raw, logged, and normalized data, so coefficients need to be interpreted differently in each case. I like having models where all predictors or features are raw, logged, or normalized.  And, I like having one of each model, because each type of data has its own benefit.&lt;/p&gt;

&lt;p&gt;Raw data provides the most insight into actual or real change in the dependent and independent variables because the coefficient can be read to mean a certain value change in the independent variable for a given change in the dependent variable.  For example, in the King County housing data set I referred to earlier, the price of a house increased by $211.46 for each additional square foot.  This coefficient is easy to use in a non-technical presentation.  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oBLrNAEZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ifwxyglbiic8r3nf7zzt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oBLrNAEZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ifwxyglbiic8r3nf7zzt.png" alt="Image description" width="679" height="727"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When I used logged data, it allowed me to determine  the percent change.  &lt;a href="https://stats.oarc.ucla.edu/sas/faq/how-can-i-interpret-log-transformed-variables-in-terms-of-percent-change-in-linear-regression"&gt;See this web page by UCLA's Advanced Research Computing, Statistical Methods and Data Analytics team.&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;For example, I could say that an increase of 0.66% in square footage would lead to a 1% increase in price.  Or, in simpler terms, an increase in square footage of 7% would increase the price of a home by more than 10%.  This could also be a helpful metric for a non-technical audience.&lt;/p&gt;

&lt;p&gt;However, when building a predictive model, that doesn't need to produce coefficients for a non-technical audience, it is often best to produce models with logged and normalized data.  The manipulated data allows the model to fit the assumptions of linearity, especially in regards to normality and heteroscedasticity, and for the magnitude of the coefficients to be directly compared to each other.&lt;/p&gt;

&lt;p&gt;See how the assumptions of linearity can only be met in this model with logged and normalized data.&lt;/p&gt;

&lt;p&gt;Logged and Normalized Data:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2CsqBjAY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/80ek66rp81h9zy7t9d10.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2CsqBjAY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/80ek66rp81h9zy7t9d10.png" alt="Image description" width="690" height="499"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--riEM98NQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iqb7faaailq688ahcso1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--riEM98NQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iqb7faaailq688ahcso1.png" alt="Image description" width="595" height="507"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Raw Data:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NbQgBBZN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/91m6ppjx4k2tzou00jmc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NbQgBBZN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/91m6ppjx4k2tzou00jmc.png" alt="Image description" width="704" height="515"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VWeoXTSH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uxsz6v74xd53onyqg1wl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VWeoXTSH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uxsz6v74xd53onyqg1wl.png" alt="Image description" width="478" height="521"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It is apparent, above, that this is true for the King County housing data set, in which the logged and normalized data led to a model that met the assumptions of linearity and produced coefficients that showed square footage had a more positive influence on price than bathrooms, bedrooms, year built, or floors.  However, it should be noted that this model did not provide a way to determine how much square footage would need to be added to equal the addition of one bathroom.  A model built on raw data would be better for interpreting real value changes in the dependent and independent variables.&lt;/p&gt;

&lt;p&gt;In sum, models that are built on raw, logged, and normalized data each have different strengths, weaknesses, and methods for interpretation.  Using a combination of the data types is best when trying to build inferential and predictive models as each model can communicate the influence of features in different terms.  And, having background knowledge that helps explain certain unexpected trends is helpful, if not critical.&lt;/p&gt;

&lt;p&gt;After writing this post, I realized that people would likely want to know what they should do to improve the price of their home.  Most surprising for me was that interior upgrades, especially in regards to the condition of the whole home, can have a dramatically positive influence on home price.  Other remodel tips gleaned from the data set were to create a view - maybe add or increase the size of a window or build a deck, and to add livable square footage - maybe by converting a garage to living space.&lt;/p&gt;

&lt;p&gt;In terms of metrics from the raw coefficients:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Every increase in 1 square foot, the price increased by 211.46 dollars. This is an increase of 105,730.00 dollars for every 500 square feet.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In log terms, a 6.7% increase in square footage corresponded to a 10% increase in home price.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For every additional bedroom, the price decreased by 42,200 dollars. This is an issue in the model because homes with fewer bedrooms are likely to cost more than homes with more bedrooms - likely conflated by other variables such as location.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For each additional bathroom, the price of a home increased by $55,570.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>python</category>
      <category>datascience</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Pick a genre, many genres?</title>
      <dc:creator>jpetoskey</dc:creator>
      <pubDate>Sun, 05 Dec 2021 21:38:41 +0000</pubDate>
      <link>https://forem.com/jpetoskey/pick-a-genre-many-genres-212h</link>
      <guid>https://forem.com/jpetoskey/pick-a-genre-many-genres-212h</guid>
      <description>&lt;p&gt;My first performance task in my data science program with Flatiron School has been to produce recommendations for the theoretical Microsoft Studios about their first movie.  After looking through the data, I decided to explore genre first, to see if I noticed any trends.&lt;/p&gt;

&lt;p&gt;As I was joining genre to the movie titles in a separate csv, I was surprised to see that some genre pairings were more common than others.  For example, adventure, the most popular genre in the top 50 grossing movies, is most often paired with action.  I can remember my father talking about which movies he liked when I was a kid, and his descriptions often involved action and adventure.  When he dragged me to Disney's Pocahontas, I was pleasantly surprised with action and adventure, despite my preconception of it being a romance.&lt;/p&gt;

&lt;p&gt;However, counting movies by genre pairs or combinations didn't give me enough reliable information to make recommendations to theoretical Microsoft Studios, as you can see in this histogram.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsql1y8kf6jyc7j2qvc8f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsql1y8kf6jyc7j2qvc8f.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thinking of a movie as one particular genre can be rather limiting. I think this is why we are currently observing the trend that Jourdan Alderidge describes in The Beat.  They write, "The majority of content produced in the last several decades are often genre hybrids, using the rules of genre theory to produce new, unique, and different stories" (&lt;a href="https://www.premiumbeat.com/blog/guide-to-basic-film-genres/" rel="noopener noreferrer"&gt;The Beat&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;However, I was determined to pull individual genres because understanding the pattern of individual genres would be important when theoretical Microsoft Studios is planning their first movie.  This resulted in some difficulty, as the genres were saved in the object data type, and to explode them into distinct rows, I would need them in a list.&lt;/p&gt;

&lt;p&gt;This &lt;a href="https://towardsdatascience.com/how-to-quickly-create-and-unpack-lists-with-pandas-d0e78e487c75" rel="noopener noreferrer"&gt;resource&lt;/a&gt; was invaluable and provided me with the code needed to convert the string into a list, based on the location of each comma. Without the comma indicator, split(), will split a string on whitespace, but we do not have whitespace in our string, so we specify for it to split(',') on the comma.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;df3['Genre'] = df3['Genre'].str.split(',')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I was then able to use the explode method and pull each genre into a new row.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;df2 = df2.explode('Genre')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once all the genre's were in separate rows, I was able to produce a histogram of the genres of the top 50 grossing movies.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpj0wfmo0ufzenre2w7hc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpj0wfmo0ufzenre2w7hc.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This made me happy and seemed to give me more relevant information to make recommendations to Microsoft.  And, going back to my Dad's preferences, it seems action/adventure is a good place to start.&lt;/p&gt;

</description>
      <category>datascience</category>
      <category>firstyearincode</category>
    </item>
  </channel>
</rss>
