Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python merge strings in columns

df["period"] = df["Year"].astype(str) + df["quarter"]
Comment

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

PREVIOUS NEXT
Code Example
Python :: convert python pandas series dtype to datetime 
Python :: python load pandas from pickle 
Python :: linux uninstall python 
Python :: convert int to byte python 
Python :: how to find the neighbors of an element in matrix python 
Python :: get object attributes python 
Python :: pandas read csv parse_dates 
Python :: python paramiko check ssh connection 
Python :: seaborn styles 
Python :: ros python publisher 
Python :: pandas lambda if else 
Python :: python connect sftp with key 
Python :: close selenium webdriver python 
Python :: python moving average of list 
Python :: pandas show all dataframe 
Python :: python mouse click 
Python :: wxpython change window size 
Python :: python blackjack 
Python :: change column name df 
Python :: Square of numbers in non-decreasing order 
Python :: pages.User Settings.user: (fields.W342) Setting unique=True on a Foreign Key 
Python :: remove every file that ends with extension in python 
Python :: python join list with comma 
Python :: start the environment 
Python :: install decouple python 
Python :: print('Test set predictions: {}'.format(y_pred)) 
Python :: python list comprehension index, value 
Python :: create zero array in python 
Python :: pandas split train test 
Python :: convert from object to integer python 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =