How to get array after adding a number to specific data of that array?
<pre><code>import numpy as np 
import xlrd
import xlwt

wb = xlrd.open_workbook('Scatter plot.xlsx')
workbook = xlwt.Workbook() 

sheet = workbook.add_sheet("Sheet1")

sh1 = wb.sheet_by_name('T180')
sh2=wb.sheet_by_name("T181")

x= np.array([sh1.col_values(1, start_rowx=51, end_rowx=315)])
y= np.array([sh1.col_values(2, start_rowx=51, end_rowx=315)])

x1= np.array([sh2.col_values(1, start_rowx=50, end_rowx=298)])
y1= np.array([sh2.col_values(2, start_rowx=50, end_rowx=298)])

condition = [(x1&lt;=1000) &amp; (x1&gt;=0) ]
condition1 = [(y1&lt;=1000) &amp; (y1&gt;=0) ]

x_prime=x1[condition]-150
y_prime= y[condition1]+20

plt.plot(x,y, "ro", label="T180")
plt.plot(x_prime,y_prime,"gs")
plt.show()
</code></pre>

<p>I want to subtract 150 from the values less than 1000 of x1 array and finally I need all values (subtracted+remaining). But with this code I got only the values that are less than 1000. But I need both (less than 1000+ greater than 1000). But greater than 1000 values will be unchanged. How can I will do this. As you can see there 248 elements in x1 array so after subtraction I will need 248 element as <strong>x_prime</strong>. Same as for y. Thanks in advance for your kind co-operation. </p>

<p>Here is a Pandas solution:</p>

<pre><code>import matplotlib
import matplotlib.pyplot as plt
import pandas as pd

matplotlib.style.use('ggplot')

fn = r'/path/to/ExcelFile.xlsx'
sheetname = 'T181'
df = pd.read_excel(fn, sheetname=sheetname, skiprows=47, parse_cols='B:C').dropna(how='any')

# customize X-values
df.ix[df.eval('0 &lt;= GrvX &lt;= 1000'), 'GrvX'] -= 150
df.ix[df.eval('2500 &lt; GrvX &lt;= 3000'), 'GrvX'] += 50
df.ix[df.eval('3000 &lt; GrvX'), 'GrvX'] += 30

# customize Y-values
df.ix[df.eval('0 &lt;= GrvY &lt;= 1000'), 'GrvX'] += 20

df.plot.scatter(x='GrvX', y='GrvY', marker='s', s=30, label=sheetname, figsize=(14,12))

plt.show()
</code></pre>

<p><a href="http://i.stack.imgur.com/YnEbM.png" rel="nofollow"><img src="http://i.stack.imgur.com/YnEbM.png" alt="enter image description here"></a></p>

python arrays subtraction