Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using pandas library
#6
Did figure out something that does not use numpy.
import pandas as pd
 
numbers = pd.DataFrame([[3],[8],[4],[9],[14],[17]], columns=['Numbers'])
numbers['Odd/Even'] = numbers['Numbers'].map(lambda x : x%2)
numbers
Output:
Numbers Odd/Even 0 3 1 1 8 0 2 4 0 3 9 1 4 14 0 5 17 1
Reply


Messages In This Thread
Using pandas library - by ramitaherwahdan1978 - Oct-25-2020, 06:21 AM
RE: Using pandas library - by bowlofred - Oct-25-2020, 07:27 AM
RE: Using pandas library - by snippsat - Oct-25-2020, 09:52 AM
RE: Using pandas library - by ramitaherwahdan1978 - Oct-25-2020, 12:32 PM
RE: Using pandas library - by jefsummers - Oct-25-2020, 01:18 PM
RE: Using pandas library - by jefsummers - Oct-25-2020, 01:46 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Better python library to create ER Diagram by using pandas data frames as tables klllmmm 0 1,414 Oct-19-2023, 01:01 PM
Last Post: klllmmm
  Questions regarding usage of pandas library Pala 5 1,247 Apr-26-2023, 10:21 PM
Last Post: deanhystad
  PyInstaller, how to create library folder instead of library.zip file ? harun2525 2 4,986 May-06-2017, 11:29 AM
Last Post: harun2525

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020