Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

pandas add two string columns

# if both columns are strings, you can concatenate them directly
df["period"] = df["Year"] + df["quarter"]

# If one (or both) of the columns are not string typed, you should convert it 
# (them) first,
df["period"] = df["Year"].astype(str) + df["quarter"]
Comment

pandas dataframe add two columns int and string

df = df['Day'].map(str) + '-' + df['Month'].map(str) + '-' + df['Year'].map(str)
Comment

pandas dataframe add two columns int and string

df1 = df['1st Column Name'].map(str) + df['2nd Column Name'].map(str) + ...
Comment

PREVIOUS NEXT
Code Example
Python :: python csv 
Python :: charcodeat python 
Python :: python get number of days 
Python :: python pil to greyscale 
Python :: python trie 
Python :: python remove form list 
Python :: Write a python program to find the most frequent word in text file 
Python :: python check folder 
Python :: pandas reorder columns by name 
Python :: django rest 
Python :: equal sides of an array python 
Python :: python transpose list of lists 
Python :: input array of string in python 
Python :: python set negative infinity 
Python :: pandas check if value in column is in a list 
Python :: pdf to text python 
Python :: noninspection access to protected member 
Python :: Math Module log() Function in python 
Python :: python string replace index 
Python :: django update model 
Python :: pandas groupby percentile 
Python :: check python version kali linux 
Python :: wolfram alpha python module 
Python :: python while not 
Python :: frequency spectrum signal python 
Python :: create fixtures django 
Python :: python get os 
Python :: remove columns from a dataframe python 
Python :: how to return an html file in flask 
Python :: python calculate angle between two points 
ADD CONTENT
Topic
Content
Source link
Name
4+3 =