pandas.Series.str - Vectorized string function

Pandas Series and Index are equipped with a set of string processing methods that make it easy to operate on each element of the array. We will deal with couple of examples.

Lets say, we create a Series of STD codes and city names separated by '#'

import pandas as pd

stdcodes = pd.Series(['11#delhi', '22#mumbai', '33#kolkatta', '44#chennai', '40#hyderabad'])

print(stdcodes)
No alt text provided for this image




Hack#1 : Lets split the elements of series and extract std and city

No alt text provided for this image

Hack#2: Another Quick hack to split elements of a series & create dataframe in one go

No alt text provided for this image

Hack#3: in a Profit field, amounts are having dollar , commas, these need to be replaced so arithmetic operations can be performed

No alt text provided for this image

Hack#4: Super cool hack to extract birthdays of super heroes

No alt text provided for this image
No alt text provided for this image

?

Gbolahan Fatoyinbo

Telco Mobile Core (3G/4G/5GC&IMS) Specialist | Cloud & Virtualization Expert| Data Analyst | MVNO expert

1 年

Good, many thanks for this. ??

回复

要查看或添加评论,请登录

Shekhar Pandey的更多文章

  • CloudSql

    CloudSql

    Google Cloud SQL Let's start with basic question as why would anyone should use a google cloud service for SQL when you…

  • GCP: Identity and Access Management

    GCP: Identity and Access Management

    Identity and Access Management (IAM) lets administrators authorize who can take action on specific resources. An IAM…

  • Concept of Regional, Zonal resources in GCP

    Concept of Regional, Zonal resources in GCP

    Regions: Regions are independent geographic areas that consist of zones. Zones: A zone is a deployment area for Google…

  • Cloud Computing - key characterstics

    Cloud Computing - key characterstics

    5 fundamental attributes of Cloud Computing: On-demand: Customers get computing resources on-demand and self-service…

  • GCP Storage

    GCP Storage

    Google Cloud Platform (GCP) offers various storage options. The main storage options are : Google Cloud Storage, Google…

  • Learn Numpy, Pandas

    Learn Numpy, Pandas

    Numpy: https://github.com/shekhar270779/Learn_Numpy Pandas Series and DataFrame: https://github.

    1 条评论
  • Principal Component Analysis - PCA

    Principal Component Analysis - PCA

    Dimensionality reduction for visualization: Often we deal with a high dimensionality dataset, and there arises a need…

  • Slice and Dice

    Slice and Dice

    In data analysis, the term generally implies a systematic method of reducing a complete set of data into smaller parts…

  • Python Evironment

    Python Evironment

    A python environment allows to install libraries and dependencies of different versions in different environments. It…

  • pip vs venv vs conda

    pip vs venv vs conda

    Often there is a confusion as which command to use for new package installation , environment set up in (core) python ,…

社区洞察

其他会员也浏览了