Yes you can,
This should help – let me know if you have any questions
def printAxes(ws):
'''print out the current axes'''
for i in range(ws.axes()):
ax = ws.getAxis(i)
axUnit = ax.getUnit()
print i, axUnit.caption(), axUnit.symbol()
yUnit = ws.YUnit()
print "Y axis:", ws.YUnit(), ws.YUnitLabel()
dataX = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]
dataY = [1,2,3,4,5,6,7,8,9,10,11,12]
dataE = [1,2,3,4,5,6,7,8,9,10,11,12]
# The workspace will be named "dataWS"
dataWS = CreateWorkspace(DataX=dataX, DataY=dataY, DataE=dataE, NSpec=4,UnitX="Wavelength")
# or get an existing workspace from Mantid
#dataWS = mtd["Name of workspace"]
print "Before"
printAxes(dataWS)
#Setting the y unit to counts
dataWS.setYUnit("neutron")
dataWS.setYUnitLabel("counts")
# changing the X unit from wavelength to Time of Flight
# Note this just changes the labels, to change the values as well use the ConvertUnits Algorithm
dataWS.getAxis(0).setUnit("Label").setLabel("Time", "ns")
#Also change the "spectrum Axis"
dataWS.getAxis(1).setUnit("Label").setLabel("Temperature", "K")
print
print "After"
printAxes(dataWS)