Coding Category Archives - General Assembly Blog | Page 2

How is Python Used in Data Science?

By

Python is a popular programming language used by both developers and data scientists. But what makes it so popular and why are so many data scientists choosing Python over other programming languages? In this article, we’ll explore the advantages of Python programming and why it’s useful for data science.

What is Python?

No, we’re not talking about the giant, tropical snake. Python is a general-purpose, high-level programming language. It supports object oriented, structured, and functional programming paradigms.

Python was created in the late 1980s by the Dutch programmer Guido van Rossum who wanted a project to fill his time over the holiday break. His goal was to create a programming language that was a descendant of the ABC programming language but would appeal to Unix/C hackers. Van Rossum writes that he chose the name Python for this language, “being in a slightly irreverent mood (and a big fan of Monty Python’s Flying Circus).”

Python went through many updates and iterations and by the year 2008, Python 3.0 was released. This was designed to fix many of the design flaws in the language, with an emphasis on removing redundant features. While this update had some growing pains as it was not backwards compatible, the new updates made way for Python as we know it today. It continues to be well-maintained and supported as a popular, open source programming language.

In “The Zen of Python,” developer Tim Peters summarizes van Rossum’s guiding principles for writing code in Python:

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren’t special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one– and preferably only one –obvious way to do it.
Although that way may not be obvious at first unless you’re Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it’s a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea — let’s do more of those!

These principles touch on some of the advantages of Python in data science. Python is designed to be readable, simple, explicit, and explainable. Even the first principle states that Python code should be beautiful. In general, Python is a great programming language for many tasks and is becoming increasingly popular for developers. But now you may be wondering, why learn Python for data science?

Why Python for Data Science?

The first of many benefits of Python in data science is its simplicity. While some data scientists come from a computer science background or know other programming languages, many come from backgrounds in statistics, mathematics, or other technical fields and may not have as much coding experience when they enter the field of data science. Python syntax is easy to follow and write, which makes it a simple programming language to get started with and learn quickly. 

In addition, there are plenty of free resources available online to learn Python and get help if you get stuck. Python is an open source language, meaning the language is open to the public and freely available. This is beneficial for data scientists looking to learn a new language because there is no up-front cost to start learning Python. This also means that there are a lot of data scientists already using Python, so there is a strong community of both developers and data scientists who use and love Python.

The Python community is large, thriving, and welcoming. Python is the fourth most popular language among all developers based on a 2020 Stack Overflow survey of nearly 65,000 developers. Python is especially popular among data scientists. According to SlashData, there are 8.2 million active Python users with “a whopping 69% of machine learning developers and data scientists now us[ing] Python (compared to 24% of them using R).”4 A large community brings a wealth of available resources to Python users. Not only are there numerous books and tutorials available, there are also conferences such as PyCon where Python users across the world can come together to share knowledge and connect. Python has created a supportive and welcoming community of data scientists willing to share new ideas and help one another. 

If the sheer number of people using Python doesn’t convince you of the importance of Python for data science, maybe the libraries available to make your data science coding easier will. A library in Python is a collection of modules with pre-built code to help with common tasks. They essentially allow us to benefit from and build on top of the work of others. In other languages, some data science tasks would be cumbersome and time consuming to code from scratch. There are countless libraries like NumPy, Pandas, and Matplotlib available in Python to make data cleaning, data analysis, data visualization, and machine learning tasks easier. Some of the most popular libraries include:

  • NumPy: NumPy is a Python library that provides support for many mathematical tasks on large, multidimensional arrays and matrices.
  • Pandas: The Pandas library is one of the most popular and easy-to-use libraries available. It allows for easy manipulation of tabular data for data cleaning and data analysis.
  • Matplotlib: This library provides simple ways to create static or interactive boxplots, scatterplots, line graphs, and bar charts. It’s useful for simplifying your data visualization tasks.
  • Seaborn: Seaborn is another data visualization library built on top of Matplotlib that allows for visually appealing statistical graphs. It allows you to easily visualize beautiful confidence intervals, distributions, and other graphs.
  • Statsmodels: This statistical modeling library builds all of your statistical models and statistical tests including linear regression, generalized linear models, and time series analysis models.
  • Scipy: Scipy is a library used for scientific computing that helps with linear algebra, optimization, and statistical tasks.
  • Requests: This is a useful library for scraping data from websites. It provides a user-friendly and responsive way to configure HTTP requests.

In addition to all of the general data manipulation libraries available in Python, a major advantage of Python in data science is the availability of powerful machine learning libraries. These machine learning libraries make data scientists’ lives easier by providing robust, open source libraries for any machine learning algorithm desired. These libraries offer simplicity without sacrificing performance. You can easily build a powerful and accurate neural network using these frameworks. Some of the most popular machine learning and deep learning libraries in Python include:

  • Scikit-learn: This popular machine learning library is a one-stop-shop for all of your machine learning needs with support for both supervised and unsupervised tasks. Some of the machine learning algorithms available are logistic regression, k-nearest neighbors, support vector machine, random forest, gradient boosting, k-means, DBSCAN, and principal component analysis.
  • Tensorflow: Tensorflow is a high-level library for building neural networks. Since it was mostly written in C++, this library provides us with the simplicity of Python without sacrificing power and performance. However, working with raw Tensorflow is not suited for beginners.
  • Keras: Keras is a popular high-level API that acts as an interface for the Tensorflow library. It’s a tool for building neural networks using a Tensorflow backend that’s extremely user friendly and easy to get started with.
  • Pytorch: Pytorch is another framework for deep learning created by Facebook’s AI research group. It provides more flexibility and speed than Keras, but since it has a low-level API, it is more complex and may be a little bit less beginner friendly than Keras. 

What Other Programming Languages are Used for Data Science?

Python is the most popular programming language for data science. If you’re looking for a new job as a data scientist, you’ll find that Python is also required in most job postings for data science roles. Jeff Hale, a General Assembly data science instructor, scraped job postings from popular job posting sites to see what was required for jobs with the title of “Data Scientist.” Hale found that Python appears in nearly 75% of all job postings. Python libraries including Tensorflow, Scikit-learn, Pandas, Keras, Pytorch, and Numpy also appear in many data science job postings.

Image source: The Most In-Demand Tech Skills for Data Scientists by Jeff Hale

R, another popular programming language for data science, appeared in roughly 55% of the job postings. While R is a useful tool for data science and has many benefits including data cleaning, data visualization, and statistical analysis, Python continues to become more popular and preferred among data scientists for a majority of tasks. In fact, the average percentage of job postings requiring R dropped by about 7% between 2018 and 2019, while Python increased in the percentage of job postings requiring the language. This isn’t to say that learning R is a waste of time; data scientists that know both of these languages can benefit from the strengths of both languages for different purposes. However, since Python is becoming increasingly popular, there’s a high chance that your team uses Python, and it’s important to use the language that your team is comfortable with and prefers.

What is the Future of Python for Data Science?

As Python continues to grow in popularity and as the number of data scientists continues to increase, the use of Python for data science will inevitably continue to grow. As we advance machine learning, deep learning, and other data science tasks, we’ll likely see these advancements available for our use as libraries in Python. Python has been well-maintained and continuously growing in popularity for years, and many of the top companies use Python today. With its continued popularity and growing support, Python will be used in the industry for years to come.

Whether you’ve been a data scientist for years or you are just beginning your data science journey, you can benefit from learning Python for data science. The simplicity, readability, support, community, and popularity of the language — as well as the libraries available for data cleaning, visualization, and machine learning — all set Python apart from other programming languages. If you aren’t already using Python for your work, give it a try and see how it can simplify your data science workflow.

Explore Data Workshops

Free Lesson: Coding Essentials in 30 Minutes

By

More than half of all jobs in the top income quartile show significant demand for coding skills.* Spend half an hour with expert GA instructor Madeline O’Moore to write your first lines of code and learn how coding knowledge applies to so many different fields. She’ll give you an overview of:

  • How HTML and CSS function together to form the backbone of the web.
  • Key coding terms and principles.
  • Tools you can use to practice.

If you’re curious to keep exploring, discover our popular short-form workshops like Programming for Non-Programmers. To dive deeper, check out our upcoming Front-End Web Development course to cement a versatile foundation in HTML, CSS, and JavaScript. Or start exploring what it takes to launch a career in web development with our Software Engineering Immersive career accelerator.

Browse Coding Workshops and Courses

*Source: Burning Glass, Beyond Tech

The Newbie’s Guide to Android Development

By

Android101_DripArt1

This is the first post in our Android 101 series. Sign up to learn more about the world’s most popular operating system. 

In the last 10 years, Android has made a name for itself, not only with its candy-themed platform updates, but also with its widespread, and unexpected, success. In its lifetime, the open-source Android operating system has grown to include 1.4 billion active users and 80% of smartphones today run Android software. Over 1 billion Android phones were sold in 2014 alone.

Mobile app development in the programming community is the minority – just over 9% of total developers in the world say they’re focusing on mobile devices, according to Stack Overflow’s 2015 developer survey. Of these mobile developers, however, Android developers make up the larger group, with 44.6% self-identifying as Android developers, compared to 33.4% who say they are building for iOS. Even so, many companies struggle to find enough developers with the technical skills to complete their Android projects. This trend is likely to continue as the overall number of smartphone users – and Android users, specifically – continues to grow.

Continue reading

5 Steps to Getting Your First Job as a Web Developer

By

The truth is, no one is born with the coding skills a potential employer is seeking for tech job openings, and your resume doesn’t need to include a computer science degree. The good news is every web developer acquires the technical skills along the way that leads to their first job, and the path is not the same for everyone. With this dream tech job becoming a desired career path for many, you’ll want to have a proper outline. Below are my 5 steps to getting your first job as a web developer. 

1. Research and Visualize

If you came across this article because you were researching how to get a job as a web developer, guess what? You’re already immersed in the first step! Congratulations.

In one of my favorite business books, The 7 Habits of Highly Effective People, Stephen Covey outlines an easy-to-understand approach to attaining your goals — through conscious changes to your behavior and character. While all of his 7 habits are important, I want to point out habit 2 to you with regards to landing a web job: Begin with the end in mind.

In the book, Covey says that habit 2 is “based on imagination — the ability to envision in your mind what you cannot at present see with your eyes.” The idea is “based on the principle that all things are created twice,” he continues. “There is a mental (first) creation, and a physical (second) creation. The physical creation follows the mental, just as a building follows a blueprint.”

In essence, he says that everything that we bring into reality in the future has its start somewhere before, in the mind. It could be an idea, a goal, or even a Google search; suddenly “it” becomes an outline, a map or a schedule, and slowly the first mental birth gives a subsequent existence to something physical.

When it comes to your career as a web developer, this means researching the steps you can take today in order for you to be confident and capable to start a new developer job in the future. That’s how I’d like you to approach this goal.

Do your research: The better you know the blueprint for what you want to build for your web career, the more motivated you’ll remain along the way. You’ll be able to track your progress toward a goal. And then visualize: See yourself follow the plan as you grow your skills and confidence and ultimately land your dream job.

Key Takeaways:

  • Read 3–5 different takes on how to become a web developer from tech and career blogs, YouTube, Quora, LinkedIn, etc.
  • From the different perspectives you’ve gained, what is common among them? What do they say you should learn for a web developer job? How do you acquire the skills that are suggested?
  • Make a step by step plan on how you can achieve the goal. Base it on your personal skills profile, schedule, timeline, resources, etc.
  • Visualize yourself 1, 3, or 5 years in the future while focusing on what’s doable today.

2. Learn the Skills

The bottom line is that a web developer job comes down to skills and execution. Employers — your future hiring managers and colleagues — will expect you to have certain technical skills and to execute them as required by the role, especially if you want to keep the job. While soft skills are important in any organization, in this job you’ll ultimately find yourself being put to the test through your tech experience and knowledge, and your goal is to let this fuel your productivity and success. 

When I started to learn web development, I realized I had a lot of new things to learn. Coming from an arts background in college but having a life-long fascination and familiarity with computers, I knew that my English writing would not directly translate to writing code. So what did I need to do? Thankfully I was in familiar territory; I had to learn to write and to learn new languages. That meant learning new writing syntax, structure, rules, etc. From the start, I learned HTML and CSS were the backbone of the web. HTML gives structure to every webpage’s content, and CSS provides the styling. Without those two, what would the web be? Would it be?

While I was working a full-time job that was not tech-related at the time, I made a schedule for myself: at least 3 times a week I would go to a learning space or coffee shop after work to learn HTML and CSS. Yes, I visited many spaces, libraries, and coffee shops. I drank a lot of needless coffee. I researched many topics. I stumbled and learned. One night, it could take me three hours to learn a simple concept which only became a rabbit hole to other related concepts. It never seemed to end and I only had so much time in one day.

In the long run, every hurdle mattered. Once I learned something a couple of times, I started to retain knowledge, and through practice, I put it to work.

Bonus Tip: One thing I always tell my web development students is this: find a project. It can be anything — start a website about your dog, your kids, your most recent vacation, Auntie Betsy, the weather — whatever. It doesn’t matter. It doesn’t even have to be public. Just create something.

Having a pet project, even simple ones as those mentioned above, will give you a needed end-goal. You’ll start to come across hurdles as you envision what content is needed, how the website should look, how to host it, and what design you want, such as fonts, colors, assets, user experience, template layout, etc. Guess what? Each of these web hurdles and design choices may become your three hour session at a learning space, but each obstacle will reward you with practice and knowledge.

Key Takeaways:

  • Learn HTML and CSS. Interactive online platforms provide an excellent start, and they can be reinforced by coding bootcamps. If by chance you come from a graphic design background, you’ll enjoy CSS! You might soon see yourself as a web designer.
  • Learn how to write a simple HTML document from memory. The syntax will become engrained more thoroughly this way. Yes, type out the <html>, <head>, <title>, <body> and other common HTML content tags so that they become second nature. Learn how to integrate CSS into the document in-line, and through a linked stylesheet. Speaking confidently about the technical structure of an HTML + CSS page alone can help you score big in a job interview.
  • Explore JavaScript and front end web design, which will start molding you into a front end developer. What are the limits of HTML and CSS, and how does JavaScript help compliment them on the web? How can it improve your projects?
  • Explore dynamic websites to understand how a web application interacts with a database, and research different programming languages you can learn: JavaScript, Java, Python, PHP, Ruby, etc. What popular frameworks or content management systems can you explore to get started? Ultimately, this can lead to a full stack developer role.
  • Lastly, how do you get to be online given the framework or CMS? How does web hosting work? How do you deploy a web application?

3. Add to your Portfolio and Gain Experience

Once you’ve created one or two simple projects for yourself — as long as they provide a good dose of learning and experience — create something that you want to share publicly. Can’t think of anything? A personal blog or a professional resume website is a good start.

When you’ve created a website that you can share with others, get the word out. Add it to your social media profiles, including LinkedIn. Don’t be afraid to market it, and of course, improve it as new ideas and content start to flow.

My first public web project was a short story fiction website. Because I came from an arts background, it was actually my interest in creative writing that brought me to tech. I had owned a web domain for a couple of years (the “idea”), but it wasn’t until I was determined to create my own website that I took the steps to build it.

While I enjoyed writing and publishing short stories, through the project, I continued learning about web publishing, platforms and upkeep. I was public about my project and in time I had guest writers’ content on my site, and family and friends reading it. Before I knew it, I had family and friends asking me if I knew how to make a website. “Oh, you’re opening a business and want to know if I can help with the website? I’d love to”, I’d say.

At first, I built websites for family and friends, and then used that experience to get the attention of third-degree references. Ultimately, I started to freelance and gained contract work. I created professional business websites for small businesses and individuals. In the span of two years, I had decent freelancing experience, a nice group of samples from my creations, professional references, and the confidence to apply to full-time opportunities.

Key Takeaways:

  • Put to practice what you’ve learned. If you haven’t already, purchase your first domain. Choose a CMS or framework to get started.
  • Host and publish content, improve it, maintain it, and share it.
  • Add the site to your social media profiles, in the links or projects section.
  • Be open to freelance work with friends and family. Help someone improve their website. Provide web advice and guidance. Work on making someone else’s dreams come true through your new web skills.
  • Let one project breed the next. You’ll be amazed how many people and businesses need help online. After a handful of contract projects, you can start considering yourself a freelance junior web developer.

4. Be Part of a Community

Depending on the languages, frameworks, or CMS you choose to work with, be part of that community. Your presence can be digital and physical. Subscribe to pertinent tech blogs and tutorial websites on the subject to stay fresh; join online communities of tech professionals where you can learn and give help (e.g. Stack Overflow, WordPress.org); join an offline meet-up; attend a conference, coding bootcamp, and hackathon. This community experience will improve your coding skills, allow you to network, increase your chances of more freelance projects, and make you look more experienced to a potential employer.

Because I knew very little at first, I initially gravitated toward WordPress — an open source CMS. While I wasn’t programming at first, I learned the fundamentals of a front-end developer (HTML, CSS, JavaScript) and then back-end languages such as PHP and SQL. I subscribed to WordPress blogs, joined WordPress.org where I participated in forums, took tutorial after tutorial, listened to tech podcasts, and attended WordPress events. All of this helped me during the job search for not only freelance clients but also my first web development job. My first job ultimately included leading the development of event websites for a health industry corporation, and soon after, I also started to teach WordPress to others!

If you decide to start making simple websites with a CMS that is not open source, such as Shopify, Squarespace, or Wix, that’s fine too. As long as you can practice HTML and CSS at first, it will springboard you into other challenges. Eventually, I gravitated toward PHP, Python and related frameworks, and I became involved in those communities as well.

Key Takeaways:

  • Where are those who use your CMS or programming language hanging out? Developers tend to find each other online in forums, blogs and community websites. Join, say hello, and start to learn and contribute.
  • Be open to offline interaction. Look up events near you, or travel if you need to. While developers do enjoy their desks, events are very common. Programming does not have to be a solo experience.

5. Think Like a Recruiter

At this point, feel confident that you’re a junior or experienced web developer candidate for any potential employer, depending on the amount of freelancing you’ve done. Hiring managers will be interested because you have a solid working knowledge of how to make websites, you’ve built your own projects, you’ve helped create or improve others’ sites, and your community involvement shows you’re eager and motivated.

The next thing you’ll want to do is place yourself in the shoes of a recruiter. Whether it’s an in-house recruiter seeking talent for their tech company, or a staffing agency’s tech recruiter looking to find candidates for clients, your resume will not get to the hiring manager unless it first attracts a recruiter.

I landed my first web job through the help of a staffing agency’s tech recruiter who thought I’d be a good fit for a client. After a contract period, I was converted to a full-time employee. You’ll find that this is a common and realistic route.

In your resume, use keywords to be specific about the programming languages you’ve learned, including related frameworks, dependencies, tools, and software. When tech industry recruiters are looking at your resume, they want to make sure they won’t be wasting the hiring manager’s time with someone who doesn’t have specific experience in what’s required. Keywords are also how recruiters will find you.

Be open to templates. Recruiters are open to creative templates and designs as long as the content is strong. Use services such as Canva to find interesting layouts. Don’t forget to add the time you worked as a freelancer, your web links and projects, and any related education you’ve completed. Create different drafts of your resume, and get others’ opinions.

Maintain consistency across job boards and social profiles. Create a profile on 2-5 job boards. LinkedIn should go without saying — make sure the verbiage used on LinkedIn matches what you’ll send a recruiter or hiring manager on your resume. Keep thinking keywords. Consider joining other job boards such as Indeed, Glassdoor, or Monster, which are general job boards that recruiters frequent, or even tech-focused ones such as Hired, StackOverflow, or GitHub.

Be active online. Share others’ content and consider creating content of your own, such as videos, articles, and podcasts.

On the job boards, select that you’re open to being contacted by recruiters, but be subtle. Be open to a junior web developer job. Stay attentive and courteous even to opportunities that don’t align with your expectations: you never know which recruiter or employer may be the right match now or down the line.

The Opportunity is Yours

When you land a call or an in-person interview, be honest about what you know and don’t know, and be confident about what you can bring to the table. Always come prepared.

Once you have an interview, the opportunity is yours. There’s one thing left to do: ace the interview with the belief that you can walk through that door of what was once a visualization.

Learn Front-End Web Development Online

Are Coding Jobs Boring?

By

When you think about a new career in coding, what comes to mind? Do you imagine working behind the scenes at a movie studio or fashion house? The deep satisfaction of improving a life-saving medical device? The systems and engineering mindset needed to build the dashboard controls for a new smart car? 

Maybe you’re thinking of a workplace where projects are different every day, like an ad agency building websites for global brands. You may even have an app idea that could really change the landscape, if only you knew how to make it. Whatever you think a coding career might be, you’re probably right — unless you think it’s boring.

Of course, every job has its boring moments, as well as stressful ones. The good news is, once you become a proficient coder, you can begin to explore and decide on the types of coding projects that will help you thrive for years in your new career. The idea is to choose a career path that’s the right fit for your particular working style.

The variety of industries that hire programmers and developers is endless, from the energy industry to retail operations to manufacturing to social causes. The software your dentist uses to view your x-rays; the app that you use to order takeout; the computer in your car that lets you know your coolant is low; the playlist that syncs your phone to your home audio system — all of these cool innovations were made possible by teams of professional coders.

Remember, writing code is not the only programming skill out there. The individuals who built those solutions to everyday challenges have lots of different titles, from web developer to mobile developer to software engineer, or even data scientist. All of them work with code in their own ways and have their own career paths, with their own obstacles and rewards. With so many career options that stem from a shared set of programming skills, the last thing the coding field could be called is boring. The real question is, is coding the right fit for you?

Do you like learning new things?

Neuroscience reveals that our brains have something in common with technology: neither our brains nor tech are fixed, but are instead constantly changing and evolving.

Experienced senior developers are constantly studying to learn new coding skills, as new programming languages like Python become widely used, and new applications are found for existing fields like machine learning

Fortunately, you don’t need a computer science degree to start a new career programming career. Many coders and developers are self-taught, using free or low-cost resources available at their local libraries or online such as Stack Overflow. Some seek out learning opportunities at their current jobs, like volunteering to help maintain a business website or install a new database. Still others invest in themselves by signing up for a coding bootcamp with live instruction, real-time code critiques, and built-in networking opportunities.

In the end, the programmers who are most successful in this field are the ones who continuously upskill and stay current with new developments in tech. What does this mean for you? It means that a demonstrated commitment to lifelong learning and a growth mindset can be the key characteristic that sets you apart from other candidates for that first junior developer job!

Are you good at solving puzzles?

Can’t get enough of jigsaw puzzles, riddles, and crosswords? Your ability to quickly see patterns and solutions where others do not is a quality that could serve you very well in a software development or computer programming career. Successful engineers and developers have a great eye for detail, an essential skill in a field where a single misplaced bit of punctuation can stop an elite billion-user app dead in its tracks.

Is it stressful? Not for you, because you thrive on pursuing solutions when others have given up, and find it deeply rewarding to help a team resolve wicked issues that no one could fix alone. Every bug is an interesting coding challenge, and every update a chance to make something good into something even better.

Are you a musician?

If you think composing and arranging music is fun, you’re likely to find programming to be fun as well, and a good fit for your skills. Studies show that playing music can help people learn more quickly and create more elegant and creative solutions to complex problems. Trained musicians and successful coders tend to share certain core competencies: a good memory for details, the ability to sort and prioritize an incredible amount of information, and the skill to recognize and tweak patterns. A musician with programming skills can be a great team asset, proficient in both creativity and code. There are even coding courses and workshops designed especially for musicians. Who knew?

Every musician understands the importance of practicing scales before you play your first concerto. In a line of work like programming, a great way to learn is to practice writing bits of code over and over, then begin to string those bits together in sequence until you’ve composed something wonderful and new.


Consider what makes you thrive in a workplace. There will be stressful days and boring days in whatever field you choose, and to stand out in any field requires hard work. But if finding patterns, solving puzzles, or taking small perfect bits and then using them to craft something larger and much more complex sounds enjoyable to you, buckle up — a new programming career may be exactly the path that’s meant for you.

Learn Software Engineering Online

5 Steps to Getting Your First Job in Software Engineering

By

Unsure how to get a software engineering job or where to start? Landing your first job as a software engineer can seem like an intimidating milestone to reach. It feels even harder when you don’t have a computer science background and you’re transitioning from another field, especially one that you’ve worked years to develop a career in. Feelings of uncertainty come in many forms. Your inner dialog may sound like this:

“My resumé isn’t compelling enough to get a job in this new field.”
“I’m a beginner all over again, and I don’t know enough to do this well.”
“If I start over, I’m afraid I’ll fail.”
“I feel like an imposter trying to get a job in something I know so little about.”

If these are some of the thoughts you’ve had when considering a career change, you’re not alone. These are fears that most of my students have expressed in my 5 years teaching at General Assembly, and they are totally logical fears to have. Fortunately, there are clear steps you can take and definitive questions you can answer for yourself which will keep you on a path to landing a great first job in software engineering. They are:

  1. Figure out what kind of software engineering interests you.
  2. Learn the basics.
  3. Build projects.
  4. Begin applying for software engineering positions.
  5. Learn from your interviews.

1. Decide what kind of programmer you want to start out as.

You’ve decided to take the plunge into software engineering, but did you know there are many different kinds of software developers? Jobs in programming run everywhere from front-end engineering (on the design side), back-end engineering (on the server side), to security engineering, DevOps, and testing automation!

Those are some of the more common types that most companies will need to hire for, so the question isn’t, “What kind of engineer do you want to be?”, it’s “what kind of engineer do you want to start out as?” This distinction is important because you should try to work for a company that gets you going with a clear set of roles and responsibilities, but also fosters an environment that will allow you to try out other types of work too. Some of the best software developers I’ve worked with were at one point doing a completely different set of tasks at the start of their career.

So, what interests you the most?

2. Learn the basics of software development.

It goes without saying that you’ll want to acquire some knowledge in computer programming before sending out a bunch of job applications. But where to start? There are a ton of great resources out there, but I’ll outline what I think is a great approach for most people to get a good start in programming knowledge:

  1. Take some classes. Whether it’s through one of General Assembly’s coding courses, a highly rated video course on Udemy, or a coding bootcamp, it’s important to get some experience learning from an industry professional. It’s also good to be able to collaborate with other students doing a similar career change.
  2. Read a lot. The learning doesn’t stop after taking some short-form classes. After you’ve mastered the basics of programming, you’ll be able to effectively self-teach too. Get some good programming literature! Here’s a list of some great books for beginners.

You’ll want to focus your learning on the basics of programming and computer science. Key areas to educate yourself on should include:

  • Programming fundamentals: Variables, conditionals, loops, functions, etc.
  • Design patterns: How programs are structured to be maintainable and easy to reason about.
  • Popular frameworks (such as React, Angular, Express, Rails etc.) are a plus because they provide transferable skills while giving you a competitive edge by staying current. However, it’s still super important to base your education on the fundamentals of programming. A good drummer won’t learn how to play fancy fills without first learning the rudiments, and software development is no different!

3. Build, build, build!

Always have a project to work on. Apply the skills you’re learning by practicing on real-world projects. For example, if you’re reading a tutorial on how to build a user interface with React, try building your own portfolio website using React. You’ll be doing two great things for your career at the same time:

  1. Practicing and honing transferable skills.
  2. Building your software engineering portfolio with actual case studies and proofs of concept.

4. Start applying for jobs.

Software developer job openings are constantly being posted as new companies are founded, existing companies expand, and established companies evolve. When it comes to startups vs. established companies, there are some significant differences you’ll likely come across. For instance, a new startup might have more employee perks, such as flexible time off, but might also demand more weekend hours put in. On the other hand, an older established company might provide a more clearly defined set of roles and responsibilities and a better structure for employee growth.

It’s ultimately different from company to company, but the pattern I’ve seen lately is that startups provide more incentives to apply, with more initial flexibility for the employee. Keep in mind though that startups are by nature less likely to succeed long-term.

5. Use every interview as a learning experience.

You’ll start to land interviews comprised of multiple stages that will vary slightly by company but typically look something like this:

  1. Initial interview with a recruiter or hiring manager that’s usually less technical
  2. A more technical second interview with an engineer on the team, where they’ll get to know your current skill set
  3. Meeting with more members of the team which will usually include a code challenge of some sort
  4. Final interview with a company leader which hopefully includes an offer!

It’s important to remember a few things during the interview process. First of all, most modern tech companies want to hire you, not just your skills. They don’t want to just hear you rattle off a bunch of technical terms that make it sounds like you’re more experienced than you are. They want to know about you, your passions, your curiosity, your drive to learn, and your drive to grow with the company. None of those things are strictly reliant on 10+ years of experience like the job postings might say. While there is a base level of skill that is required, you’ll want the company to know that you are a good long-term fit; that you can become the software engineer that you want to be with them.

Every interview you take will be a culture fit test. Be a nice person, be curious, ask questions.

The technical part of the interview is often the scariest. During the technical interview or code challenge, sometimes you’ll have to write code by hand on a white board with people watching. It can be terrifying unless you really think about the actual purpose of the technical interview. What’s important to remember when prepping for the code challenge is that it’s designed to be hard. A well-crafted code challenge is not meant to be completed in short order. Rather, it’s meant to give the interviewer deeper insight on your current skill set as well as your ability to speak about how you navigate through a problem you’ve been tasked with solving. If you were able to finish the code challenge too easily, the company would have no idea where your skills max out at.

When engaging in a code challenge, the interviewer wants to understand your thought process for problem solving; how you might approach going from the prompt to the solution and the reasoning behind it. For a good code challenge, they want to see your journey through the problem. Of course, you do need to learn the basic fundamentals of programming to even begin a code challenge, but you’ll get to a point where you can at least show the interviewer how you’re framing the problem and coming up with a potential solution. Every interview is a learning experience. Keep these tips in mind. You’ll get better at the process, and you’ll eventually land that software engineering job where your new career will really begin!

Learn Software Engineering Online

4 Tips for Preparing for a Coding Interview

By

If you’re applying for a software engineering position of some kind, chances are you’ll encounter some sort of technical interview or coding challenge. For newer engineers applying for software programming roles, the coding interview is oftentimes the most terrifying part. However, with a few interview preparation tips and things to consider, the technical interview will seem a lot less scary, and will hopefully be a valuable learning opportunity during your job search. Let’s break down a few helpful tips:

1. Build the hard skills.

Get in the habit of regularly doing code challenges. It’s a much more effective way to prepare for the coding interview than trying to cram a bunch of studying in before the big day. It’s important to schedule time each day to attempt at least one code challenge. You’ll get better at solving them, and you’ll also get better at outlining your process and speaking to it. A few great websites to help you practice code challenges in varying degrees of difficulty include: LeetCode, Codewars, and AlgoExpert.

These code challenges help build the essential hard skills you need to technically perform well in a coding interview. If you’re applying for a mid-level position as a software engineer, you’ll want to feel pretty solid with these types of challenges in your interview preparation. If you’re gearing up for your first technical interview as a junior engineer, you’ll want at least some exposure and practice with these. 

2. Don’t forget the soft skills.

Mastery of coding challenges is only half the battle, so don’t forget the soft skills. Throughout the entire interview process, including the technical coding interview, there are a lot of things that interviewers are looking for besides your ability to code. These other skills have to do with how well you communicate, collaborate, talk about the problem at hand, your leadership skills, your drive to learn, and generally speaking, how nice you are. Soft skills are often overlooked by candidates and can be deal breakers for a lot of coding interviews.

A company that’s worth applying to will want candidates that have strong soft skills, sometimes moreso than hard skills, because they show how well a person can grow within the company and develop those hard skills over time. This is especially the case for junior software engineers.

When you practice your code challenges, see if you can buddy up with someone and take turns doing mock interviews. Practice talking through the problems as you work, asking questions, giving each other hints here and there, and revealing your ability to lead, collaborate, and persevere.

3. Acknowledge multiple solutions.

This is the “cherry on top” for an interviewer: a candidate that’s not only skilled enough to work through the problem and has a personality that fits the company culture, but can also defend their solution and mention alternative approaches. This shows that you’re not just going with what you were taught or what you read online, but that you also acknowledge that there are multiple solutions to the same problem and have considered which is most appropriate for a given context.

As an interviewer administering a coding problem, I would prefer to see the simpler solution over the best solution, as it will give me more time to talk with the candidate. Now, if that candidate can also suggest alternative approaches and defend why they selected theirs, that’s an instant win. Bravo!

An example of this might be a challenge where you’re asked to design a search function for a video streaming app. You might use an inefficient algorithm for the sake of quick implementation during the job interview, but then mention a more appropriate algorithm that would otherwise be used in real life. Speaking of algorithms…

4. Study your algorithms and data structures.

This goes hand-in-hand with the hard skills, but deserves its own section. You don’t need to be a master of computer science to ace a coding interview, but there are some standard algorithms and data structures that you should feel good about referencing, or at least mentioning and talking about. For instance:

  • How does a bubble sort work vs. a merge sort?
  • What’s the difference between a stack and a queue?
  • What’s a linked list? What about a hash table?

It’s likely that you’ll be asked any of these interview questions, so becoming familiar with and being able to speak about them to a degree is a good thing. Cracking The Code Interview by Gayle Laakmann McDowell is a great book that covers all of the essential algorithms, data structures, and how to implement and use them in sample code challenges.

The coding interview is an opportunity for you to not only show off your skills as an engineer, but also to demonstrate how well you work with others. It’s designed to simulate what it’s like to work with you on a team. So be yourself, study and practice, take a deep breath, and go crush that coding interview!


Learn Software Engineering Online

How to Run a Python Script

By

As a blooming Python developer who has just written some Python code, you’re immediately faced with the important question, “how do I run it?” Before answering that question, let’s back up a little to cover one of the fundamental elements of Python.

An Interpreted Language

Python is an interpreted programming language, meaning Python code must be run using the Python interpreter.

Traditional programming languages like C/C++ are compiled, meaning that before it can be run, the human-readable code is passed into a compiler (special program) to generate machine code – a series of bytes providing specific instructions to specific types of processors. However, Python is different. Since it’s an interpreted programming language, each line of human-readable code is passed to an interpreter that converts it to machine code at run time.

So to run Python code, all you have to do is point the interpreter at your code.

Different Versions of the Python Interpreter

It’s critical to point out that there are different versions of the Python interpreter. The major versions you’ll likely see are Python 2 and Python 3, but there are sub-versions (i.e. Python 2.7, Python 3.5, Python 3.7, etc.). Sometimes these differences are subtle. Sometimes they’re dramatically different. It’s important to always know which Python version is compatible with your Python code.

Run a script using the Python interpreter

To run a script, we have to point the Python interpreter at our Python code…but how do we do that? There are a few different ways, and there are some differences between how Windows and Linux/Mac do things. For these examples, we’re assuming that both Python 2.7 and Python 3.5 are installed.

Our Test Script

For our examples, we’re going to start by using this simple script called test.py.

test.py
print(“Aw yeah!”)'

How to Run a Python Script on Windows

The py Command

The default Python interpreter is referenced on Windows using the command py. Using the Command Prompt, you can use the -V option to print out the version.

Command Prompt
> py -V
Python 3.5

You can also specify the version of Python you’d like to run. For Windows, you can just provide an option like -2.7 to run version 2.7.

Command Prompt
> py -2.7 -V
Python 2.7

On Windows, the .py extension is registered to run a script file with that extension using the Python interpreter. However, the version of the default Python interpreter isn’t always consistent, so it’s best to always run your scripts as explicitly as possible.

To run a script, use the py command to specify the Python interpreter followed by the name of the script you want to run with the interpreter. To avoid using the full path to your script (i.e. X:\General Assembly\test.py), make sure your Command Prompt is in the same directory as your script. For example, to run our script test.py, run the following command:

Command Prompt
> py -3.5 test.py
Aw yeah!

Using a Batch File

If you don’t want to have to remember which version to use every time you run your Python program, you can also create a batch file to specify the command. For instance, create a batch file called test.bat with the contents:

test.bat
@echo off
py -3.5 test.py

This file simply runs your py command with the desired options. It includes an optional line “@echo off” that prevents the py command from being echoed to the screen when it’s run. If you find the echo helpful, just remove that line.

Now, if you want to run your Python program test.py, all you have to do is run this batch file.

Command Prompt
> test.bat
Aw yeah!

How to Run a Python Script on Linux/Mac

The py Command

Linux/Mac references the Python interpreter using the command python. Similar to the Windows py command, you can print out the version using the -V option.

Terminal
$ python -V
Python 2.7

For Linux/Mac, specifying the version of Python is a bit more complicated than Windows because the python commands are typically a bunch of symbolic links (symlinks) or shortcuts to other commands. Typically, python is a symlink to the command python2, python2 is a symlink to a command like python2.7, and python3 is a symlink to a command like python3.5. One way to view the different python commands available to you is using the following command:

Terminal
$ ls -1 $(which python)* | egrep ‘python($|[0-9])’ | egrep -v config
/usr/bin/python
/usr/bin/python2
/usr/bin/python2.7
/usr/bin/python3
/usr/bin/python3.5

To run our script, you can use the Python interpreter command and point it to the script.

Terminal
$ python3.5 test.py
Aw yeah!

However, there’s a better way of doing this.

Using a shebang

First, we’re going to modify the script so it has an additional line at the top starting with ‘#!’ and known as a shebang (shebangs, shebangs…).

test.py
#!/usr/bin/env python3.5
print(“Aw yeah!”)

This special shebang line tells the computer how to interpret the contents of the file. If you executed the file test.py without that line, it would look for special instruction bytes and be confused when all it finds is a text file. With that line, the computer knows that it should run the contents of the file as Python code using the Python interpreter.

You could also replace that line with the full path to the interpreter:

#!/usr/bin/python3.5

However, different versions of Linux might install the Python interpreter in different locations, so this method can cause problems. For maximum portability, I always use the line with /usr/bin/env that looks for the python3.5 command by searching the PATH environment variable, but the choice is up to you.

Next, we’re going to set the permissions of this file to be executable with this command:

Terminal
$ chmod +x test.py

Now we can run the program using the command ./test.py!

Terminal
$ ./test.py
Aw yeah!

Pretty sweet, eh?

Run the Python Interpreter Interactively

One of the awesome things about Python is that you can run the interpreter in an interactive mode. Instead of using your py or python command pointing to a file, run it by itself, and you’ll get something that looks like this:

Command Prompt
> py
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 21:26:53) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

Now you get an interactive command prompt where you can type in individual lines of Python!

Command Prompt (Python Interpreter)
>>> print(“Aw yeah!”)
Aw yeah!

What’s great about using the interpreter in interactive mode is that you can test out individual lines of Python code without writing an entire program. It also remembers what you’ve done, just like in a script, so things like functions and variables work the exact same way.

Command Prompt (Python Interpreter)
>>> x = "Still got it."
>>> print(x)
Still got it.

How to Run a Python Script from a Text Editor

Depending on your workflow, you may prefer to run your Python program directly from your text editor. Different text editors provide fancy ways of doing the same thing we’ve already done — pointing the Python interpreter at your Python code. To help you along, I’ve provided instructions on how to do this in four popular text editors.

  1. Notepad++
  2. VSCode
  3. Sublime Text
  4. Vim

1. Notepad++

Notepad++ is my favorite general purpose text editor to use on Windows. It’s also super easy to run a Python program from it.

Step 1: Press F5 to open up the Run… dialogue

Step 2: Enter the py command like you would on the command line, but instead of entering the name of your script, use the variable FULL_CURRENT_PATH like so:

py -3.5 -i "$(FULL_CURRENT_PATH)"

You’ll notice that I’ve also included a -i option to our py command to “inspect interactively after running the script”. All that means is it leaves the command prompt open after it’s finished, so instead of printing “Aw yeah!” and then immediately quitting, you get to see the Python program’s output.

Step 3: Click Run

2. VSCode

VSCode is a Windows text editor designed specifically to work with code, and I’ve recently become a big fan of it. Running a Python program from VSCode is a bit complicated to set it up, but once you’ve done that, it works quite nicely.

Step 1: Go to the Extensions section by clicking this symbol or pressing CTRL+SHIFT+X.

Step 2: Search and install the extensions named Python and Code Runner, then restart VSCode.

Step 3: Right click in the text area and click the Run Code option or press CTRL+ALT+N to run the code.

Note: Depending on how you installed Python, you might run into an error here that says ‘python’ is not recognized as an internal or external command. By default, Python only installs the py command, but VSCode is quite intent on using the python command which is not currently in your PATH. Don’t worry, we can easily fix that.

Step 3.1: Locate your Python installation binary or download another copy from www.python.org/downloads. Run it, then select Modify.

Step 3.2: Click next without modifying anything until you get to the Advanced Options, then check the box next to Add Python to environment variables. Then click Install, and let it do its thing.

Step 3.3: Go back to VSCode and try again. Hopefully, it should now look a bit more like this:

3. Sublime Text

Sublime Text is a popular text editor to use on Mac, and setting it up to run a Python program is super simple.

Step 1: In the menu, go to Tools → Build System and select Python.

Step 2: Press command +b or in the menu, go to Tools → Build.

4. Vim

Vim is my text editor of choice when it comes to developing on Linux/Mac, and it can also be used to easily run a Python program.

Step 1: Enter the command :w !python3 and hit enter.

Step 2: Profit.

Now that you can successfully run your Python code, you’re well on your way to speaking parseltongue!

– – – – –

Explore Our Upcoming Coding Programs

3 Major Uses for Python Programming

By

Python is a popular and versatile programming language. But what is Python used for? If you’re interested in learning Python or are in the process of learning how to code in Python, your efforts will be greatly rewarded as there’s so much you can do with it. In this article, we’ll explore the top three major uses for Python.

Before we dive into the uses, let’s briefly discuss why Python has so many uses in the first place. What characteristics does Python have that allow it to be so useful? Python is:

  • General-purpose: The language was designed to be “general purpose”, meaning it doesn’t have language constructs to force it into a specific application domain. Other programming languages that are general-purpose include (but are not limited to): C++, Go, Java, JavaScript, and Ruby. 
  • Readable: Python is a high-level programming language, meaning it has a higher level of abstraction from machine language and has a simple syntax and semantics (e.g., indentation instead of curly brackets to indicate blocks), which lends to its readability. 
  • Versatile: Python has a large standard library, meaning it comes equipped with a lot of specialized code to handle different tasks. For example, instead of writing your own Python code to read and write CSV files, you can use the csv module’s reader and writer objects. In addition, there are many open-source libraries and frameworks that provide additional value for Python programmers — especially those in machine learning, deep learning, application development, and game development — and scientific computing will find an ample supply of libraries and modules.

What is Python used for? There are so many different tasks that Python can accomplish. You can use it to build recommender systems, create cool charts and graphs, build restful APIs, program robots, conduct scientific computing, manipulate text data or extract text from images; the list goes on and on. 

The best way to think about uses for Python is through the most active and popular disciplines that rely on Python programming:

  1. Artificial intelligence and machine learning
  2. Data analysis and data visualization
  3. Web development

1. Artificial Intelligence and Machine Learning

What it is: Artificial Intelligence is a concept that’s more or less the idea of machines or computers that mimic human cognitive functions such as “learning” and “problem-solving.” Activities like driving a car, playing chess, and answering a question are all structured, logic-based things that humans can do that are being implemented by computers today. At the heart of this activity is machine learning, which is the process that a computer takes to learn the relationships between variables in data so well that it can predict future outcomes (usually on unseen data). If data is the input (“knowledge”), the machines understand the relationships between variables (“learning”) and it can predict what the next step is (“outcome”) — then you have machine learning. 

How Python is used: Artificial intelligence requires a lot of data, which in turn requires appropriate storage, pre-processing, and data modeling techniques to be implemented. Deep learning is the intermediary component; it’s the use of specialized models (neural networks) that can handle “big data” at scale. Python is a programming language of choice for the machine learning, deep learning, and artificial intelligence community due to it being a minimalistic and intuitive language with a significant number of libraries dedicated to machine learning activities, which reduces the time required to implement and get results. R is another popular language used by machine learning enthusiasts and practitioners, but Python tends to be more popular because of the number of machine learning and AI-related efforts coming from the tech community, which uses Python. For example, TensorFlow is Google’s AI platform and open-source software library used for machine learning and the creation of neural networks for AI purposes.

Helpful links: Machine Learning, Python Libraries for Machine Learning

2. Data Analysis and Data Visualization

What it is: Data analysis is the specialized practice of analyzing data, both big and small, for information and insights. Results of data analyses are often visualized, for the benefit of the recipient, and the tools and techniques used to communicate results visually requires the specialization that is known as data visualization. Data analysis and data visualization are not unique to any industry. It’s better to think of them as process-focused roles than industry-specific roles. After all, every company and industry has its own data to work with. What data analysis is not is the management of data from servers and storage, although some data analysts specialize in data management.  

How Python is used: Data analysis and data visualization are specialized roles that can implement Python in ways that are integral to the mission of each role. A data analyst will use Python for data wrangling and data transformation, which is converting data from its raw format to a usable, analyzable format. Then, using open-sourced libraries like Pandas, NumPy, and SciPy, data analysts can manipulate and analyze both numerical and categorical data. In order to visualize data locally, additional libraries such as Seaborn, matplotlib, ggplot, and bokeh, can be used. Some data visualization professionals prefer using Python over business intelligence platforms like PowerBI and Tableau because it’s free, easy to learn, and reduces the need to have to use additional software to create visualizations. 

Helpful links: Data Analysis in Python, Python Libraries for Data Visualization

3. Web Development 

What it is: Web development is a catch-all term for creating web applications and application programming interfaces (APIs) for the web. Web development is a highly specialized role that can be explained by the design pattern known as model, view, and controller (MVC). These terms represent the specialized layers of code of a web application or API. The model involves the code for an application’s dynamic data structure, the view involves the code that directly interacts with the user, and the controller is the code that handles user interactions and works to facilitate input going from the view to the model.

How Python is used: Python has several MVC frameworks that can be used for web application development straight out of the box, and this includes Django, turbogears, and web2py. While a web framework is not required for web development, it’s beneficial to use them as they greatly speed up the development progress. For beginners, learning Python’s syntax and the libraries needed for building a web application or API is a high level of effort, but the alternative would involve a much greater effort, as it would require the knowledge and correct use of multiple programming languages instead of Python.

Helpful links: Full Stack Python: Web Development, Web Frameworks for Python

Conclusion

We’ve explored the major uses for Python, which include machine learning and artificial intelligence, data analysis and data visualization, and web development. If you’re currently learning Python programming, then you’re off to a good start, especially if you’re considering pursuing work in any of the aforementioned areas. For those unsure how to start learning Python, I encourage you to read some of our other posts, which provide more details and tips on how to get started.

Explore Our Upcoming Coding Programs

Beginner’s Python Cheat Sheet

By

Data Science is rapidly becoming a vital discipline for all types of businesses. An ability to extract insight and meaning from a large pile of data is a skill set worth its weight in gold. Due to its versatility and ease of use, Python has become the programming language of choice for data scientists.

In this Python cheat sheet, we will walk you through a couple of examples using two of the most used data types: the list and the Pandas DataFrame. The list is self-explanatory; it’s a collection of values set in a one-dimensional array. A Pandas DataFrame is just like a tabular spreadsheet, it has data laid out in columns and rows.

Let’s take a look at a few neat things we can do with lists and DataFrames in Python!
Get the pdf here.

Python Cheat Sheet

Lists

Creating Lists

Create an empty list and use a for loop to append new values.

#add two to each value
my_list = []
for x in range(1,11):
my_list.append(x+2)

We can also do this in one step using list comprehensions:

my_list = [x + 2 for x in range(1,11)]

Creating Lists with Conditionals

As above, we will create a list, but now we will only add 2 to the value if it is even.

#add two, but only if x is even
my_list = []
for x in range(1,11):
if x % 2 == 0:
my_list.append(x+2)
else:
my_list.append(x)

Using a list comp:

my_list = [x+2 if x % 2 == 0 else x \
for x in range(1,11)]

Selecting Elements and Basic Stats

Select elements by index.

#get the first/last element
first_ele = my_list[0]
last_ele = my_list[-1]

Some basic stats on lists:

#get max/min/mean value
biggest_val = max(my_list)
smallest_val = min(my_list)avg_val = sum(my_list) / len(my_list)

DataFrames

Reading in Data to a DataFrame

We first need to import the pandas module.

import pandas as pd

Then we can read in data from csv or xlsx files:

df_from_csv = pd.read_csv(‘path/to/my_file.csv’,
sep=’,’,
nrows=10)
xlsx = pd.ExcelFile(‘path/to/excel_file.xlsx’)
df_from_xlsx = pd.read_excel(xlsx, ‘Sheet1’)

Slicing DataFrames

We can slice our DataFrame using conditionals.

df_filter = df[df[‘population’] > 1000000]
df_france = df[df[‘country’] == ‘France’]

Sorting values by a column:

df.sort_values(by=’population’,
ascending=False)

Filling Missing Values

Let’s fill in any missing values with that column’s average value.

df[‘population’] = df[‘population’].fillna(
value=df[‘population’].mean()
)

Applying Functions to Columns

Apply a custom function to every value in one of the DataFrame’s columns.

def fix_zipcode(x):
”’
make sure that zipcodes all have leading zeros
”’
return str(x).zfill(5)
df[‘clean_zip’] = df[‘zip code’].apply(fix_zipcode)

Explore Our Python Course