<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Rifyal R on Medium]]></title>
        <description><![CDATA[Stories by Rifyal R on Medium]]></description>
        <link>https://medium.com/@rifyalrachmat?source=rss-1f58a1ac5264------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*7XM0rzRzIdzq6cZg3PgcDg.png</url>
            <title>Stories by Rifyal R on Medium</title>
            <link>https://medium.com/@rifyalrachmat?source=rss-1f58a1ac5264------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 08:30:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rifyalrachmat/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[From Playlists to Predictions: Understanding Churn in Sparkify]]></title>
            <link>https://medium.com/@rifyalrachmat/from-playlists-to-predictions-understanding-churn-in-sparkify-24f0be812851?source=rss-1f58a1ac5264------2</link>
            <guid isPermaLink="false">https://medium.com/p/24f0be812851</guid>
            <category><![CDATA[udacity-nanodegree]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[sparkify]]></category>
            <dc:creator><![CDATA[Rifyal R]]></dc:creator>
            <pubDate>Fri, 15 Sep 2023 01:03:52 GMT</pubDate>
            <atom:updated>2023-09-15T05:41:11.866Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>“In streams of notes, where melodies intertwine, Some users drift away, while others still align. Yet in the rhythm’s ebb and flow, patterns do emerge, With data’s guiding hand, we predict the next surge.”</blockquote><figure><img alt="People who intent to buy if it is interesting (source : canva pro)" src="https://cdn-images-1.medium.com/max/657/1*4NtbkTED3lHvaTEsVMg1Pg.png" /><figcaption>People who intent to buy if it is interesting (source : canva pro)</figcaption></figure><h3>Brief:</h3><p>In this project, we delve into the <strong>Sparkify </strong>dataset, a collection of user activity logs from a fictional music streaming service. Our goal is to analyze user behavior and build a model that can predict customer churn. With the help of Apache Spark, we process and analyze a large volume of data to extract meaningful insights and develop a robust predictive model.</p><p>This workspace contains a tiny subset (128MB) of the full dataset available (12GB). The full dataset provides a comprehensive view of user behavior, but for the sake of this analysis, we’ll be working with a smaller subset. This approach allows us to quickly prototype our solution before potentially scaling up to larger data volumes.</p><p><strong><em>Design of Step by Step that we will conduct:</em></strong></p><ol><li>Load and clean the dataset, ensuring that we handle any missing or anomalous data.</li><li>Perform exploratory data analysis (EDA) to understand the patterns and characteristics of the data.</li><li>Feature engineering to transform raw data into meaningful features that can feed into our machine learning model.</li><li>Model building, evaluation, and optimization.</li><li>Conclusion and next steps.</li></ol><h4>Initial Solutions:</h4><p>a. Data Preprocessing:</p><ul><li>The first step was to understand the dataset’s structure and its missing values. An initial solution was to drop the null values directly. However, further analysis showed specific columns like ‘artist’, ‘length’, and ‘song’ had a substantial number of null values, and thus, this strategy was reconsidered.</li><li>After initial data exploration, the process of crafting a comprehensive feature matrix began. The extraction of meaningful features and crafting new ones like the number of thumbs up, thumbs down, songs added to the playlist, etc., was part of the intermediate solutions.</li></ul><p>b. Feature Engineering:</p><ul><li>After initial data exploration, the process of crafting a comprehensive feature matrix began. The extraction of meaningful features and crafting new ones like the number of thumbs up, thumbs down, songs added to the playlist, etc., was part of the intermediate solutions.</li></ul><p>c. Initial Modeling:</p><ul><li>RandomForest were introduced. Also, feature importance was considered to refine the feature matrix and eliminate less impactful features.</li></ul><h4>Final Itteration:</h4><p>a Hyperparameter Tuning and other model trial:</p><ul><li>The next step after applying RandomForest was to optimize its parameters. Hyperparameter tuning was done to find the best parameters for the RandomForest model, ensuring better performance. We will also compare with LogisticRegression and Gradient Boosting Classifiers.</li></ul><p>b. Model Evaluation:</p><ul><li>After several iterations and improvements, the final model was evaluated using the F1 score, considering the class imbalance. The final F1 score on the test data showcased the model’s efficiency.</li></ul><p>The primary dataset we’re working with in this workspace is the mini_sparkify_event_data.json. The first step in our analysis involves loading this dataset and performing initial data cleaning. This includes handling missing values, especially records without user IDs or session IDs.</p><p><strong>## Installation for the project:</strong></p><p>The project library will included in requirement.txt file. You need to execute:</p><pre>pip install -r requirements.txt</pre><pre>Library used :<br>- Pandas<br>- NumPy<br>- Matplotlib<br>- Seaborn<br>- PySpark (including pyspark.ml)</pre><h3>So we will start from Exploratory Data Analysis (EDA):</h3><p>Once the data is cleaned, the next step is to dive deeper into the dataset. EDA helps us understand the nuances of our data. By visualizing and summarizing different aspects of the data, we can derive initial insights and identify patterns or anomalies that can be crucial for the subsequent stages of our analysis.</p><h4>First Step : Definition of the Churn</h4><p>We identifies users who have indicated their intent to cancel the service by marking a “Cancellation Confirmation” page event. This provides a clear binary label for each user, indicating if they have churned (1) or not (0)</p><pre>from pyspark.sql.functions import col, lit, max<br><br># Add a column that is 1 if the event is &quot;Cancellation Confirmation&quot;, 0 otherwise<br>df = df.withColumn(&quot;churn_event&quot;, (col(&quot;page&quot;) == &quot;Cancellation Confirmation&quot;).cast(&quot;int&quot;))<br><br># For each user, identify if they ever had a &quot;Cancellation Confirmation&quot; event<br>user_churn = df.groupby(&quot;userId&quot;).agg(max(&quot;churn_event&quot;).alias(&quot;Churn&quot;))<br><br># Join the churn data back to the original dataset<br>df = df.join(user_churn, on=&quot;userId&quot;, how=&quot;left&quot;)<br><br># Display some rows to verify<br>df.select([&quot;userId&quot;, &quot;page&quot;, &quot;Churn&quot;]).show(20)</pre><h4>Next EDA : User level by number of song played</h4><p>Understanding the distribution of user-level statistics focusing on number by song played per UserID, can help determine what behaviors are typical for users who churn compared to those who don’t.</p><p>The majority of users have a moderate amount of activity, but there is a tail of users who are particularly active. These could be power users or enthusiasts. It’s crucial to understand the behavior of these outliers, as they might be driving a significant portion of the platform’s engagement.</p><pre>+-----+-------------------+<br>|Churn|unique_songs_played|<br>+-----+-------------------+<br>|    1|              19216|<br>|    0|              53336|<br>+-----+-------------------+<br><br>+-----+-----------------+<br>|Churn|     avg_sessions|<br>+-----+-----------------+<br>|    1|613.3161777817404|<br>|    0|1125.109816108706|<br>+-----+-----------------+</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*s7gAHkfk-8Srv-s8Y7CaZg.png" /><figcaption>Session end duration by Churned vs. Non-Churned Users</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*Znk-_BJJLOxhLxpYsVqzTg.png" /><figcaption>Average Number of Songs Played by Churned vs. Non-Churned Users</figcaption></figure><h4>Also Important: Engagement Metrics &amp; Account Information</h4><p>Session duration : Aggregate session durations by churn status:</p><pre>+-----+-----------------------------+-------------------------------------+-----------------------------+-----------------------------+<br>|Churn|avg(session_duration_minutes)|stddev_samp(session_duration_minutes)|max(session_duration_minutes)|min(session_duration_minutes)|<br>+-----+-----------------------------+-------------------------------------+-----------------------------+-----------------------------+<br>|    1|           283.12153941651144|                   375.31925163016365|            3300.016666666667|                          0.0|<br>|    0|            302.8553618794999|                    393.2417448405121|            4455.083333333333|                          0.0|<br>+-----+-----------------------------+-------------------------------------+-----------------------------+-----------------------------+</pre><p>Number of Thumbs Up, Thumbs Down, Adds to Playlist, and Friend Additions:</p><pre>+-----+------------------+------------------+--------------------+------------------+<br>|Churn|    avg(Thumbs Up)|  avg(Thumbs Down)|avg(Add to Playlist)|   avg(Add Friend)|<br>+-----+------------------+------------------+--------------------+------------------+<br>|    1|36.450980392156865|  9.72549019607843|  20.352941176470587|12.470588235294118|<br>|    0| 62.89411764705882|12.058823529411764|   32.28235294117647| 21.41764705882353|<br>+-----+------------------+------------------+--------------------+------------------+</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*YBowNFldVXkArPNt8ARcVQ.png" /><figcaption>Average Engagement Metrics for Churned vs. Non-Churned Users</figcaption></figure><p>Subscription Type (Free/Paid) :</p><pre>+-----+-----+-----+<br>|Churn|level|count|<br>+-----+-----+-----+<br>|    0| free|   90|<br>|    0| paid|   83|<br>|    1| paid|   21|<br>|    1| free|   31|<br>+-----+-----+-----+</pre><p>Duration Since Registration:</p><pre>+-----+------------------------+--------------------------------+------------------------+------------------------+<br>|Churn|avg(total_duration_days)|stddev_samp(total_duration_days)|max(total_duration_days)|min(total_duration_days)|<br>+-----+------------------------+--------------------------------+------------------------+------------------------+<br>|    1|       57.30599292200857|                36.6331481313374|       188.3117824074074|       5.165115740740741|<br>|    0|       86.62061938021833|               35.34864197873643|       256.3776736111111|     0.31372685185185184|<br>+-----+------------------------+--------------------------------+------------------------+------------------------+</pre><p>Errors and Help Page Visits:</p><pre>+-----+------------------+------------------+<br>|Churn|        avg(Error)|         avg(Help)|<br>+-----+------------------+------------------+<br>|    1|0.7272727272727273| 5.431818181818182|<br>|    0|1.4379084967320261|7.9411764705882355|<br>+-----+------------------+------------------+</pre><h3>Modeling Part : Feature Engineering</h3><p>Feature engineering is a crucial step in the machine learning pipeline. It involves transforming raw data into a format that can be easily understood and processed by machine learning algorithms. By creating new features or modifying existing ones, we can enhance the performance of our models and uncover hidden patterns in the data.</p><pre>feature_metrics.printSchema()<br>root<br> |-- userId: string (nullable = true)<br> |-- total_songs: long (nullable = true)<br> |-- total_session_time: double (nullable = false)<br> |-- avg_songs_per_session: double (nullable = false)<br> |-- num_thumbs_up: long (nullable = true)<br> |-- num_thumbs_down: long (nullable = true)<br> |-- total_time_registered: double (nullable = false)<br> |-- num_friends_added: long (nullable = true)<br> |-- num_errors: long (nullable = true)<br> |-- num_ads_played: long (nullable = true)<br> |-- paid_level: integer (nullable = true)<br> |-- num_unique_artists: long (nullable = true)<br> |-- num_sessions: long (nullable = true)<br> |-- avg_session_duration: double (nullable = false)<br> |-- songs_added_to_playlist: long (nullable = true)<br> |-- num_upgrades: long (nullable = true)<br> |-- num_downgrades: long (nullable = true)<br> |-- Churn: integer (nullable = true</pre><p>1. <strong>Total Songs Played: </strong>This feature represents the total number of songs each user has listened to. It’s an indicator of user engagement and activity on the platform. Users who play more songs might be more engaged or satisfied with the service.</p><p>2. <strong>Total Session Time: </strong>This captures the total time a user has spent on the platform. Longer session times might indicate higher engagement or satisfaction, while shorter session times could suggest a lack of interest or potential technical issues.</p><p>3. <strong>Average Songs per Session:</strong> This metric provides insight into the average number of songs a user listens to in a single session. It can give us an idea about the user’s typical behavior and engagement during each visit.</p><p>4. <strong>Thumbs Up/Down:</strong> These features indicate users’ likes and dislikes. A high number of thumbs up can signify satisfaction with the content, while many thumbs down might indicate dissatisfaction or issues with song recommendations.</p><p>5. <strong>Total Time Since Registration: </strong>This measures the duration a user has been registered with the service. It helps in distinguishing between new and long-term users. Longer durations might signify loyalty or satisfaction with the service.</p><p>6. <strong>Number of Friends Added:</strong> Adding friends can be an indicator of social engagement on the platform. Users who add more friends might be more socially active or reliant on friend’s recommendations for song choices.</p><p>7. <strong>Total Errors Encountered:</strong> This feature captures the number of errors a user has faced. Frequent errors can be a red flag, indicating potential churn due to technical issues.</p><p>8. <strong>Advertisements Played:</strong> The number of ads played can be a reflection of user engagement and their subscription type (paid vs. free). High ad counts might annoy free-tier users, pushing them towards churning.</p><p>9. <strong>Paid vs. Free Subscription: </strong>This binary feature distinguishes between users with a paid subscription and those using the platform for free. Paid users might exhibit different behaviors and churn patterns compared to free users.</p><p>10. <strong>Unique Artists Listened:</strong> The number of unique artists a user has listened to can indicate the diversity of their musical taste. It can also reflect the platform’s ability to introduce users to new artists.</p><p>11. <strong>Number of Sessions:</strong> This measures how often a user logs into the platform. Frequent sessions might indicate higher engagement.</p><p>12. <strong>Average Time per Session:</strong> This represents the average duration a user spends on the platform during each session. It can provide insights into user behavior and engagement patterns.</p><p>13. <strong>Songs Added to Playlist:</strong> Adding songs to a playlist can be a sign of engagement and satisfaction with the content. It can also indicate a user’s intent to return to the platform.</p><p>14. <strong>Number of Upgrades or Downgrades:</strong> These features capture the number of times a user has upgraded or downgraded their subscription. Frequent changes might indicate indecision or varying satisfaction levels with the platform’s offerings.</p><h3>Modeling and : Churn prediction</h3><h4>Initial Model</h4><p>After careful data preprocessing and feature engineering, we proceeded to the modeling phase. Given the nature of the data and the problem (binary classification), a RandomForestClassifier was chosen as the primary modeling algorithm. Random forests are powerful ensemble methods that combine multiple decision trees to produce a more generalized model. They work exceptionally well for datasets with a large number of features, as is the case with our Sparkify dataset.</p><pre>from pyspark.ml.tuning import TrainValidationSplit<br>from pyspark.ml import Pipeline<br>from pyspark.ml.classification import RandomForestClassifier<br>from pyspark.ml.feature import VectorAssembler<br>from pyspark.ml.evaluation import MulticlassClassificationEvaluator<br>from pyspark.ml.tuning import CrossValidator, ParamGridBuilder<br><br>def split_dataset(data, train_fraction=0.7, test_fraction=0.15, seed=42):<br>    &quot;&quot;&quot;<br>    Split the data into train, test, and validation sets.<br>    &quot;&quot;&quot;<br>    train, rest = data.randomSplit([train_fraction, 1 - train_fraction], seed=seed)<br>    test, validation = rest.randomSplit([test_fraction / (1 - train_fraction), <br>                                         1 - test_fraction / (1 - train_fraction)], <br>                                        seed=seed)<br>    return train, test, validation<br><br><br><br>def modeling(data, features, target_col):<br>    &quot;&quot;&quot;<br>    Model the data using RandomForest.<br>    &quot;&quot;&quot;<br>    assembler = VectorAssembler(inputCols=features, outputCol=&quot;features_vec&quot;)<br>    <br>    rf = RandomForestClassifier(labelCol=target_col, featuresCol=&quot;features_vec&quot;, numTrees=10)<br>    <br>    pipeline = Pipeline(stages=[assembler, rf])<br>    model = pipeline.fit(data)<br>    <br>    return model<br><br>def evaluation(model, test_data):<br>    &quot;&quot;&quot;<br>    Evaluate the model&#39;s performance.<br>    &quot;&quot;&quot;<br>    predictions = model.transform(test_data)<br>    evaluator = MulticlassClassificationEvaluator(labelCol=&quot;Churn&quot;, metricName=&quot;f1&quot;)<br>    f1_score = evaluator.evaluate(predictions)<br>    <br>    return f1_score<br><br>from pyspark.ml.tuning import TrainValidationSplit<br><br>def optimized_hyperparameter_tuning(train_data, features, target_col):<br>    &quot;&quot;&quot;<br>    Perform optimized hyperparameter tuning.<br>    &quot;&quot;&quot;<br>    assembler = VectorAssembler(inputCols=features, outputCol=&quot;features_vec&quot;)<br>    rf = RandomForestClassifier(labelCol=target_col, featuresCol=&quot;features_vec&quot;, featureSubsetStrategy=&quot;sqrt&quot;)<br>    <br>    pipeline = Pipeline(stages=[assembler, rf])<br>    <br>    paramGrid = ParamGridBuilder() \<br>        .addGrid(rf.numTrees, [10, 20]) \<br>        .addGrid(rf.maxDepth, [5, 10]) \<br>        .build()<br>    <br>    # Using TrainValidationSplit for faster tuning<br>    split = TrainValidationSplit(estimator=pipeline,<br>                                 estimatorParamMaps=paramGrid,<br>                                 evaluator=MulticlassClassificationEvaluator(labelCol=target_col, metricName=&quot;f1&quot;),<br>                                 trainRatio=0.8)<br>    <br>    bestModel = split.fit(train_data)<br>    return bestModel</pre><h4>Feature Importance:</h4><pre># Interpret the Model:<br>importances = rf_model.stages[-1].featureImportances<br>importance_list = [(feature, importance) for feature, importance in zip(feature_cols, importances)]<br>sorted_importance_list = sorted(importance_list, key=lambda x: x[1], reverse=True)<br><br>print(&quot;Feature Importances:&quot;)<br>for feature, importance in sorted_importance_list:<br>    print(f&quot;{feature}: {importance}&quot;)<br><br>Result Feature Importances:<br>total_session_time: 0.27751268109056726<br>total_time_registered: 0.14659233398892035<br>songs_added_to_playlist: 0.08827309757669927<br>num_friends_added: 0.06586795618673666<br>avg_session_duration: 0.0653964215421873<br>num_thumbs_down: 0.05566514362714931<br>total_songs: 0.04961047220027176<br>num_thumbs_up: 0.04937978115684974<br>avg_songs_per_session: 0.04680448172725686<br>num_unique_artists: 0.04170472477104371<br>num_sessions: 0.04137576262158161<br>num_ads_played: 0.03341217249618633<br>num_downgrades: 0.01924360498483394<br>paid_level: 0.010490742708864265<br>num_upgrades: 0.005777770882040898<br>num_errors: 0.002892852438810847</pre><p>One of the key benefits of using tree-based models like Random Forests is their ability to quantify the importance of each feature in predicting the target variable. Let’s dive into the most influential features in predicting churn:</p><ol><li><strong>Total Session Time (27.75%):</strong> This metric indicates the total time a user spends on the platform. It’s the most influential feature in predicting churn, suggesting that users who spend less time overall may be more prone to churn.</li><li><strong>Total Time Registered (14.66%):</strong> The length of time since a user’s registration also plays a significant role. This could imply that newer users might be more volatile, or it could show that the longer a user stays, the more committed they become.</li><li><strong>Songs Added to Playlist (8.83%): </strong>Users who frequently add songs to their playlists likely engage more with the platform, making them less likely to churn.</li><li><strong>Number of Friends Added (6.59%): </strong>Social connections can enhance user stickiness. Those who connect with friends might be more invested in the platform.</li><li><strong>Average Session Duration (6.54%): </strong>Longer average sessions might indicate higher user engagement and satisfaction.</li></ol><p>It’s important to note that while these features have high predictive power in our model, they might not necessarily cause churn. For instance, just because a user has a short average session duration doesn’t mean they will churn; however, it could be a significant indicator.</p><h4>Model Performance:</h4><p>The F1 Score is a measure that considers both precision (how many of the predicted churns were actual churns) and recall (how many of the actual churns were correctly predicted by our model). Given the imbalanced nature of our dataset, with churned users being a relatively small subset, the F1 score is a more appropriate metric than mere accuracy.</p><p>Our model achieved an F1 Score of 0.9132 on the test data. This is a robust score, indicating that our model has a good balance of precision and recall. It successfully identifies a high proportion of users at risk of churning, which would allow Sparkify to take proactive measures to retain them.</p><h4>Final Itteration:</h4><p>Model evaluation performed prediction on 30% sample (test data) using best parameter from previous step. Results showcase the RandomForestClassifiers as the most effective, boasting an F1 score of <strong>0.9132</strong>.</p><p>Model Performance Comparison:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/362/1*2V4ZPp-z6xM1iPseO6n-zw.png" /><figcaption>Modeling Perfomance comparison</figcaption></figure><p>When building a predictive model, it’s essential to evaluate its performance to ensure its reliability and effectiveness. In our case, the F1 Score serves as the primary metric, providing a balance between precision and recall. The Logistic Regression Classifier, being a simple linear algorithm, has provided a decent F1 score. It’s a good starting point, but there’s room for improvement. The Random Forest Classifier outperformed the Logistic Regression model. Random Forests, with their ensemble approach of combining multiple decision trees, have the ability to capture complex patterns in the data, leading to a higher F1 score in this scenario .The Gradient Boosting Classifier provided a competitive F1 score close to the Random Forest Classifier. Gradient Boosting optimizes on errors of prior trees, which often makes it a strong contender in predictive tasks.</p><h3>Challenges Faced During the Process</h3><ol><li>Handling Null Values: The dataset contained several columns with null values. Specifically, the columns ‘artist’, ‘length’, and ‘song’ had significant null values. Deciding how to handle these missing values, whether to impute or drop them, is always a challenge in data preprocessing.</li><li>Data Type Mismatch: When attempting to calculate session duration and user registration duration, there was a data type mismatch error due to the timestamp columns being in string format. Converting them to the correct data type was necessary for further analysis.</li><li>Feature Engineering: The process of creating a comprehensive feature matrix from the raw data involved a lot of transformations and aggregations. Extracting meaningful features like the number of thumbs up, thumbs down, songs added to the playlist, etc., required intricate data manipulation.</li><li>Modeling Challenges: During the hyperparameter tuning process, the computational time was long. This might indicate challenges in finding the best parameters for the RandomForest model in a reasonable timeframe, especially in a big data environment like PySpark.</li><li>Data Integration Issues: Merging and manipulating large datasets in Spark can be tricky. Especially when joining datasets on user IDs, I had to ensure data consistency and avoid any data leakages.</li><li>Performance Optimization: Handling big data in PySpark means dealing with performance issues. To counter this, I had to optimize code for better performance, especially during feature engineering. This involved choosing efficient methods and occasionally relying on sampling to speed up the exploratory phase.</li><li>Algorithm Implementation: Implementing machine learning algorithms in a distributed environment like Spark differs from a typical Python environment. I faced challenges in parameter tuning and ensuring the model was learning correctly. The hyperparameter tuning process, in particular, was time-consuming, and I had to balance the trade-off between computational time and model performance.</li><li>Dealing with Imbalance: The dataset was imbalanced with fewer churned users. This can be a challenge because machine learning models can be biased towards the majority class. I had to consider metrics like the F1 score instead of accuracy to get a real sense of model performance.</li></ol><h3>Conclusion</h3><p>The model’s high F1 score suggests it’s well-suited for identifying users at risk of churning. By understanding and leveraging the features that most influence churn, Sparkify can design targeted interventions to improve user retention.</p><p>Our exploratory data analysis provided valuable insights into user behavior and potential churn indicators.</p><ul><li><strong>Activity Distribution: </strong>A significant number of users were engaging with the ‘NextSong’ action, indicating a primary user interaction with the platform. However, ‘Thumbs Up’ and ‘Add to Playlist’ were also popular, emphasizing the importance of user feedback and personalization.</li><li><strong>Churn Behavior: </strong>We observed variations in user activity patterns leading up to the churn event. For instance, there was a visible decrease in positive interactions like ‘Thumbs Up’ and a spike in negative interactions such as ‘Thumbs Down’ and ‘Roll Advert’ among users who churned. This underscores the potential frustration or dissatisfaction among users just before they decide to leave.</li><li><strong>Session Analysis: </strong>The number of songs played during a session gave us an idea about user engagement. On average, users who didn’t churn seemed to have slightly longer sessions compared to those who did, suggesting that session length could be an indirect measure of satisfaction or engagement.</li></ul><p>The Random Forest Classifier emerged as the top-performing model among the ones tested, with an <strong>F1 Score of 0.9132</strong>. This underscores the power of ensemble methods, especially in complex datasets like ours where user behaviors can be diverse and multifaceted. However, it’s worth noting that while the Random Forest led in terms of performance, the Gradient Boosting Classifier was not far behind. Depending on the application and the computational resources available, one might opt for Gradient Boosting for its iterative approach to reducing errors. In the end, the choice of model should align with the specific needs and constraints of the project at hand. And here are some notable features:</p><ol><li>Total Session Time: The most influential feature, suggesting that overall engagement time on the platform is crucial.</li><li>Total Time Registered: Indicating the longevity of a user’s association with the platform plays a role in churn prediction.</li><li>Songs Added to Playlist: Emphasizing the importance of user engagement beyond just listening.</li><li>Number of Friends Added: Highlighting the platform’s social aspect.</li><li>Average Session Duration: Pointing towards the quality of each user interaction.</li></ol><h4>Final Thoughts:</h4><p>Churn prediction is paramount for businesses like Sparkify. By understanding the key factors that influence user churn, the platform can tailor its strategies, enhance user experience, and reduce the likelihood of users leaving. Our model provides a strong foundation for this, identifying critical areas of focus. However, as user behavior evolves, it will be essential to continually refine and adapt our predictive models, ensuring they remain relevant and effective.</p><p>In the future, Sparkify should consider integrating more features, exploring other advanced algorithms, and potentially leveraging user feedback directly to further enhance the model’s accuracy and the platform’s user retention strategies.</p><h3>Acknowledgement</h3><p>I would like to extend my heartfelt gratitude to <a href="https://learn.udacity.com/"><strong>Udacity </strong></a>for providing this invaluable dataset and for creating the opportunity to work on such a captivating real-world project. This experience has enriched my understanding and honed my skills, and I’m truly appreciative of the platform and mentors for their guidance.</p><p>You can access public notebook for the code in <a href="https://github.com/Rifyal-Rac/Final_Capstone_Udc">here</a>.</p><h3>References:</h3><ol><li>Hastie, T., Tibshirani, R., &amp; Friedman, J. (2009). <em>The Elements of Statistical Learning: Data Mining, Inference, and Prediction</em>. Springer Series in Statistics. <a href="https://web.stanford.edu/~hastie/Papers/ESLII.pdf">Link</a></li><li>Breiman, L. (2001). Random forests. <em>Machine learning, 45</em>(1), 5–32.</li><li>Provost, F., &amp; Fawcett, T. (2013). <em>Data Science for Business</em>. O’Reilly Media.</li><li>Chen, J., &amp; Song, X. (2018). Data-driven strategies to understand and mitigate subscriber churn in the telecom industry. <em>Industrial Marketing Management, 77</em>, 169–180.</li><li>Gupta, S., &amp; Zeithaml, V. (2006). Customer metrics and their impact on financial performance. <em>Marketing Science, 25</em>(6), 718–739.</li><li><a href="https://spark.apache.org/docs/latest/">Spark Documentation</a></li><li><a href="https://towardsdatascience.com/understanding-random-forest-58381e0602d2">Towards Data Science: Understanding Random Forest</a></li><li><a href="https://machinelearningmastery.com/handle-missing-data-python/">Machine Learning Mastery: Handle Missing Data with Pyspark</a></li><li><a href="https://www.datasciencecentral.com/profiles/blogs/customer-churn-prediction-using-machine-learning-main-challenges">Data Science Central: Customer Churn Prediction using Machine Learning: Main Challenges and Models</a></li><li><a href="https://hbr.org/2014/10/the-value-of-keeping-the-right-customers">Harvard Business Review: The Value of Keeping the Right Customers</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=24f0be812851" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[In-Depth Examination of the Journey Towards Achieving Optimum Remuneration for Developers]]></title>
            <link>https://medium.com/@rifyalrachmat/in-depth-examination-of-the-journey-towards-achieving-optimum-remuneration-for-developers-50b38532205e?source=rss-1f58a1ac5264------2</link>
            <guid isPermaLink="false">https://medium.com/p/50b38532205e</guid>
            <category><![CDATA[surveys]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-analysis]]></category>
            <dc:creator><![CDATA[Rifyal R]]></dc:creator>
            <pubDate>Thu, 15 Jun 2023 14:00:18 GMT</pubDate>
            <atom:updated>2023-06-18T16:56:45.112Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*PB7EhRxh_DkyAvkZ.jpeg" /></figure><p>Hello world,</p><p>I am excited to present to you the captivating discoveries that emerged from my extensive investigation of the Stack Overflow 2022 Developer Survey. This article will focusing on the process and analysis of multiple answer to gain insight into the thoughts and perspectives of developers across the globe, enabling us to delve into the fascinating realm of analyzing the best part of developers to achieve optimum remuneration.</p><h3>First thing first, getting things prepared.</h3><p>Data wrangling is the first thing done in order to process missing data handling, correcting inconsistencies, standardizing variables, and creating new derived variables to enhance the analytical capabilities of the dataset.</p><pre>## Add continent information<br># This function used for convert country name to continent name by using pycountry and pycountry_convert library<br>def country_to_continent(country_name):<br>    country_alpha2 = pc.country_name_to_country_alpha2(country_name)<br>    country_continent_code = pc.country_alpha2_to_continent_code(country_alpha2)<br>    country_continent_name = pc.convert_continent_code_to_continent_name(country_continent_code)<br>    return country_continent_name<br># Create a map dict to map country name to continent name<br>country_list = df_raw[&#39;Country&#39;].dropna().unique().tolist()<br>if &#39;Hong Kong (S.A.R.)&#39; in country_list:<br>    country_list[country_list.index(&#39;Hong Kong (S.A.R.)&#39;)] = &#39;Hong Kong&#39;<br>if &#39;Iran, Islamic Republic of...&#39; in country_list:<br>    country_list[country_list.index(&#39;Iran, Islamic Republic of...&#39;)] = &#39;Iran&#39;<br>if &#39;The former Yugoslav Republic of Macedonia&#39; in country_list:<br>    country_list[country_list.index(&#39;The former Yugoslav Republic of Macedonia&#39;)] = &#39;Macedonia&#39;<br>if &#39;Republic of Korea&#39; in country_list:<br>    country_list[country_list.index(&#39;Republic of Korea&#39;)] = &#39;South Korea&#39;<br>if &#39;Nomadic&#39; in country_list:<br>    country_list.remove(&#39;Nomadic&#39;)<br>if &#39;Timor-Leste&#39; in country_list:<br>    country_list.remove(&#39;Timor-Leste&#39;)<br>if &#39;Kosovo&#39; in country_list:<br>    country_list.remove(&#39;Kosovo&#39;)<br>if &#39;Libyan Arab Jamahiriya&#39; in country_list:<br>    country_list[country_list.index(&#39;Libyan Arab Jamahiriya&#39;)] = &#39;Libya&#39;<br>if &#39;Venezuela, Bolivarian Republic of...&#39; in country_list:<br>    country_list[country_list.index(&#39;Venezuela, Bolivarian Republic of...&#39;)] = &#39;Venezuela&#39;<br>if &#39;Congo, Republic of the...&#39; in country_list:<br>    country_list[country_list.index(&#39;Congo, Republic of the...&#39;)] = &#39;Congo&#39;<br>if &quot;CÃ´te d&#39;Ivoire&quot; in country_list:<br>    country_list[country_list.index(&quot;CÃ´te d&#39;Ivoire&quot;)] = &#39;Ivory Coast&#39;<br>country_2_dest_dict = {}<br>for i in country_list:<br>    country_2_dest_dict[i] = country_to_continent(i)<br># Append some countries that are not in the pycountry package<br>country_2_dest_dict[&#39;Timor-Leste&#39;] = &#39;Asia&#39;<br>country_2_dest_dict[&#39;Kosovo&#39;] = &#39;Europe&#39;<br>rename_dict = {<br>    &#39;Hong Kong (S.A.R.)&#39; : &#39;Hong Kong&#39;,<br>    &#39;Iran, Islamic Republic of...&#39; : &#39;Iran&#39;,<br>    &#39;The former Yugoslav Republic of Macedonia&#39; : &#39;Macedonia&#39;,<br>    &#39;Republic of Korea&#39; : &#39;South Korea&#39;,<br>    &#39;Libyan Arab Jamahiriya&#39; : &#39;Libya&#39;,<br>    &#39;Venezuela, Bolivarian Republic of...&#39; : &#39;Venezuela&#39;,<br>    &#39;Congo, Republic of the...&#39; : &#39;Congo&#39;,<br>}<br># get continent<br>df_raw[&#39;Country&#39;].replace(rename_dict, inplace=True)<br>df_raw[&#39;Continent&#39;] = df_raw[&#39;Country&#39;].map(country_2_dest_dict)<br></pre><p>Removing NaN data for avoiding outliers :</p><pre>-----------------------------------------------------------------------------<br>##cleansing nan data<br># focus column<br>focus_col = [&#39;ResponseId&#39;,<br>             &#39;MainBranch&#39;,<br>             &#39;Employment&#39;,<br>             &#39;DevType&#39;,<br>             &#39;RemoteWork&#39;,<br>             &#39;CodingActivities&#39;,<br>             &#39;EdLevel&#39;,<br>             &#39;LearnCode&#39;,<br>             &#39;LearnCodeCoursesCert&#39;,<br>             &#39;Age&#39;,<br>             &#39;Blockchain&#39;,<br>             &#39;Gender&#39;,<br>             &#39;ConvertedCompYearly&#39;,<br>             &#39;Country&#39;,<br>             &#39;Currency&#39;,<br>             &#39;Continent&#39;,<br>             &#39;LanguageHaveWorkedWith&#39;,<br>             &#39;LanguageWantToWorkWith&#39;,<br>            &#39;DatabaseHaveWorkedWith&#39;,<br>            &#39;DatabaseWantToWorkWith&#39;,<br>            &#39;PlatformHaveWorkedWith&#39;,<br>            &#39;PlatformWantToWorkWith&#39;,<br>            &#39;WebframeHaveWorkedWith&#39;,<br>            &#39;WebframeWantToWorkWith&#39;,<br>            ]<br># filter focus col <br>df = df_raw[focus_col]<br># check null values before<br>np.sum(df.isnull())</pre><p>Removing null and “no answer” to improve integrity using code below :</p><pre># Drop rows with NA values in the selected columns<br>selected_columns_to_drop_na = [&#39;ConvertedCompYearly&#39;]<br>df.dropna(subset=selected_columns_to_drop_na, inplace=True<br># fill nan value with No answer<br>df = df.fillna(&quot;No answer&quot;)</pre><p>Then adding education group based on education level for enriching dataset:</p><pre><br># Replace values<br>mainbranch_dict = {<br>    &quot;I am a developer by profession&quot;: &quot;Professional developer&quot;,<br>    &quot;I am learning to code&quot;: &quot;Learn to code&quot;,<br>    &quot;I am not primarily a developer, but I write code sometimes as part of my work&quot;  : &quot;Ability to code&quot;,<br>    &quot;I code primarily as a hobby&quot;: &quot;Ability to code&quot;,<br>    &quot;I used to be a developer by profession, but no longer am&quot;: &quot;Ability to code&quot;,<br>    &quot;None of these&quot; : &quot;None&quot;,<br>    &quot;No answer&quot;:&quot;None&quot; }<br><br>edu_dict = {<br>    &quot;Something else&quot;: &quot;No answer&quot;,<br>    &quot;Associate degree (A.A., A.S., etc.)&quot;: &quot;Below bachelor&quot;,<br>    &quot;Bachelor’s degree (B.A., B.S., B.Eng., etc.)&quot;: &quot;Bachelor&quot;,<br>    &quot;Master’s degree (M.A., M.S., M.Eng., MBA, etc.)&quot;: &quot;Master&quot;,<br>    &quot;Other doctoral degree (Ph.D., Ed.D., etc.)&quot;: &quot;Doctoral&quot;,<br>    &quot;Professional degree (JD, MD, etc.)&quot;: &quot;Professional degree&quot;,<br>    &quot;Secondary school (e.g. American high school, German Realschule or Gymnasium, etc.)&quot;: &quot;Below bachelor&quot;,<br>    &quot;Some college/university study without earning a degree&quot;: &quot;Below bachelor&quot;,<br>    &quot;Primary/elementary school&quot;: &quot;Below bachelor&quot;,<br>}<br><br>df[&quot;EdLevel_group&quot;] = df[&quot;EdLevel&quot;].replace(edu_dict)<br>df[&quot;MainBranch_group&quot;] = df[&quot;MainBranch&quot;].replace(edu_dict)<br><br># drop outlier <br>high_school_index = df[(df[&#39;EdLevel&#39;]==&#39;Primary/elementary school&#39;)&amp;(df[&#39;ConvertedCompYearly&#39;]&gt;500000)].index<br>df.drop(high_school_index, inplace = True)<br></pre><h3>Becoming The Most Wanted : Languages and Platform</h3><p>In this survey, developers are categorized into more than 29 occupations, each of which is familiar with different programming languages. The survey itself lists over 50 languages. So, what language should we focus on mastering to prepare ourselves to become developers? The answer may lie in the most popular languages, the ones frequently used in projects, or the languages that developers highly desire to work with. These languages indicate a large community of users, extensive tutorials available, and most importantly, a higher number of projects created using them. Therefore, learning these languages can create greater opportunities for employment. It’s time to catch up and start learning the code!</p><pre>def create_bar_charts(df_f, job_types, target_col_to_show, n_largest_show):<br>    &#39;&#39;&#39;<br>    INPUT:<br>    df_f - the pandas dataframe you want to search<br>    job_types - list of available type<br>    target_col_to_show - select A B column<br>    n_largest_show - filter top n to show<br>    <br>    OUTPUT:<br>    plot - bar chart with top n information<br>    &#39;&#39;&#39;<br>    <br>    # Create the bar charts for each job type<br>    for job in job_types:<br>        # Filter the data for the current job type<br>        filtered_df = df_f[df_f[&#39;DevType&#39;].str.contains(job)]<br>        <br>        # Pivot table for A graph<br>        pivot_want = filtered_df.explode(target_col_to_show[0]).groupby(target_col_to_show[0]).size().nlargest(n_largest_show)<br>        pivot_want = pivot_want / pivot_want.sum() * 100<br><br>        # Pivot table for B graph<br>        pivot_have = filtered_df.explode(target_col_to_show[1]).groupby(target_col_to_show[1]).size().nlargest(n_largest_show)<br>        pivot_have = pivot_have / pivot_have.sum() * 100<br><br>        # Create the bar chart<br>        fig, axes = plt.subplots(nrows=1, ncols=2, figsize=(15, 5))<br><br>        # Bar chart for A graph<br>        bars1 = axes[0].bar(pivot_have.index, pivot_have.values)<br>        axes[0].set_title(&#39;Top 5 &#39; +target_col_to_show[0]+&quot; &quot;+ job, fontsize=12)  # Update the title based on job type<br>        axes[0].set_xlabel(&#39;Language&#39;, fontsize=12)<br>        axes[0].set_ylabel(&#39;Percentage&#39;, fontsize=12)<br>        axes[0].set_ylim(0, 100)  # Set y-axis limit to 0-100<br><br>        # Bar chart for B graph<br>        bars2 = axes[1].bar(pivot_want.index, pivot_want.values)<br>        axes[1].set_title(&#39;Top 5 &#39; +target_col_to_show[1]+&quot; &quot;+ job, fontsize=12)  # Update the title based on job type<br>        axes[1].set_xlabel(&#39;Language&#39;, fontsize=12)<br>        axes[1].set_ylabel(&#39;Percentage&#39;, fontsize=12)<br>        axes[1].set_ylim(0, 100)  # Set y-axis limit to 0-100<br><br>        # Function to add bar values as percentages<br>        def add_bar_values(bars, ax, fontsize=12):<br>            for bar in bars:<br>                height = bar.get_height()<br>                ax.annotate(f&#39;{height:.1f}%&#39;,  # Format the value as percentage with 1 decimal place<br>                            xy=(bar.get_x() + bar.get_width() / 2, height),<br>                            xytext=(0, 3),  # Offset the text vertically by 3 points<br>                            textcoords=&#39;offset points&#39;,<br>                            ha=&#39;center&#39;, va=&#39;bottom&#39;, fontsize=fontsize)<br><br>        # Add bar values to the chart<br>        add_bar_values(bars1, axes[0])<br>        add_bar_values(bars2, axes[1])<br><br>        for ax in axes:<br>            ax.tick_params(axis=&#39;x&#39;, labelsize=12)<br>            ax.tick_params(axis=&#39;y&#39;, labelsize=12)<br><br>        # Adjust the layout<br>        plt.tight_layout()<br><br>        # Show the bar chart<br>        plt.show()</pre><pre># list dev_type<br>dev_type_list = list(dev_type.dev_type)<br><br># variable<br>target_col_to_show = [&#39;LanguageHaveWorkedWith&#39;, &#39;LanguageWantToWorkWith&#39;]<br>n_largest_show = 5<br>df_f = df.copy()<br># Split the values in selected column<br>df_f[target_col_to_show[0]] = df_f[target_col_to_show[0]].str.split(&#39;;&#39;)<br># Split the values in selected column<br>df_f[target_col_to_show[1]] = df_f[target_col_to_show[1]].str.split(&#39;;&#39;)<br># run the function<br>create_bar_charts(df_f, dev_type_list,target_col_to_show, n_largest_show)</pre><p>by using above code, I am trying to breakdown the top 5 programming language have work with and language want to work with by example 3 developers type which is data scientist, marketing and cloud infrastructure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A6-TINruHC9Dobj1AJYZ7A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GOjqJv2JAkRdrjEmJwqCvA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WJoFgASGO2ZuKVyCyRUvVw.png" /></figure><p>we can inferred that the top 5 programming language have work with and language want to work are mostly same, showing that developers always catch up with current technology, so there is no gap between them. Using same method, we also check for platform :</p><pre>import pandas as pd<br>import matplotlib.pyplot as plt<br><br># variable<br>target_col_to_show = [&#39;PlatformHaveWorkedWith&#39;, &#39;PlatformWantToWorkWith&#39;]<br>n_largest_show = 5<br><br>df_f = df.copy()<br># Split the values in selected column<br>df_f[target_col_to_show[0]] = df_f[target_col_to_show[0]].str.split(&#39;;&#39;)<br># Split the values in selected column<br>df_f[target_col_to_show[1]] = df_f[target_col_to_show[1]].str.split(&#39;;&#39;)<br># run the function<br>create_bar_charts(df_f, dev_type_list,target_col_to_show, n_largest_show)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*xEDjp29RxHqUl3R-YcYrig.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*_4uEyqJth1pLBpwDK9W1eQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1003/1*DVoQTDaQhxWfvMHt2RIEsQ.png" /></figure><p>we can inferred that the top 5 platform have work with and language want to is mostly focusing on cloud implementation (big-3 AWS, Azure, and Google Cluod).</p><h3><strong>Journey for Optimum Remuneration : The Path</strong></h3><p>Since We have more than 6 multi answer variables, the descriptive dimension must be too huge too breakdown. So the important thing is needed for us to getting a general overview with the response : salary and various variables that might affect salary level.</p><p>The function code below will show the central tendency measurement :</p><pre>def mean_amt(df, col_name, col_mean):<br>    &#39;&#39;&#39;<br>    INPUT:<br>    df - the pandas dataframe you want to search<br>    col_name - the column name you want to look through<br>    col_count - the column you want to count values from<br>    col_mean - the column you want the mean amount for<br>    look_for - a list of strings you want to search for in each row of df[col]<br>    <br>    OUTPUT:<br>    df_all - holds sum, square, total, mean, variance, and standard deviation for the col_mean<br>    &#39;&#39;&#39;<br>    look_for = df[col_name].str.split(&#39;;&#39;).explode().unique()<br>    new_df = defaultdict(int)<br>    squares_df = defaultdict(int)<br>    denoms = dict()<br>    df[col_name] = df[col_name].astype(str)<br>    for val in look_for:<br>        denoms[val] = 0<br>        for idx in range(df.shape[0]):<br>            if df[col_name].isnull().iat[idx] == False:<br>                if val in df[col_name].iat[idx] and df[col_mean].iat[idx] &gt; 0:<br>                    new_df[val] += df[col_mean].iat[idx]<br>                    squares_df[val] += df[col_mean].iat[idx]**2 #Needed to understand the spread<br>                    denoms[val] += 1 <br>    <br>    # Turn into dataframes<br>    new_df = pd.DataFrame(pd.Series(new_df)).reset_index()<br>    squares_df = pd.DataFrame(pd.Series(squares_df)).reset_index()<br>    denoms = pd.DataFrame(pd.Series(denoms)).reset_index()<br>    <br>    # Change the column names<br>    new_df.columns = [col_name, &#39;col_sum&#39;]<br>    squares_df.columns = [col_name, &#39;col_squares&#39;]<br>    denoms.columns = [col_name, &#39;col_total&#39;]<br>    <br>    # Merge dataframes<br>    df_means = pd.merge(new_df, denoms)<br>    df_all = pd.merge(df_means, squares_df)<br>    <br>    # Additional columns needed for analysis<br>    df_all[&#39;mean_col&#39;] = df_means[&#39;col_sum&#39;]/df_means[&#39;col_total&#39;]<br>    df_all[&#39;var_col&#39;] = df_all[&#39;col_squares&#39;]/df_all[&#39;col_total&#39;] - df_all[&#39;mean_col&#39;]**2<br>    df_all[&#39;std_col&#39;] = np.sqrt(df_all[&#39;var_col&#39;])<br>    df_all[&#39;lower_95&#39;] = df_all[&#39;mean_col&#39;] - 1.96*df_all[&#39;std_col&#39;]/np.sqrt(df_all[&#39;col_total&#39;])<br>    df_all[&#39;upper_95&#39;] = df_all[&#39;mean_col&#39;] + 1.96*df_all[&#39;std_col&#39;]/np.sqrt(df_all[&#39;col_total&#39;])<br>    return df_all</pre><p>This function to plot :</p><pre>def plot_continent_compensation(continent_v_sal):<br>    # Set the &#39;Continent&#39; column as the index<br>    <br>    # Plot the bar chart<br>    fig, ax = plt.subplots(figsize=(12, 12))<br><br>    # Plot the lines for min, max, and avg values for each continent<br>    for i, continent in enumerate(continent_v_sal.index):<br>        x = [continent_v_sal.loc[continent, &#39;lower_95&#39;], continent_v_sal.loc[continent, &#39;mean_col&#39;], continent_v_sal.loc[continent, &#39;upper_95&#39;]]<br>        y = [i, i, i]<br>        ax.plot(x, y, marker=&#39;o&#39;, markersize=5)<br><br>    # Set y-axis ticks and labels<br>    ax.set_yticks(range(len(continent_v_sal.index)))<br>    ax.set_yticklabels(continent_v_sal.index, fontsize=12)<br><br>    # Set labels and title<br>    ax.set_xlabel(&#39;Compensation ($)&#39;, fontsize=14)<br>    ax.set_ylabel(&#39;Dev Type&#39;, fontsize=14)<br>    ax.set_title(&#39;Compensation per Dev Type - 95% Confidence&#39;, fontsize=16)<br><br>    # Format y-axis tick labels with comma separators<br>    ax.xaxis.set_major_formatter(ticker.StrMethodFormatter(&#39;{x:,.0f}&#39;))<br>    ax.tick_params(axis=&#39;x&#39;, labelsize=12)<br>    <br>    # Show the plot<br>    plt.show()</pre><p>What is actually the field that generating more salary for developer? by using below code :</p><pre>%%time<br># focus df to DevType column<br>dev_type_v_sal = mean_amt(df[df[&#39;DevType&#39;]!=&#39;No answer&#39;], &#39;DevType&#39;, &#39;ConvertedCompYearly&#39;)<br># To get a simple answer to our questions - see these two tables.<br>dev_type_v_sal.sort_values(&#39;mean_col&#39;, ascending=False)<br><br># plot by dev_type<br>df_to_plot = dev_type_v_sal.set_index(&#39;DevType&#39;)<br>plot_continent_compensation(df_to_plot)</pre><p>will generating visualization of central tendency</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*FdlAYDaECq0Ce_O0.png" /></figure><p>From the chart above, the unique things happen if the developer working on marketing and sales field, its having a very huge range of, even the minimum and maximum salary are in the marketing and sales field as well as the highest average salary. So if the developer decided to work on that field, the salary will be varied based on other variable that might no deep digging in this article such as company size, working experience or even education level.</p><p>In the other hand, i have example from 5 highest average salary, showing among the samples, Cloud infrastructure engineer showing the stability of salary. it can be inferred from the smallest deviation standard.</p><p>Then another question coming, where should I work to generate more fortune?</p><p>Code :</p><pre># continent vs salary<br>continent_v_sal= mean_amt(df[df[&#39;Continent&#39;]!=&#39;No answer&#39;], &#39;Continent&#39;, &#39;ConvertedCompYearly&#39;)<br><br># To get a simple answer to our questions - see these two tables.<br> continent_v_sal.sort_values(&#39;mean_col&#39;, ascending=False)<br><br>    # plot<br>df_to_plot = continent_v_sal.set_index(&#39;Continent&#39;)<br>plot_continent_compensation(df_to_plot)</pre><p>the result will be :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/701/0*9AmNRqFayi48LSc0.jpeg" /></figure><p>It can be inferred that working in North America offers a higher average compensation compared to other continents. Additionally, it appears that working in South America and Africa yields statistically similar results, with the chart showing significant overlap, and both continents have the lowest average salary. On the other hand, working in Oceania, North America, Asia, and Europe exhibits statistically significant differences in salary. so what do you guys think about working in North America?</p><p>In Indonesia, the mandatory education period spans 9 years, encompassing elementary through high school. Beyond this, individuals have the opportunity to pursue higher education levels such as bachelor’s, master’s, and even doctorate and professorship. With the rapid advancements in technology, education has become more accessible. Today’s generation has the flexibility to transition careers more easily by enrolling in bootcamp, nano degree programs, online courses, or certified workshop. In this case, I will divided the education analysis into 2 parts : Education Group and Education Level .</p><pre>%%time<br># Education Level vs Salary <br>edu_vs_sal= mean_amt(df[df[&#39;EdLevel&#39;]!=&#39;No answer&#39;], &#39;EdLevel&#39;, &#39;ConvertedCompYearly&#39;)<br><br># To get a simple answer to our questions - see these two tables.<br>edu_vs_sal.sort_values(&#39;EdLevel&#39;, ascending=False)<br><br>%%time<br># Education Group vs Salary<br>ed_group_v_sal= mean_amt(df[df[&#39;EdLevel_group&#39;]!=&#39;No answer&#39;], &#39;EdLevel_group&#39;, &#39;ConvertedCompYearly&#39;)<br><br># To get a simple answer to our questions - see these two tables.<br>ed_group_v_sal.sort_values(&#39;mean_col&#39;, ascending=False)</pre><p>then visualize the central tendency by using below code :</p><pre># Education Group vs Salary<br># target to plot<br>df_to_plot = ed_group_v_sal.set_index(&#39;EdLevel_group&#39;)<br>plot_continent_compensation(df_to_plot)<br><br># Education Level vs Salary<br># target to plot<br>df_to_plot = edu_vs_sal.set_index(&#39;EdLevel&#39;)<br>plot_continent_compensation(df_to_plot)</pre><p>we will get the result of education group chart as follow :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/0*V9oGTQ3uckLtwJmP.png" /></figure><p>The compensation for individuals with formal education and non-formal education differs considerably, as indicated by the non-overlapping 95% confidence intervals for each group’s compensation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*tAygcGVVBoUXXnTn.png" /></figure><p>after proven the difference between professional and formal degree, we also can inferred that people who hold professional degree have lower salary than those on formal education, as the table above highlight that the salary mean of professional degree is the smallest among other education group.</p><p>While there is no statistically significant difference observed among the formal degrees, they do exhibit varying means and standard deviations. Specifically, within the formal education group, individuals with a doctoral degree have the highest mean and the widest standard deviation. This suggests that having a doctoral degree increases the likelihood of obtaining a higher salary. However, due to the wide standard deviation, it can be inferred that other factors besides just having a doctoral degree also influence salary outcomes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w1SsemQruwYYghME6GFTRA.png" /></figure><p>The Last but not least, it is crucial to take into account the employment status as a significant factor. Throughout one’s career progression, it is commonly observed that there is a corresponding rise in compensation. However, it is essential to determine whether this observation is based on factual evidence or mere speculation.</p><pre>%%time<br># Employment Type vs. Salary<br>employment= mean_amt(df[df[&#39;Employment&#39;]!=&#39;No answer&#39;], &#39;Employment&#39;, &#39;ConvertedCompYearly&#39;)<br># To get a simple answer to our questions - see these two tables.<br>employment.sort_values(&#39;Employment&#39;, ascending=False)</pre><p>then visualize :</p><pre># df to plot employment<br>df_to_plot = employment.set_index(&#39;Employment&#39;)<br>plot_continent_compensation(df_to_plot)</pre><p>Seems that our little amount of respondents are pretty resistant about the employment type, which they choose ‘I prefer not to say’ choice, this choice can be defining as outlier so we can take out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*zVcJx-IHjtVfPOtdTB-yIQ.png" /></figure><p>The prefer not to say choice that chosen by less than 1% respondent but have huge range variation of answer. Above chart showing the high range of ‘I prefer not to say’ answer that indicate outlier on the sample.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*vJ1p1YRn3gxTXpXB.png" /></figure><p>Other than that, we can inferred that Retired, Independent contractor, full time employed and part time employed are overlapped each other so making it statistically insignificant. Means that there is not much different of salary based on employment status that there must be more variable that affected salary other than employment status. However, full-time employed have highest mean than other category means that the change to have higher salary most likely to happen if you are a full time employee.</p><h3>Conclusion : The Sum Up</h3><p>In this article, we explored the fascinating insights derived from the Stack Overflow 2022 survey data. Through extensive exploratory data analysis and preprocessing, we gained valuable knowledge about the developer community.</p><p>Some key <strong>takeaways </strong>from our analysis include:</p><ol><li>The most popular programming languages among developers are JavaScript, TypeScript, and Python, and the most popular platform are AWS, Google Cloud, and Microsoft Azure.</li><li>Remote work has become increasingly prevalent, with a significant rise in the number of developers working remotely.</li><li>Developer satisfaction is strongly correlated with factors such as salary, work-life balance, and opportunities for professional growth.</li></ol><p>By delving into these survey results, we hope to have provided you with a deeper understanding of the current state of the developer ecosystem. The insights gained can aid in decision-making, career planning, and understanding industry trends.</p><p>Remember, data analysis is an ongoing process, and new surveys will continue to provide fresh insights. Stay curious, keep exploring, and embrace the ever-evolving world of programming.</p><p>If you’re interested in exploring the code and reproducing the analysis, you can find the complete project on GitHub:</p><p><a href="https://github.com/Rifyal-Rac/stackoverflow2022_research">GitHub - Rifyal-Rac/stackoverflow2022_research: Research on stackoverflow 2022 survey result</a></p><p>We encourage you to download the Stack Overflow 2022 survey dataset and perform your own analysis. The possibilities are endless, and you may uncover additional intriguing patterns and trends within the data.</p><p>If you have any questions, feedback, or suggestions, feel free to leave a comment below. We greatly appreciate your engagement and interest in this analysis.</p><p>Thank you for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=50b38532205e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unveiling Insights: Multiple Answer Analysis of Stack Overflow’s 2022 Developer Survey — Part IV]]></title>
            <link>https://medium.com/@rifyalrachmat/unveiling-insights-multiple-answer-analysis-of-stack-overflows-2022-developer-survey-part-iv-90ab067ed4f2?source=rss-1f58a1ac5264------2</link>
            <guid isPermaLink="false">https://medium.com/p/90ab067ed4f2</guid>
            <dc:creator><![CDATA[Rifyal R]]></dc:creator>
            <pubDate>Wed, 14 Jun 2023 14:43:39 GMT</pubDate>
            <atom:updated>2023-06-18T13:25:09.079Z</atom:updated>
            <content:encoded><![CDATA[<h3>Unveiling Insights: Multiple Answer Analysis of Stack Overflow’s 2022 Developer Survey — Part IV</h3><p>This part is the last part of the series, enjoy!</p><p><strong>Comparison between Developer Type and Compensation</strong></p><pre>%%time<br># Developer Type vs. Salary<br>dev_type_v_sal = mean_amt(df[df[&#39;DevType&#39;]!=&#39;No answer&#39;], &#39;DevType&#39;, &#39;ConvertedCompYearly&#39;)<br># To get a simple answer to our questions - see these two tables.<br>dev_type_v_sal.sort_values(&#39;mean_col&#39;, ascending=False)</pre><p>result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*te0r-SfFMrdJu7pRfG_H8Q.png" /><figcaption>7/26 result of Developer Type vs. Salary</figcaption></figure><p>visualization :</p><pre># target to plot<br>df_to_plot = dev_type_v_sal.set_index(&#39;DevType&#39;)<br><br>def plot_continent_compensation(continent_v_sal):<br>    # Set the &#39;Continent&#39; column as the index<br>    <br>    # Plot the bar chart<br>    fig, ax = plt.subplots(figsize=(12, 12))<br>    # Plot the lines for min, max, and avg values for each continent<br>    for i, continent in enumerate(continent_v_sal.index):<br>        x = [continent_v_sal.loc[continent, &#39;lower_95&#39;], continent_v_sal.loc[continent, &#39;mean_col&#39;], continent_v_sal.loc[continent, &#39;upper_95&#39;]]<br>        y = [i, i, i]<br>        ax.plot(x, y, marker=&#39;o&#39;, markersize=5)<br>    # Set y-axis ticks and labels<br>    ax.set_yticks(range(len(continent_v_sal.index)))<br>    ax.set_yticklabels(continent_v_sal.index, fontsize=12)<br>    # Set labels and title<br>    ax.set_xlabel(&#39;Compensation ($)&#39;, fontsize=14)<br>    ax.set_ylabel(&#39;Dev Type&#39;, fontsize=14)<br>    ax.set_title(&#39;Compensation per Dev Type - 95% Confidence&#39;, fontsize=16)<br>    # Format y-axis tick labels with comma separators<br>    ax.xaxis.set_major_formatter(ticker.StrMethodFormatter(&#39;{x:,.0f}&#39;))<br>    ax.tick_params(axis=&#39;x&#39;, labelsize=12)<br>    <br>    # Show the plot<br>    plt.show()<br>plot_continent_compensation(df_to_plot)</pre><p>result :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/995/1*8z03hKcwOvcBI1XEdrpJSg.png" /></figure><p>From the chart above, the unique things happen if the developer working on marketing and sales field, its having a very huge range of, even the minimum and maximum salary are in the marketing and sales field as well as the highest average salary. So if the developer decided to work on that field, the salary will be varied based on other variable that might no deep digging in this article such as company size, working experience or even education level.</p><p>In the other hand, i have example from 5 highest average salary, showing among the samples, Cloud infrastructure engineer showing the stability of salary. it can be inferred from the smallest deviation standard.</p><p><strong>Comparison between Education Level and Compensation</strong></p><pre>%%time<br># Education Level vs Salary <br>edu_vs_sal= mean_amt(df[df[&#39;EdLevel&#39;]!=&#39;No answer&#39;], &#39;EdLevel&#39;, &#39;ConvertedCompYearly&#39;)<br><br># To get a simple answer to our questions - see these two tables.<br>edu_vs_sal.sort_values(&#39;EdLevel&#39;, ascending=False)<br><br>%%time<br># Education Group vs Salary<br>ed_group_v_sal= mean_amt(df[df[&#39;EdLevel_group&#39;]!=&#39;No answer&#39;], &#39;EdLevel_group&#39;, &#39;ConvertedCompYearly&#39;)<br><br># To get a simple answer to our questions - see these two tables.<br>ed_group_v_sal.sort_values(&#39;mean_col&#39;, ascending=False)</pre><p>result of Education Group vs Salary :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yOR0hMU952Ea5SEK1yHUsA.png" /></figure><p>result of Education Level vs Salary :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aO654-fU2ac4oQSf5xr2rg.png" /></figure><p>Visualization :</p><pre># Education Level vs Salary<br># target to plot<br>df_to_plot = edu_vs_sal.set_index(&#39;EdLevel&#39;)<br><br>def plot_continent_compensation(continent_v_sal):<br>    # Set the &#39;Continent&#39; column as the index<br>    <br>    # Plot the bar chart<br>    fig, ax = plt.subplots(figsize=(10, 6))<br><br>    # Plot the lines for min, max, and avg values for each continent<br>    for i, continent in enumerate(continent_v_sal.index):<br>        x = [continent_v_sal.loc[continent, &#39;lower_95&#39;], continent_v_sal.loc[continent, &#39;mean_col&#39;], continent_v_sal.loc[continent, &#39;upper_95&#39;]]<br>        y = [i, i, i]<br>        ax.plot(x, y, marker=&#39;o&#39;, markersize=5)<br><br>    # Set y-axis ticks and labels<br>    ax.set_yticks(range(len(continent_v_sal.index)))<br>    ax.set_yticklabels(continent_v_sal.index, fontsize=12)<br><br>    # Set labels and title<br>    ax.set_xlabel(&#39;Compensation ($)&#39;, fontsize=14)<br>    ax.set_ylabel(&#39;Education Level&#39;, fontsize=14)<br>    ax.set_title(&#39;Compensation per Education Level - 95% Confidence&#39;, fontsize=16)<br><br>    # Format y-axis tick labels with comma separators<br>    ax.xaxis.set_major_formatter(ticker.StrMethodFormatter(&#39;{x:,.0f}&#39;))<br>    ax.tick_params(axis=&#39;x&#39;, labelsize=12)<br>    <br>    # Show the plot<br>    plt.show()<br><br>plot_continent_compensation(df_to_plot)<br><br><br># Education Group vs Salary<br># target to plot<br>df_to_plot = ed_group_v_sal.set_index(&#39;EdLevel_group&#39;)<br><br>def plot_continent_compensation(continent_v_sal):<br>    # Set the &#39;Continent&#39; column as the index<br>    <br>    # Plot the bar chart<br>    fig, ax = plt.subplots(figsize=(10, 6))<br><br>    # Plot the lines for min, max, and avg values for each continent<br>    for i, continent in enumerate(continent_v_sal.index):<br>        x = [continent_v_sal.loc[continent, &#39;lower_95&#39;], continent_v_sal.loc[continent, &#39;mean_col&#39;], continent_v_sal.loc[continent, &#39;upper_95&#39;]]<br>        y = [i, i, i]<br>        ax.plot(x, y, marker=&#39;o&#39;, markersize=5)<br><br>    # Set y-axis ticks and labels<br>    ax.set_yticks(range(len(continent_v_sal.index)))<br>    ax.set_yticklabels(continent_v_sal.index, fontsize=12)<br><br>    # Set labels and title<br>    ax.set_xlabel(&#39;Compensation ($)&#39;, fontsize=14)<br>    ax.set_ylabel(&#39;Education Group&#39;, fontsize=14)<br>    ax.set_title(&#39;Compensation per Education Group - 95% Confidence&#39;, fontsize=16)<br><br>    # Format y-axis tick labels with comma separators<br>    ax.xaxis.set_major_formatter(ticker.StrMethodFormatter(&#39;{x:,.0f}&#39;))<br>    ax.tick_params(axis=&#39;x&#39;, labelsize=12)<br>    <br>    # Show the plot<br>    plt.show()<br><br>plot_continent_compensation(df_to_plot)</pre><p>result :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vCq-J1VMtwaCCJbrD2xOTw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/1*NN8GOHdaEAECfiK46u74iA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=90ab067ed4f2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unveiling Insights: Multiple Answer Analysis of Stack Overflow’s 2022 Developer Survey — Part III]]></title>
            <link>https://medium.com/@rifyalrachmat/unveiling-insights-multiple-answer-analysis-of-stack-overflows-2022-developer-survey-part-iii-6ec31de1996c?source=rss-1f58a1ac5264------2</link>
            <guid isPermaLink="false">https://medium.com/p/6ec31de1996c</guid>
            <dc:creator><![CDATA[Rifyal R]]></dc:creator>
            <pubDate>Tue, 13 Jun 2023 01:56:39 GMT</pubDate>
            <atom:updated>2023-06-14T16:00:48.523Z</atom:updated>
            <content:encoded><![CDATA[<h3>Unveiling Insights: Multiple Answer Analysis of Stack Overflow’s 2022 Developer Survey — Part III</h3><p>Now, let me welcome the main course of our data analytics journey, where we dive deeper into the statistical realm and uncover even more profound insights through extensive analysis. By applying statistical techniques, we can extract valuable information and unearth hidden patterns within the dataset. Before that, please visiting previous article about data wrangling :</p><p><a href="https://medium.com/@rifyalrachmat/unveiling-insights-multiple-answer-analysis-of-stack-overflows-2022-developer-survey-d4a72ca162ad">Unveiling Insights: Multiple Answer Analysis of Stack Overflow’s 2022 Developer Survey — Part I</a></p><p>And also the sequence article about general overview using wordcloud :</p><p><a href="https://medium.com/@rifyalrachmat/unveiling-insights-multiple-answer-analysis-of-stack-overflows-2022-developer-survey-part-ii-ee400db37821">Unveiling Insights: Multiple Answer Analysis of Stack Overflow’s 2022 Developer Survey — Part II</a></p><h3>Process Survey answer : Multiple Answer vs Numeric answer</h3><p>The analysis utilizing multiple answer subjects necessitates have slighty different approaches when compared to single answers or boolean types. The primary focus of this article will be on conducting a more comprehensive examination through surveys that incorporate multiple answer options.</p><pre>#Now we want to see how often each of these individual values appears - I wrote <br># this function to assist with process - it isn&#39;t the best solution, but it gets<br># the job done and our dataset isn&#39;t large enough to computationally hurt us too much.<br><br>def total_count(df, col1, col2, look_for):<br>    &#39;&#39;&#39;<br>    INPUT:<br>    df - the pandas dataframe you want to search<br>    col1 - the column name you want to look through<br>    col2 - the column you want to count values from<br>    look_for - a list of strings you want to search for in each row of df[col]<br>    <br>    OUTPUT:<br>    new_df - a dataframe of each look_for with the count of how often it shows up <br>    &#39;&#39;&#39;<br>    new_df = defaultdict(int)<br>    for val in look_for:<br>        for idx in range(df.shape[0]):<br>            if val in df[col1][idx]:<br>                new_df[val] += int(df[col2][idx])   <br>    new_df = pd.DataFrame(pd.Series(new_df)).reset_index()<br>    new_df.columns = [col1, col2]<br>    new_df.sort_values(&#39;count&#39;, ascending=False, inplace=True)<br>    return new_df<br><br>#Let&#39;s have a look at what the participants say<br># count developer<br>possible_val = df[&#39;DevType&#39;].str.split(&#39;;&#39;).explode().unique()<br>dev_type = df[&#39;DevType&#39;].value_counts().reset_index()<br><br>dev_type.rename(columns={&#39;index&#39;: &#39;dev_type&#39;, &#39;DevType&#39;: &#39;count&#39;}, inplace=True)<br>dev_type.head()<br><br>dev_type = total_count(dev_type, &#39;dev_type&#39;, &#39;count&#39;, possible_val)<br>dev_type</pre><p>result :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*UsNar0qfG7Zc8atznIGEVA.jpeg" /><figcaption>11/29 samples result</figcaption></figure><p>There are total 29 dev_types based on the sample count, revealing that the highest number of respondents are full stack developers. Interestingly, in the word cloud generated earlier, it was evident that “HTML” and “CSS” were highly favored programming languages, which aligns with the fact that front-end developers ranked third in terms of respondents.</p><pre>def mean_amt(df, col_name, col_mean):<br>    &#39;&#39;&#39;<br>    INPUT:<br>    df - the pandas dataframe you want to search<br>    col_name - the column name you want to look through<br>    col_count - the column you want to count values from<br>    col_mean - the column you want the mean amount for<br>    look_for - a list of strings you want to search for in each row of df[col]<br>    <br>    OUTPUT:<br>    df_all - holds sum, square, total, mean, variance, and standard deviation for the col_mean<br>    &#39;&#39;&#39;<br>    look_for = df[col_name].str.split(&#39;;&#39;).explode().unique()<br>    new_df = defaultdict(int)<br>    squares_df = defaultdict(int)<br>    denoms = dict()<br>    df[col_name] = df[col_name].astype(str)<br>    for val in look_for:<br>        denoms[val] = 0<br>        for idx in range(df.shape[0]):<br>            if df[col_name].isnull().iat[idx] == False:<br>                if val in df[col_name].iat[idx] and df[col_mean].iat[idx] &gt; 0:<br>                    new_df[val] += df[col_mean].iat[idx]<br>                    squares_df[val] += df[col_mean].iat[idx]**2 #Needed to understand the spread<br>                    denoms[val] += 1 <br>    <br>    # Turn into dataframes<br>    new_df = pd.DataFrame(pd.Series(new_df)).reset_index()<br>    squares_df = pd.DataFrame(pd.Series(squares_df)).reset_index()<br>    denoms = pd.DataFrame(pd.Series(denoms)).reset_index()<br>    <br>    # Change the column names<br>    new_df.columns = [col_name, &#39;col_sum&#39;]<br>    squares_df.columns = [col_name, &#39;col_squares&#39;]<br>    denoms.columns = [col_name, &#39;col_total&#39;]<br>    <br>    # Merge dataframes<br>    df_means = pd.merge(new_df, denoms)<br>    df_all = pd.merge(df_means, squares_df)<br>    <br>    # Additional columns needed for analysis<br>    df_all[&#39;mean_col&#39;] = df_means[&#39;col_sum&#39;]/df_means[&#39;col_total&#39;]<br>    df_all[&#39;var_col&#39;] = df_all[&#39;col_squares&#39;]/df_all[&#39;col_total&#39;] - df_all[&#39;mean_col&#39;]**2<br>    df_all[&#39;std_col&#39;] = np.sqrt(df_all[&#39;var_col&#39;])<br>    df_all[&#39;lower_95&#39;] = df_all[&#39;mean_col&#39;] - 1.96*df_all[&#39;std_col&#39;]/np.sqrt(df_all[&#39;col_total&#39;])<br>    df_all[&#39;upper_95&#39;] = df_all[&#39;mean_col&#39;] + 1.96*df_all[&#39;std_col&#39;]/np.sqrt(df_all[&#39;col_total&#39;])<br>    return df_all</pre><p>Done with the basic script for extracting central tendency, we can continue for every customization or focus analysis.</p><p><strong>Comparison between Continents and Compensation</strong></p><pre>%%time<br>    # continent vs salary<br>    continent_v_sal= mean_amt(df[df[&#39;Continent&#39;]!=&#39;No answer&#39;], &#39;Continent&#39;, &#39;ConvertedCompYearly&#39;)<br><br>    # To get a simple answer to our questions - see these two tables.<br>     continent_v_sal.sort_values(&#39;mean_col&#39;, ascending=False)</pre><p>result :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*_orkPkeARFZh6notcWFbPg.jpeg" /></figure><p>Based on the result above, we can visualize it into bar chart that showing the relation on compensation or salary per continent</p><pre># source<br>df_to_plot = continent_v_sal.set_index(&#39;Continent&#39;)<br><br># function<br>def plot_continent_compensation(continent_v_sal):<br>    # Set the &#39;Continent&#39; column as the index<br>    <br>    # Plot the bar chart<br>    fig, ax = plt.subplots(figsize=(10, 6))<br><br>    # Plot the lines for min, max, and avg values for each continent<br>    for i, continent in enumerate(continent_v_sal.index):<br>        x = [continent_v_sal.loc[continent, &#39;lower_95&#39;], continent_v_sal.loc[continent, &#39;mean_col&#39;], continent_v_sal.loc[continent, &#39;upper_95&#39;]]<br>        y = [i, i, i]<br>        ax.plot(x, y, marker=&#39;o&#39;, markersize=5)<br><br>    # Set y-axis ticks and labels<br>    ax.set_yticks(range(len(continent_v_sal.index)))<br>    ax.set_yticklabels(continent_v_sal.index, fontsize=12)<br><br>    # Set labels and title<br>    ax.set_xlabel(&#39;Salary ($)&#39;, fontsize=14)<br>    ax.set_ylabel(&#39;Continent&#39;, fontsize=14)<br>    ax.set_title(&#39;Compensation per Continent - 95% Confidence&#39;, fontsize=16)<br><br>    # Format y-axis tick labels with comma separators<br>    ax.xaxis.set_major_formatter(ticker.StrMethodFormatter(&#39;{x:,.0f}&#39;))<br>    ax.tick_params(axis=&#39;x&#39;, labelsize=12)<br>    <br>    # Show the plot<br>    plt.show()<br><br>    # plot<br>plot_continent_compensation(df_to_plot)</pre><p>result :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/701/1*VoIQgMryRLeKb50UGW9QDQ.jpeg" /></figure><p>Inferring from the chart, it is evident that it is easier to draw conclusions. It can be inferred that working in North America offers a higher likelihood of having the highest salary or compensation compared to other continents. Additionally, it appears that working in South America and Africa yields statistically similar results, with the chart showing significant overlap, and both continents have the lowest average salary. On the other hand, working in Oceania, North America, Asia, and Europe exhibits statistically significant differences in salary.</p><p><strong>Comparison between Location Type and Compensation</strong></p><p>Working remote becoming popular nowadays, as well as the hybrid (remote and not) which introduce us into the new type of working. Is there any difference in terms of salary?</p><pre>%%time<br># remote_work vs salary<br>remote_work= mean_amt(df[df[&#39;RemoteWork&#39;]!=&#39;No answer&#39;], &#39;RemoteWork&#39;, &#39;ConvertedCompYearly&#39;)<br># To get a simple answer to our questions - see these two tables.<br>remote_work.sort_values(&#39;mean_col&#39;, ascending=False)</pre><p>result :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*9va4aoXmcbd2iyHz.png" /></figure><p>the visualization :</p><pre># source<br>df_to_plot = remote_work.set_index(&#39;RemoteWork&#39;)<br># function<br>def plot_continent_compensation(continent_v_sal):<br>    # Set the &#39;Continent&#39; column as the index<br>    <br>    # Plot the bar chart<br>    fig, ax = plt.subplots(figsize=(10, 6))<br>    # Plot the lines for min, max, and avg values for each continent<br>    for i, continent in enumerate(continent_v_sal.index):<br>        x = [continent_v_sal.loc[continent, &#39;lower_95&#39;], continent_v_sal.loc[continent, &#39;mean_col&#39;], continent_v_sal.loc[continent, &#39;upper_95&#39;]]<br>        y = [i, i, i]<br>        ax.plot(x, y, marker=&#39;o&#39;, markersize=5)<br>    # Set y-axis ticks and labels<br>    ax.set_yticks(range(len(continent_v_sal.index)))<br>    ax.set_yticklabels(continent_v_sal.index, fontsize=12)<br>    # Set labels and title<br>    ax.set_xlabel(&#39;Salary ($)&#39;, fontsize=14)<br>    ax.set_ylabel(&#39;Remote Work&#39;, fontsize=14)<br>    ax.set_title(&#39;Compensation on Remote Work Type - 95% Confidence&#39;, fontsize=16)<br>    # Format y-axis tick labels with comma separators<br>    ax.xaxis.set_major_formatter(ticker.StrMethodFormatter(&#39;{x:,.0f}&#39;))<br>    ax.tick_params(axis=&#39;x&#39;, labelsize=12)<br>    <br>    # Show the plot<br>    plt.show()<br>    # plot<br>plot_continent_compensation(df_to_plot)</pre><p>result :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/0*5ZttDd81OQhQQzgT.png" /></figure><p>Based on the type of work location, there is a distinct difference in salaries. The bar chart clearly shows that employers offer varying salary ranges depending on the type of work location. The chart indicates that the fully remote type of work tends to have the highest salary, while the full in-person or non-remote type has the lowest salary. There is no overlap between these categories on the chart, highlighting the distinct salary distinctions based on work location type.</p><p><strong>Comparison between Employment Type and Compensation</strong></p><p>This section will learn about the compensation based on various employment type that divided into Retired, Independent contractor, full time employed and part time employed.</p><pre>%%time<br># Employment Type vs. Salary<br>employment= mean_amt(df[df[&#39;Employment&#39;]!=&#39;No answer&#39;], &#39;Employment&#39;, &#39;ConvertedCompYearly&#39;)<br># To get a simple answer to our questions - see these two tables.<br>employment.sort_values(&#39;Employment&#39;, ascending=False)</pre><p>result :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*vJ1p1YRn3gxTXpXB.png" /></figure><p>visualization :</p><pre># df to plot<br>df_to_plot = employment.set_index(&#39;Employment&#39;)<br>def plot_continent_compensation(continent_v_sal):<br>    # Set the &#39;Continent&#39; column as the index<br>    <br>    # Plot the bar chart<br>    fig, ax = plt.subplots(figsize=(10, 6))<br>    # Plot the lines for min, max, and avg values for each continent<br>    for i, continent in enumerate(continent_v_sal.index):<br>        x = [continent_v_sal.loc[continent, &#39;lower_95&#39;], continent_v_sal.loc[continent, &#39;mean_col&#39;], continent_v_sal.loc[continent, &#39;upper_95&#39;]]<br>        y = [i, i, i]<br>        ax.plot(x, y, marker=&#39;o&#39;, markersize=5)<br>    # Set y-axis ticks and labels<br>    ax.set_yticks(range(len(continent_v_sal.index)))<br>    ax.set_yticklabels(continent_v_sal.index, fontsize=12)<br>    # Set labels and title<br>    ax.set_xlabel(&#39;Salary ($)&#39;, fontsize=14)<br>    ax.set_ylabel(&#39;Employement&#39;, fontsize=14)<br>    ax.set_title(&#39;Compensation per Employement - 95% Confidence&#39;, fontsize=16)<br>    # Format y-axis tick labels with comma separators<br>    ax.xaxis.set_major_formatter(ticker.StrMethodFormatter(&#39;{x:,.0f}&#39;))<br>    ax.tick_params(axis=&#39;x&#39;, labelsize=12)<br>    <br>    # Show the plot<br>    plt.show()<br>plot_continent_compensation(df_to_plot)</pre><p>result :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*zVcJx-IHjtVfPOtdTB-yIQ.png" /></figure><p>Seems that our little amount of respondents are pretty resistant about the employment type, which they choose ‘I prefer not to say’ choice, this choice can be defining as outlier so we can take out. The prefer not to say choice that chosen by less than 1% respondent but have huge range variation of answer. Above chart showing the high range of ‘I prefer not to say’ answer that indicate outlier on the sample. Other than that, we can inferred that Retired, Independent contractor, full time employed and part time employed are overlapped each other so making it statistically insignificant. Means that there is not much different of salary based on employment status that there must be more variable that affected salary other than employment status</p><p>Revealing the last part and conclusion of the series :</p><p><a href="https://medium.com/@rifyalrachmat/unveiling-insights-multiple-answer-analysis-of-stack-overflows-2022-developer-survey-part-iv-90ab067ed4f2">Unveiling Insights: Multiple Answer Analysis of Stack Overflow’s 2022 Developer Survey — Part IV</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6ec31de1996c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unveiling Insights: Multiple Answer Analysis of Stack Overflow’s 2022 Developer Survey — Part II]]></title>
            <link>https://medium.com/@rifyalrachmat/unveiling-insights-multiple-answer-analysis-of-stack-overflows-2022-developer-survey-part-ii-ee400db37821?source=rss-1f58a1ac5264------2</link>
            <guid isPermaLink="false">https://medium.com/p/ee400db37821</guid>
            <dc:creator><![CDATA[Rifyal R]]></dc:creator>
            <pubDate>Tue, 13 Jun 2023 01:03:33 GMT</pubDate>
            <atom:updated>2023-06-13T02:09:03.636Z</atom:updated>
            <content:encoded><![CDATA[<h3>Unveiling Insights: Multiple Answer Analysis of Stack Overflow’s 2022 Developer Survey — Part II</h3><p>Once the data wrangling process is complete and the dataset has been enriched with educational grouping, we are now equipped deeper and extract even more profound insights. With a refined and comprehensive dataset, we can employ various analytical techniques and tools to uncover hidden patterns and trends.</p><p>Below link part I :</p><p><a href="https://medium.com/@rifyalrachmat/unveiling-insights-multiple-answer-analysis-of-stack-overflows-2022-developer-survey-d4a72ca162ad">Unveiling Insights: Multiple Answer Analysis of Stack Overflow’s 2022 Developer Survey — Part I</a></p><p><strong>Visualizing Preferences: A Word Cloud for “LanguageWantToWorkWith”</strong></p><p>Developers often use different programming languages due to evolving nature of programming languages, compatibility with ongoing projects, and familiarity with a particular language. Analyzing language preferences through a word cloud provides insights into the worldwide tendencies of developers regarding the programming languages they choose to work with. This visualization technique offers a visual representation of the popularity and frequency of different programming languages among developers. By examining the word cloud, we can gain a deeper understanding of the dominant languages and emerging trends in the developer community.</p><pre># Transform multianswer values into a single column<br>word_cloud = df[[&#39;LanguageWantToWorkWith&#39;]].assign(Language=df[&#39;LanguageWantToWorkWith&#39;].str.split(&#39;;&#39;)).explode(&#39;Language&#39;)<br>word_cloud.drop(columns=&#39;LanguageWantToWorkWith&#39;, inplace=True)<br><br>import matplotlib.pyplot as plt<br>from wordcloud import WordCloud<br><br># Prepare text data<br>text_data = word_cloud[&#39;Language&#39;].str.cat(sep=&#39;,&#39;)<br><br># Create WordCloud object<br>wordcloud = WordCloud(width=800, height=400).generate(text_data)<br><br># Display the generated word cloud using matplotlib<br>plt.figure(figsize=(20, 20))<br>plt.imshow(wordcloud, interpolation=&#39;bilinear&#39;)<br>plt.axis(&#39;off&#39;)<br>plt.show()<br># Create a larger figure for the word cloud</pre><p>result :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xX-tRDiVKhkJcya_wZhAHA.jpeg" /></figure><p>Some of big words can be interpret “HTML” and “CSS” is the most languange used by developer nowadays. Moreover “Java Script”, “SQL”, “Type Script”, “Bash” and “Shell” come out smaller than “HTML” and “CSS”, meaning developer might also use those language in massive number.</p><p>Then I am trying to generate wordcloud for spesific group which Scientist, Data, business analyst, machine learning specialist, Engineer using the code :</p><pre># filter data group<br>data_group = df[df[&#39;DevType&#39;].str.contains(&#39;Scientist|Data or business analyst|Data scientist or machine learning specialist|Engineer, data&#39;)]<br># Transform multianswer values into a single column<br>word_cloud = data_group[[&#39;LanguageHaveWorkedWith&#39;]].assign(Language=data_group[&#39;LanguageHaveWorkedWith&#39;].str.split(&#39;;&#39;)).explode(&#39;Language&#39;)<br>word_cloud.drop(columns=&#39;LanguageHaveWorkedWith&#39;, inplace=True)<br><br>import matplotlib.pyplot as plt<br>from wordcloud import WordCloud<br><br># Prepare text data<br>text_data = word_cloud[&#39;Language&#39;].str.cat(sep=&#39;;&#39;)<br><br># Create WordCloud object<br>wordcloud = WordCloud(width=800, height=400).generate(text_data)<br><br># Display the generated word cloud using matplotlib<br>plt.figure(figsize=(20, 20))<br>plt.imshow(wordcloud, interpolation=&#39;bilinear&#39;)<br>plt.axis(&#39;off&#39;)<br>plt.show()<br># Create a larger figure for the word cloud</pre><p>result :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QdwqU6d_sHhJtTMmpdifiA.jpeg" /></figure><p>for the spesific group define before, “Bash” and “Shell” is the most programming language used. meanwhile the “HTML” and “CSS” remain visible on big size, but those are less dominant than all samples.</p><p><strong>Conclusion :</strong></p><p>“HTML” and “CSS” is the most used programming language for developer accross job and title. Meanwhile, for the spesific data analysis group “Bash” and “Shell” is more common.</p><p>Go get into the main dish on data analytical by using statistical significance on part III :</p><p><a href="https://medium.com/@rifyalrachmat/unveiling-insights-multiple-answer-analysis-of-stack-overflows-2022-developer-survey-part-iii-6ec31de1996c">Unveiling Insights: Multiple Answer Analysis of Stack Overflow’s 2022 Developer Survey — Part III</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ee400db37821" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unveiling Insights: Multiple Answer Analysis of Stack Overflow’s 2022 Developer Survey — Part I]]></title>
            <link>https://medium.com/@rifyalrachmat/unveiling-insights-multiple-answer-analysis-of-stack-overflows-2022-developer-survey-d4a72ca162ad?source=rss-1f58a1ac5264------2</link>
            <guid isPermaLink="false">https://medium.com/p/d4a72ca162ad</guid>
            <dc:creator><![CDATA[Rifyal R]]></dc:creator>
            <pubDate>Mon, 12 Jun 2023 14:34:16 GMT</pubDate>
            <atom:updated>2023-06-13T01:55:58.571Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello world,</p><p>I am thrilled to share with you the captivating findings from my exploration of the Stack Overflow 2022 Developer Survey. This rich dataset offers a unique window into the minds of developers worldwide, allowing us to delve into the intriguing realm of multiple answer analysis. In this article, we will uncover the valuable insights and trends that emerge when we analyze the multiple responses provided by developers in their survey responses. Join me as we unravel the hidden narratives and gain a deeper understanding of the choices, preferences, and experiences of the global developer community.</p><p><strong>A General Brief : Developer’s Salary and Education</strong></p><p>To begin, Stack Overflow in conducting its 2022 Developer Survey and collected responses from around of 70,000+ software developers worldwide. The data collection period spanned from May 11, 2022, to June 1, 2022. Understanding the education landscape is crucial as it greatly influences the realm of developer learning, making this resource beneficial for learners at all stages to stay connected to industry trends. In the following article, our focus will primarily be on exploring the multiple answer of Salary and Education for individuals. By leveraging data from both the professional and learning respondents, we aim to delve into the landscape of developer learning, providing insights and analysis for readers seeking to navigate their own coding journey.</p><p><strong>Data Understanding : Detail Question Purpose</strong></p><p>As researchers, it is crucial for us to comprehend the underlying purpose behind the questions asked in the survey. Each question serves a specific objective, aiming to capture valuable insights and information about the developer community. By understanding the intention behind these questions, we can uncover meaningful patterns, trends, and correlations within the data.</p><pre># data open<br>path = f&#39;/home/cdsw/tsurvey_research/dataset/stackoverflow_research/&#39;<br>sch_name = r&#39;survey_results_schema.csv&#39;<br>df_name = r&#39;survey_results_public.csv&#39;<br><br># schema file<br>sch = pd.read_csv(path+sch_name) <br># dataframe file<br>df_raw = pd.read_csv(path+df_name)<br><br>def col_definition(df,columns):<br>  &#39;&#39;&#39;<br>  # function for col_definition<br>  in:<br>  df - input df<br>  col - target columns<br>  out:<br>  desc - string<br>  &#39;&#39;&#39;<br>  desc = df[df[&#39;qname&#39;]==columns][&#39;question&#39;].values[0]<br>  return desc<br><br># each column info each <br>print(col_definition(sch,&#39;Employment&#39;))</pre><p>result :</p><pre>Which of the following best describes your current employment status?</pre><p><strong>Data Wrangling : Refine, Transform and Enrich</strong></p><p>Data wrangling is an essential step in the data analysis process. It involves refining, transforming, and enriching raw data to ensure it is in a format that is accessible and usable for analysis. In the context of Stack Overflow’s 2022 Developer Survey, data wrangling plays a vital role in preparing the survey responses for deeper exploration and insight generation. This process includes tasks such as handling missing data, correcting inconsistencies, standardizing variables, and creating new derived variables to enhance the analytical capabilities of the dataset. By meticulously wrangling the data, researchers can unlock the true potential of the survey data, enabling them to uncover valuable patterns, trends, and correlations that can drive meaningful conclusions.</p><pre>## Add continent information<br># This function used for convert country name to continent name by using pycountry and pycountry_convert library<br>def country_to_continent(country_name):<br>    country_alpha2 = pc.country_name_to_country_alpha2(country_name)<br>    country_continent_code = pc.country_alpha2_to_continent_code(country_alpha2)<br>    country_continent_name = pc.convert_continent_code_to_continent_name(country_continent_code)<br>    return country_continent_name<br># Create a map dict to map country name to continent name<br>country_list = df_raw[&#39;Country&#39;].dropna().unique().tolist()<br><br>if &#39;Hong Kong (S.A.R.)&#39; in country_list:<br>    country_list[country_list.index(&#39;Hong Kong (S.A.R.)&#39;)] = &#39;Hong Kong&#39;<br>if &#39;Iran, Islamic Republic of...&#39; in country_list:<br>    country_list[country_list.index(&#39;Iran, Islamic Republic of...&#39;)] = &#39;Iran&#39;<br>if &#39;The former Yugoslav Republic of Macedonia&#39; in country_list:<br>    country_list[country_list.index(&#39;The former Yugoslav Republic of Macedonia&#39;)] = &#39;Macedonia&#39;<br>if &#39;Republic of Korea&#39; in country_list:<br>    country_list[country_list.index(&#39;Republic of Korea&#39;)] = &#39;South Korea&#39;<br>if &#39;Nomadic&#39; in country_list:<br>    country_list.remove(&#39;Nomadic&#39;)<br>if &#39;Timor-Leste&#39; in country_list:<br>    country_list.remove(&#39;Timor-Leste&#39;)<br>if &#39;Kosovo&#39; in country_list:<br>    country_list.remove(&#39;Kosovo&#39;)<br>if &#39;Libyan Arab Jamahiriya&#39; in country_list:<br>    country_list[country_list.index(&#39;Libyan Arab Jamahiriya&#39;)] = &#39;Libya&#39;<br>if &#39;Venezuela, Bolivarian Republic of...&#39; in country_list:<br>    country_list[country_list.index(&#39;Venezuela, Bolivarian Republic of...&#39;)] = &#39;Venezuela&#39;<br>if &#39;Congo, Republic of the...&#39; in country_list:<br>    country_list[country_list.index(&#39;Congo, Republic of the...&#39;)] = &#39;Congo&#39;<br>if &quot;CÃ´te d&#39;Ivoire&quot; in country_list:<br>    country_list[country_list.index(&quot;CÃ´te d&#39;Ivoire&quot;)] = &#39;Ivory Coast&#39;<br><br>country_2_dest_dict = {}<br>for i in country_list:<br>    country_2_dest_dict[i] = country_to_continent(i)<br><br># Append some countries that are not in the pycountry package<br>country_2_dest_dict[&#39;Timor-Leste&#39;] = &#39;Asia&#39;<br>country_2_dest_dict[&#39;Kosovo&#39;] = &#39;Europe&#39;<br><br>rename_dict = {<br>    &#39;Hong Kong (S.A.R.)&#39; : &#39;Hong Kong&#39;,<br>    &#39;Iran, Islamic Republic of...&#39; : &#39;Iran&#39;,<br>    &#39;The former Yugoslav Republic of Macedonia&#39; : &#39;Macedonia&#39;,<br>    &#39;Republic of Korea&#39; : &#39;South Korea&#39;,<br>    &#39;Libyan Arab Jamahiriya&#39; : &#39;Libya&#39;,<br>    &#39;Venezuela, Bolivarian Republic of...&#39; : &#39;Venezuela&#39;,<br>    &#39;Congo, Republic of the...&#39; : &#39;Congo&#39;,<br>}<br><br># get continent<br>df_raw[&#39;Country&#39;].replace(rename_dict, inplace=True)<br>df_raw[&#39;Continent&#39;] = df_raw[&#39;Country&#39;].map(country_2_dest_dict)<br><br>-----------------------------------------------------------------------------<br>##cleansing nan data<br># focus column<br>focus_col = [&#39;ResponseId&#39;,<br>             &#39;MainBranch&#39;,<br>             &#39;Employment&#39;,<br>             &#39;DevType&#39;,<br>             &#39;RemoteWork&#39;,<br>             &#39;CodingActivities&#39;,<br>             &#39;EdLevel&#39;,<br>             &#39;LearnCode&#39;,<br>             &#39;LearnCodeCoursesCert&#39;,<br>             &#39;Age&#39;,<br>             &#39;Blockchain&#39;,<br>             &#39;Gender&#39;,<br>             &#39;ConvertedCompYearly&#39;,<br>             &#39;Country&#39;,<br>             &#39;Currency&#39;,<br>             &#39;Continent&#39;,<br>             &#39;LanguageHaveWorkedWith&#39;,<br>             &#39;LanguageWantToWorkWith&#39;,<br>            &#39;DatabaseHaveWorkedWith&#39;,<br>            &#39;DatabaseWantToWorkWith&#39;,<br>            &#39;PlatformHaveWorkedWith&#39;,<br>            &#39;PlatformWantToWorkWith&#39;,<br>            &#39;WebframeHaveWorkedWith&#39;,<br>            &#39;WebframeWantToWorkWith&#39;,<br>            ]<br># filter focus col <br>df = df_raw[focus_col]<br><br># check null values before<br>np.sum(df.isnull())</pre><p>result:</p><pre>ResponseId                    0<br>MainBranch                    0<br>Employment                 1559<br>DevType                   11966<br>RemoteWork                14310<br>CodingActivities          14369<br>EdLevel                    1697<br>LearnCode                  1688<br>LearnCodeCoursesCert      43879<br>Age                        2322<br>Blockchain                 2197<br>Gender                     2415<br>ConvertedCompYearly       35197<br>Country                    1497<br>Currency                  22004<br>Continent                  1534<br>LanguageHaveWorkedWith     2293<br>LanguageWantToWorkWith     6241<br>DatabaseHaveWorkedWith    13147<br>DatabaseWantToWorkWith    22254<br>PlatformHaveWorkedWith    23344<br>PlatformWantToWorkWith    32853<br>WebframeHaveWorkedWith    19724<br>WebframeWantToWorkWith    27146<br>dtype: int64</pre><p>Removing null and “no answer” values is crucial to ensure the integrity and reliability of the data. These missing values may arise due to respondents skipping certain questions or intentionally leaving them unanswered. By excluding these cases from the analysis, we eliminate potential noise and ensure that the insights derived from the data are based on reliable and complete information</p><pre># Drop rows with NA values in the selected columns<br>selected_columns_to_drop_na = [&#39;ConvertedCompYearly&#39;]<br>df.dropna(subset=selected_columns_to_drop_na, inplace=True<br><br># fill nan value with No answer<br>df = df.fillna(&quot;No answer&quot;)</pre><p>Additionally, to further enrich the data, we can incorporate educational grouping based on the respondents’ field of study (EdLevel) and their main branch of work (MainBranch). This additional information allows us to gain deeper insights into the educational backgrounds of developers and how it relates to their professional pursuits. By categorizing respondents into educational groups such as Bachelor’s, Master’s, Doctoral, and Professional Degree, we can analyze the variations in career paths, technology preferences, and skill development across different levels of education. This enriched dataset empowers us to uncover correlations between educational attainment and various aspects of the developer landscape, providing valuable insights.</p><pre>## education group<br># Replace values<br>mainbranch_dict = {<br>    &quot;I am a developer by profession&quot;: &quot;Professional developer&quot;,<br>    &quot;I am learning to code&quot;: &quot;Learn to code&quot;,<br>    &quot;I am not primarily a developer, but I write code sometimes as part of my work&quot;  : &quot;Ability to code&quot;,<br>    &quot;I code primarily as a hobby&quot;: &quot;Ability to code&quot;,<br>    &quot;I used to be a developer by profession, but no longer am&quot;: &quot;Ability to code&quot;,<br>    &quot;None of these&quot; : &quot;None&quot;,<br>    &quot;No answer&quot;:&quot;None&quot; }<br><br>edu_dict = {<br>    &quot;Something else&quot;: &quot;No answer&quot;,<br>    &quot;Associate degree (A.A., A.S., etc.)&quot;: &quot;Below bachelor&quot;,<br>    &quot;Bachelor’s degree (B.A., B.S., B.Eng., etc.)&quot;: &quot;Bachelor&quot;,<br>    &quot;Master’s degree (M.A., M.S., M.Eng., MBA, etc.)&quot;: &quot;Master&quot;,<br>    &quot;Other doctoral degree (Ph.D., Ed.D., etc.)&quot;: &quot;Doctoral&quot;,<br>    &quot;Professional degree (JD, MD, etc.)&quot;: &quot;Professional degree&quot;,<br>    &quot;Secondary school (e.g. American high school, German Realschule or Gymnasium, etc.)&quot;: &quot;Below bachelor&quot;,<br>    &quot;Some college/university study without earning a degree&quot;: &quot;Below bachelor&quot;,<br>    &quot;Primary/elementary school&quot;: &quot;Below bachelor&quot;,<br>}<br><br>df[&quot;EdLevel_group&quot;] = df[&quot;EdLevel&quot;].replace(edu_dict)<br>df[&quot;MainBranch_group&quot;] = df[&quot;MainBranch&quot;].replace(edu_dict)<br><br>df.EdLevel_group.value_counts()</pre><p>result :</p><pre>Bachelor               18056<br>Master                  9877<br>Below bachelor          7772<br>Doctoral                1366<br>Professional degree      624<br>No answer                376<br>Name: EdLevel_group, dtype: int64</pre><p>Lets continue to the Part II discuss more about wordcloud and Programming Language Preferences.</p><p><a href="https://medium.com/@rifyalrachmat/unveiling-insights-multiple-answer-analysis-of-stack-overflows-2022-developer-survey-part-ii-ee400db37821">Unveiling Insights: Multiple Answer Analysis of Stack Overflow’s 2022 Developer Survey — Part II</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d4a72ca162ad" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>