Pandas Dataframe add rows on top of dataframe - pandas

I am trying to add blank rows on top of the pandas Dataframe data.
Basically, some blank rows and some calculation for each row which contains calculations for Average etc. for that column. Can someone please help me how I can do this?
From:
A B D E F G H I J
0 -8 10 532 533 533 532 534 532 532
1 -8 12 520 521 523 523 521 521 521
2 -8 14 520 523 522 523 522 521 522
3 -4 2 526 527 527 528 528 527 529
4 -4 4 516 518 517 519 518 516 518
5 -4 6 528 529 530 531 530 528 530
6 -4 8 518 521 521 521 522 519 521
7 -4 10 524 525 525 525 525 524 524
8 -4 12 522 523 524 525 525 522 523
9 -2 2 525 526 527 527 527 525 527
10 -2 4 518 519 519 521 520 519 520
11 -2 6 520 522 522 522 522 520 523
12 -2 8 551 551 552 552 552 550 552
13 -2 10 533 534 535 536 535 534 535
14 -2 12 537 539 539 539 538 537 539
15 -2 14 528 530 530 531 530 529 530
16 -1 2 518 519 519 521 520 518 520
To:
A B D E F G H I J
Average 525.6 527.1 527.4 528.0 527.6 526.0 527.4
Sigma 8.6 8.3 8.5 8.1 8.3 8.3 8.4
Minimum 516 518 517 519 518 516 518
Maximum 551 551 552 552 552 550 552
0 -8 10 532 533 533 532 534 532 532
1 -8 12 520 521 523 523 521 521 521
2 -8 14 520 523 522 523 522 521 522
3 -4 2 526 527 527 528 528 527 529
4 -4 4 516 518 517 519 518 516 518
5 -4 6 528 529 530 531 530 528 530
6 -4 8 518 521 521 521 522 519 521
7 -4 10 524 525 525 525 525 524 524
8 -4 12 522 523 524 525 525 522 523
9 -2 2 525 526 527 527 527 525 527
10 -2 4 518 519 519 521 520 519 520
11 -2 6 520 522 522 522 522 520 523
12 -2 8 551 551 552 552 552 550 552
13 -2 10 533 534 535 536 535 534 535
14 -2 12 537 539 539 539 538 537 539
15 -2 14 528 530 530 531 530 529 530
16 -1 2 518 519 519 521 520 518 520

I'd be sure that this is actually what you want to do, storing both data and summary statistics in the same frame is a little odd. That said, you can use concat to stack dataframes.
In [23]: pd.concat([df.describe(), df])
Out[23]:
A B D E F G ...
count 17.000000 17.0000 17.000000 17.000000 17.000000 17.000000
mean -3.705882 8.0000 525.647059 527.058824 527.352941 528.000000
std 2.284861 4.1833 8.866659 8.518147 8.760288 8.396428
min -8.000000 2.0000 516.000000 518.000000 517.000000 519.000000
25% -4.000000 4.0000 520.000000 521.000000 522.000000 522.000000
50% -4.000000 8.0000 524.000000 525.000000 525.000000 525.000000
75% -2.000000 12.0000 528.000000 530.000000 530.000000 531.000000
max -1.000000 14.0000 551.000000 551.000000 552.000000 552.000000
0 -8.000000 10.0000 532.000000 533.000000 533.000000 532.000000
1 -8.000000 12.0000 520.000000 521.000000 523.000000 523.000000
2 -8.000000 14.0000 520.000000 523.000000 522.000000 523.000000
...

Related

How to make all the rows data drop the similar data and multiplying float numbers

How to separate all of the columns?
df= df[['hlogUs_dB','hlogDs_dB']]
df
hlogUs_dB hlogDs_dB
0 109:-3.4,110:-3.4,111:-3.4,112:-3.5,113:-3.5,1... 5:-2.5,6:-2.5,7:-2.1,8:-2.0,9:-2.0,10:-2.0,11:...
1 109:-3.5,110:-3.5,111:-3.4,112:-3.4,113:-3.4,1... 5:-2.1,6:-2.0,7:-1.8,8:-1.8,9:-1.8,10:-1.8,11:...
2 109:-3.7,110:-3.7,111:-3.8,112:-3.8,113:-3.8,1... 5:-2.1,6:-2.0,7:-1.8,8:-1.8,9:-1.8,10:-1.8,11:...
3 109:-3.5,110:-3.6,111:-3.6,112:-3.6,113:-3.7,1... 5:-2.5,6:-2.5,7:-2.1,8:-2.0,9:-2.0,10:-2.0,11:...
4 109:-3.7,110:-3.8,111:-3.8,112:-3.8,113:-3.8,1... 5:-2.5,6:-2.5,7:-2.1,8:-2.1,9:-2.0,10:-2.1,11:...
... ... ...
165 109:-5.2,110:-5.3,111:-5.5,112:-5.7,113:-5.9,1... 5:-2.5,6:-2.5,7:-2.1,8:-2.1,9:-2.1,10:-2.2,11:...
166 109:-5.5,110:-5.6,111:-5.8,112:-6.1,113:-6.3,1... 5:-2.8,6:-2.7,7:-2.5,8:-2.5,9:-2.3,10:-2.5,11:...
167 109:-6.0,110:-6.2,111:-6.4,112:-6.7,113:-7.1,1... 5:-2.6,6:-2.5,7:-2.2,8:-2.2,9:-2.2,10:-2.3,11:...
168 109:-5.4,110:-5.5,111:-5.7,112:-5.9,113:-6.2,1... 5:-3.0,6:-3.0,7:-2.6,8:-2.5,9:-2.5,10:-2.5,11:...
169 109:-5.9,110:-6.1,111:-6.4,112:-6.6,113:-7.0,1... 5:-2.7,6:-2.5,7:-2.3,8:-2.2,9:-2.3,10:-2.3,11:...
170 rows × 2 columns
<After that I split using delimiter for only hlogUs_dB/>
df2 =df['hlogUs_dB'].str.split('[,:]',expand = True)
df2 = data.drop(["0"])
df2
The result :
0 1 2 3 4 5 6 7 8 9 ... 276 277 278 279 280 281 282 283 284 285
0 109 -3.4 110 -3.4 111 -3.4 112 -3.5 113 -3.5 ... 343 -4.3 344 -4.3 345 -4.2 346 -4.2 347 -4.2
1 109 -3.5 110 -3.5 111 -3.4 112 -3.4 113 -3.4 ... 343 -4.1 344 -4.2 345 -4.4 346 -4.4 347 -4.2
2 109 -3.7 110 -3.7 111 -3.8 112 -3.8 113 -3.8 ... 343 -4.2 344 -4.3 345 -4.3 346 -4.3 347 -4.3
3 109 -3.5 110 -3.6 111 -3.6 112 -3.6 113 -3.7 ... 343 -4.1 344 -4.1 345 -4.1 346 -4.1 347 -4.1
4 109 -3.7 110 -3.8 111 -3.8 112 -3.8 113 -3.8 ... 343 -4.2 344 -4.2 345 -4.2 346 -4.2 347 -4.3
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
165 109 -5.2 110 -5.3 111 -5.5 112 -5.7 113 -5.9 ... 343 -5.4 344 -5.3 345 -5.2 346 -5.1 347 -5.1
166 109 -5.5 110 -5.6 111 -5.8 112 -6.1 113 -6.3 ... 343 -5.5 344 -5.4 345 -5.3 346 -5.2 347 -5.2
167 109 -6.0 110 -6.2 111 -6.4 112 -6.7 113 -7.1 ... 343 -4.9 344 -4.9 345 -4.9 346 -4.9 347 -4.9
168 109 -5.4 110 -5.5 111 -5.7 112 -5.9 113 -6.2 ... 343 -5.9 344 -5.7 345 -5.7 346 -5.6 347 -5.6
169 109 -5.9 110 -6.1 111 -6.4 112 -6.6 113 -7.0 ... 343 -5.7 344 -5.7 345 -5.7 346 -5.6 347 -5.6
170 rows × 286 columns
After that I want to drop the same number that appear only on even columns. I manage to found the solutions but somehow or rather, it does not suit my preference.
df2.drop(columns=[0,2,4,6,8,9,10,12,14,16,18,20,22,24,26,28,30,32,34,36])
df2
the output:
0 1 2 3 4 5 6 7 8 9 ... 276 277 278 279 280 281 282 283 284 285
0 109 -3.4 110 -3.4 111 -3.4 112 -3.5 113 -3.5 ... 343 -4.3 344 -4.3 345 -4.2 346 -4.2 347 -4.2
1 109 -3.5 110 -3.5 111 -3.4 112 -3.4 113 -3.4 ... 343 -4.1 344 -4.2 345 -4.4 346 -4.4 347 -4.2
2 109 -3.7 110 -3.7 111 -3.8 112 -3.8 113 -3.8 ... 343 -4.2 344 -4.3 345 -4.3 346 -4.3 347 -4.3
3 109 -3.5 110 -3.6 111 -3.6 112 -3.6 113 -3.7 ... 343 -4.1 344 -4.1 345 -4.1 346 -4.1 347 -4.1
4 109 -3.7 110 -3.8 111 -3.8 112 -3.8 113 -3.8 ... 343 -4.2 344 -4.2 345 -4.2 346 -4.2 347 -4.3
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
165 109 -5.2 110 -5.3 111 -5.5 112 -5.7 113 -5.9 ... 343 -5.4 344 -5.3 345 -5.2 346 -5.1 347 -5.1
166 109 -5.5 110 -5.6 111 -5.8 112 -6.1 113 -6.3 ... 343 -5.5 344 -5.4 345 -5.3 346 -5.2 347 -5.2
167 109 -6.0 110 -6.2 111 -6.4 112 -6.7 113 -7.1 ... 343 -4.9 344 -4.9 345 -4.9 346 -4.9 347 -4.9
168 109 -5.4 110 -5.5 111 -5.7 112 -5.9 113 -6.2 ... 343 -5.9 344 -5.7 345 -5.7 346 -5.6 347 -5.6
169 109 -5.9 110 -6.1 111 -6.4 112 -6.6 113 -7.0 ... 343 -5.7 344 -5.7 345 -5.7 346 -5.6 347 -5.6
170 rows × 286 columns
still show the same as before, I just want the odd columns to be multiply with 8 and float 4.3125. Then later the data will replace on the same columns, that was my roughly ideas.
df2*4.3125
the results contain error.
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
~\anaconda3\lib\site-packages\pandas\core\ops\array_ops.py in na_arithmetic_op(left, right, op, str_rep)
148 try:
--> 149 result = expressions.evaluate(op, str_rep, left, right)
150 except TypeError:
~\anaconda3\lib\site-packages\pandas\core\computation\expressions.py in evaluate(op, op_str, a, b, use_numexpr)
207 if use_numexpr:
--> 208 return _evaluate(op, op_str, a, b)
209 return _evaluate_standard(op, op_str, a, b)
~\anaconda3\lib\site-packages\pandas\core\computation\expressions.py in _evaluate_numexpr(op, op_str, a, b)
120 if result is None:
--> 121 result = _evaluate_standard(op, op_str, a, b)
122
~\anaconda3\lib\site-packages\pandas\core\computation\expressions.py in _evaluate_standard(op, op_str, a, b)
69 with np.errstate(all="ignore"):
---> 70 return op(a, b)
71
TypeError: can't multiply sequence by non-int of type 'float'
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
<ipython-input-24-424060d3aad6> in <module>
----> 1 df2*4.3125
~\anaconda3\lib\site-packages\pandas\core\ops\__init__.py in f(self, other, axis, level, fill_value)
717 self = self.fillna(fill_value)
718
--> 719 new_data = dispatch_to_series(self, other, op, str_rep)
720 return self._construct_result(new_data)
721
~\anaconda3\lib\site-packages\pandas\core\ops\__init__.py in dispatch_to_series(left, right, func, str_rep, axis)
376 # Get the appropriate array-op to apply to each block's values.
377 array_op = get_array_op(func, str_rep=str_rep)
--> 378 bm = left._data.apply(array_op, right=right)
379 return type(left)(bm)
380
~\anaconda3\lib\site-packages\pandas\core\internals\managers.py in apply(self, f, filter, **kwargs)
438
439 if callable(f):
--> 440 applied = b.apply(f, **kwargs)
441 else:
442 applied = getattr(b, f)(**kwargs)
~\anaconda3\lib\site-packages\pandas\core\internals\blocks.py in apply(self, func, **kwargs)
388 """
389 with np.errstate(all="ignore"):
--> 390 result = func(self.values, **kwargs)
391
392 if is_extension_array_dtype(result) and result.ndim > 1:
~\anaconda3\lib\site-packages\pandas\core\ops\array_ops.py in arithmetic_op(left, right, op, str_rep)
195 else:
196 with np.errstate(all="ignore"):
--> 197 res_values = na_arithmetic_op(lvalues, rvalues, op, str_rep)
198
199 return res_values
~\anaconda3\lib\site-packages\pandas\core\ops\array_ops.py in na_arithmetic_op(left, right, op, str_rep)
149 result = expressions.evaluate(op, str_rep, left, right)
150 except TypeError:
--> 151 result = masked_arith_op(left, right, op)
152
153 return missing.dispatch_fill_zeros(op, left, right, result)
~\anaconda3\lib\site-packages\pandas\core\ops\array_ops.py in masked_arith_op(x, y, op)
110 if mask.any():
111 with np.errstate(all="ignore"):
--> 112 result[mask] = op(xrav[mask], y)
113
114 result, _ = maybe_upcast_putmask(result, ~mask, np.nan)
TypeError: can't multiply sequence by non-int of type 'float'
I am stuck at the area and have searched on the Stack Overflow, youtube about the basic for multiplying in terms of float but, I think my keywords is not on par with the ideas.

Sorting a string of numbers into a grid

I'm needing to sort a long list of ID numbers into 'grids' of 8 ID numbers down (8 cells/rows), 6 ID numbers across (or 6 columns long etc), sorted from smallest to largest ID number. When one 'grid' is 'full', the numbers which cannot fit in the first grid should go on to form a second one and so on. The last 4 cells of the last row should be blank. (This is a template for a lab procedure).
ie this is the data I have:
column of ID numbers
and this how I want it to be (but like, 6 of these)
example 'grid'
Here's one method.
Sample data
import pandas as pd
import numpy as np
# Sorted list of string IDs
l = np.arange(0, 631, 1).astype('str')
Code
N = 44
# Ensure we can reshape last group
data = np.concatenate((l, np.repeat('', N-len(l)%N)))
# Split array, make a separate `DataFrame` for each grid.
data = [
pd.DataFrame(np.concatenate((x, np.repeat('', 4))).reshape(8,6))
for x in np.array_split(data, np.arange(N, len(l), N))
]
df = pd.concat(data, ignore_index=True) # If want a single df in the end
Output df:
0 1 2 3 4 5
0 0 1 2 3 4 5
1 6 7 8 9 10 11
2 12 13 14 15 16 17
3 18 19 20 21 22 23
4 24 25 26 27 28 29
5 30 31 32 33 34 35
6 36 37 38 39 40 41
7 42 43
8 44 45 46 47 48 49
9 50 51 52 53 54 55
10 56 57 58 59 60 61
11 62 63 64 65 66 67
12 68 69 70 71 72 73
13 74 75 76 77 78 79
14 80 81 82 83 84 85
15 86 87
16 88 89 90 91 92 93
...
110 608 609 610 611 612 613
111 614 615
112 616 617 618 619 620 621
113 622 623 624 625 626 627
114 628 629 630
115
116
117
118
119
func = lambda lst,n: np.pad(lst, (0,n*(1+len(lst)//n) - len(lst)), 'constant')
rows, cols = 8, 6
arr = np.arange(1, 283, 1) ##np.array(df.A)
new_df = pd.DataFrame(func(arr, rows*cols).reshape(-1,cols))
new_df
0 1 2 3 4 5
0 1 2 3 4 5 6
1 7 8 9 10 11 12
2 13 14 15 16 17 18
3 19 20 21 22 23 24
4 25 26 27 28 29 30
5 31 32 33 34 35 36
6 37 38 39 40 41 42
7 43 44 45 46 47 48
8 49 50 51 52 53 54
9 55 56 57 58 59 60
10 61 62 63 64 65 66
11 67 68 69 70 71 72
12 73 74 75 76 77 78
13 79 80 81 82 83 84
14 85 86 87 88 89 90
15 91 92 93 94 95 96
16 97 98 99 100 101 102
17 103 104 105 106 107 108
18 109 110 111 112 113 114
19 115 116 117 118 119 120
20 121 122 123 124 125 126
21 127 128 129 130 131 132
22 133 134 135 136 137 138
23 139 140 141 142 143 144
24 145 146 147 148 149 150
25 151 152 153 154 155 156
26 157 158 159 160 161 162
27 163 164 165 166 167 168
28 169 170 171 172 173 174
29 175 176 177 178 179 180
30 181 182 183 184 185 186
31 187 188 189 190 191 192
32 193 194 195 196 197 198
33 199 200 201 202 203 204
34 205 206 207 208 209 210
35 211 212 213 214 215 216
36 217 218 219 220 221 222
37 223 224 225 226 227 228
38 229 230 231 232 233 234
39 235 236 237 238 239 240
40 241 242 243 244 245 246
41 247 248 249 250 251 252
42 253 254 255 256 257 258
43 259 260 261 262 263 264
44 265 266 267 268 269 270
45 271 272 273 274 275 276
46 277 278 279 280 281 282
47 0 0 0 0 0 0
I think it's better to save this dataframe into an excel worksheet and then remove the last padded zeros manually. Hope this helped

Oracle SQL Flight Database - Find flight from A to B with stopover?

I have a flight Database with the following table:
FID from fto dep arrive days flightno
---- ----- --- ---- ------ ---- --------
167 MPB KYM 1020 1040 0 EA5203
168 MPB KYM 1510 1530 0 EA5205
169 MPB KYM 1705 1725 0 EA5207
221 NEB KYM 850 1025 0 EA782
222 NEB KYM 1355 1530 0 EA784
223 NEB KYM 1810 1945 0 EA786
557 BAH NEB 1305 1500 0 EA686
558 BAH ELM 605 715 0 EA162
559 BAH ELM 1005 1115 0 EA340
560 BAH ELM 1230 1340 0 EA872
561 BAH ELM 1325 1435 0 EA442
562 BAH ELM 1400 1510 0 EA872
563 BAH ELM 1455 1605 0 EA978
564 BAH ELM 1640 1750 0 EA640
565 BAH ELM 2025 2135 0 EA940
566 BAH YDS 645 845 0 EA992
567 BAH YDS 945 1130 0 EA974
1163 PPP KYM 1040 1110 0 EA3201
1164 PPP KYM 1450 1520 0 EA3207
1190 OKR KYM 825 920 0 EA3200
1191 OKR KYM 1010 1100 0 EA3204
1192 OKR KYM 1500 1605 0 EA3214
1517 SVT KYM 810 920 0 EA3201
1518 SVT KYM 940 1050 0 EA3201
1519 SVT KYM 1215 1310 0 EA3211
1520 SVT KYM 1510 1605 0 EA3211
How do I query it to show indirect flights from BAH to KYM?
I've tried a number of ways to no avail. Any help is greatly appreciated.
select CONNECT_BY_ROOT ffrom ||SYS_CONNECT_BY_PATH(fto, '/') path_ ,level,ffrom,fto
from FLIGHTS_TABLE
where level > 1
start with ffrom='BAH' CONNECT BY PRIOR fto =ffrom ORDER SIBLINGS By ffrom ;
It retuns :
PATH_ |LEVEL| FFROM | FTO
BAH/NEB/KYM | 2 | NEB | KYM
BAH/NEB/KYM | 2 | NEB | KYM
BAH/NEB/KYM | 2 | NEB | KYM
It returns 3 rows because of there are 3 row/flight from 'NEB' to 'KYM'. I don't know which flight is indirect flight.

how to add repitition index and unstack in pandas?

dataframe as follows:
time a b c d e
2006/1/16 249 249 250 250 251
2006/2/15 254 253 255 255 255
2006/3/16 261 261 262 262 264
2006/4/16 272 271 273 273 274
2006/5/16 282 281 283 283 283
2006/6/16 288 287 289 289 289
2006/7/16 292 292 293 293 293
2006/8/16 290 290 291 291 292
2006/9/16 282 281 283 283 284
2006/10/16 271 270 272 272 273
2006/11/16 259 258 260 260 261
2006/12/16 251 251 252 252 253
2007/1/16 247 247 247 248 250
2007/2/15 253 253 254 254 255
2007/3/16 261 261 262 262 264
2007/4/16 273 272 274 274 275
2007/5/16 282 281 283 283 283
2007/6/16 288 288 290 289 290
2007/7/16 292 292 293 293 294
2007/8/16 291 290 291 291 292
2007/9/16 282 282 283 283 284
2007/10/16 271 270 272 272 273
2007/11/16 260 259 261 261 262
I want to unstack as
a 1 2 3 4 5 6 7 8 9 10 11 12
2006 .......................................
2007 .......................................
b 2006 .......................................
2007 .......................................
.......................................
c 2006
d ...............................................
e 2007 .......................................
pandas timestamps cound be apply on it? And how to generate year and month index if there is no time columns.
year month
2006 1
2006 2
... ..
2006 12
2007 1
2007 2
... ...
2007 12
I'd construct a new pd.Series from numpy arrays and unstack
df.time = pd.to_datetime(df.time)
cols = list('abcde')
n, m = len(df), len(cols)
v = np.concatenate([df[c].values for c in cols])
i = np.repeat(cols, n)
y = np.tile(df.time.dt.year.values, m)
m = np.tile(df.time.dt.month.values, m)
pd.Series(v, pd.MultiIndex.from_arrays([i, y, m])).unstack(fill_value=0)
1 2 3 4 5 6 7 8 9 10 11 12
a 2006 249 254 261 272 282 288 292 290 282 271 259 251
2007 247 253 261 273 282 288 292 291 282 271 260 0
b 2006 249 253 261 271 281 287 292 290 281 270 258 251
2007 247 253 261 272 281 288 292 290 282 270 259 0
c 2006 250 255 262 273 283 289 293 291 283 272 260 252
2007 247 254 262 274 283 290 293 291 283 272 261 0
d 2006 250 255 262 273 283 289 293 291 283 272 260 252
2007 248 254 262 274 283 289 293 291 283 272 261 0
e 2006 251 255 264 274 283 289 293 292 284 273 261 253
2007 250 255 264 275 283 290 294 292 284 273 262 0
Use to_datetime first, then create MultiIndex.from_arrays with year and
month and assign to index. Then remove column time and unstack, last transpose by T:
df['time'] = pd.to_datetime(df['time'])
df.index = pd.MultiIndex.from_arrays([df['time'].dt.month, df['time'].dt.year],
names=(None, None))
df = df.drop('time', axis=1).unstack(fill_value=0).T
print (df)
1 2 3 4 5 6 7 8 9 10 11 12
a 2006 249 254 261 272 282 288 292 290 282 271 259 251
2007 247 253 261 273 282 288 292 291 282 271 260 0
b 2006 249 253 261 271 281 287 292 290 281 270 258 251
2007 247 253 261 272 281 288 292 290 282 270 259 0
c 2006 250 255 262 273 283 289 293 291 283 272 260 252
2007 247 254 262 274 283 290 293 291 283 272 261 0
d 2006 250 255 262 273 283 289 293 291 283 272 260 252
2007 248 254 262 274 283 289 293 291 283 272 261 0
e 2006 251 255 264 274 283 289 293 292 284 273 261 253
2007 250 255 264 275 283 290 294 292 284 273 262 0

How to encode a text file using ASMO449+? .NET

Dear All, How I can encode a text file to ASMO449+?
Thanks
That's code page 709. Difficult, .NET doesn't support it. Best thing to do is to using code page 1256, the Windows code page for Arabic, then translate the bytes using this conversion table (also available as a webpage):
/*000-015*/ 000 001 249 003 004 005 006 007 008 009 010 011 012 013 014 015
/*016-031*/ 016 017 018 019 022 023 024 025 026 027 028 029 030 031 254 255
/*032-047*/ 032 033 034 035 036 037 038 039 040 041 042 043 044 045 046 047
/*048-063*/ 048 049 050 051 052 053 054 055 056 057 058 059 060 061 062 063
/*064-079*/ 064 065 066 067 068 069 070 071 072 073 074 075 076 077 078 079
/*080-095*/ 080 081 082 083 084 085 086 087 088 089 090 091 092 093 094 095
/*096-111*/ 096 097 098 099 100 101 102 103 104 105 106 107 108 109 110 111
/*112-127*/ 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
/*128-143*/ 128 132 174 159 134 141 142 143 144 145 146 190 148 149 155 156
/*144-159*/ 157 158 160 161 162 002 163 224 164 165 166 188 167 252 168 169
/*160-175*/ 171 172 154 176 177 178 179 021 180 181 182 183 184 173 185 186
/*176-191*/ 189 192 220 221 222 223 020 250 153 243 187 244 245 246 247 191
/*192-207*/ 248 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
/*208-223*/ 208 209 210 211 212 213 214 170 215 216 217 218 219 225 226 227
/*224-239*/ 133 228 131 229 230 231 232 135 138 130 136 137 233 234 140 139
/*240-255*/ 235 236 237 238 147 239 240 175 241 151 242 150 129 251 152 253
var enc = Encoding.GetEncoding(1256);
var ara = "العربية";
var res = enc.GetBytes(ara);
// TODO: apply table
//...