Skip to content
  • about

PyMarketer

>>> from pymarketer import blog, projects

Tag: pandas

Written by pymarketerFebruary 9, 2022February 10, 2022

How to Convert a Python Dictionary to and from a pandas DataFrame

This is an example of how to cast a Python dict into a dataframe and vice versa. I picked up the df to dict part from this Python and R tips post and the dict to df part from a Stack Overflow post. The below adaptation begins by converting an “NFL quarterbacks” Python dictionary into […]

Written by pymarketerJanuary 7, 2022August 10, 2022

Create a Column of Values in Pandas with df.assign()

Pandas is amazing, what else is there to say? Learning the nuances of its API have yielded tons of times where it helped me get stuff done. I recently picked up the pandas dataframe’s “assign” function for creating a new column of values. This is an elegant way to set a column of values in […]

Written by pymarketerDecember 31, 2021January 15, 2022

Phone Number Cleaning Regex + pandas Series Example

This is a solution I worked out recently to strip phone numbers into a uniform format. To install pandas with pip, enter in command prompt: python -m pip install pandas The pandas library has regex built in and it’s pretty neat! Behold the power of pandas and a regular expression to do trivial telephone tidying: […]

Blog at WordPress.com.
  • Follow Following
    • PyMarketer
    • Join 84 other followers
    • Already have a WordPress.com account? Log in now.
    • PyMarketer
    • Customize
    • Follow Following
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar