Python - Data Manipulation Scenarios and Questions

Python Data ManipulationIn this blog, we have listed a few data manipulation scenarios or examples from data science projects. These examples can propel your Python learning for Data Science.

Data Manipulation is one of the significant activity of any Data Science or Predictive Modeling project.   If you have any scenarios or examples, do share with us and other users.

Data Manipulations using Python

Scenario 1:  I have a "list" object and values of the list is City and Country separated by a comma. Want to split each of the elements into two values so that we can have city and country separately.

Scenario 2:  Similar to scenario 1, but have a column in a data frame which takes values as City and Country separated by a comma. Want to split the column into two columns each for city and country .

Scenario 3: I have a list with each element of list has textual value with embedded blank space and multiple lines. I want to remove the multiple lines.

Example Values:

Scenario 4: While web scraping, we have 2 ResultSet objects and we want to append these in python.

Scenario 5: I have extracted text after web scraping and the last element of the list is garbage value. How do you get size of a list in Python? How you remove the last element of a list in a Python?

Scenario 6: In my list some of the elements are not proper and I found a pattern in those values. I want to remove all those elements. First we want to find indexes and then remove those elements. So remove element with a value and more generic containing a string value.

 

 

2 thoughts on “Python - Data Manipulation Scenarios and Questions

  1. Python is a very useful language to get started with learning Data Science. Articles such as these provide a lot of useful knowledge and information which will help Data Science Aspirants. Thanks for sharing!

Leave a Comment