In [1]:
import pandas as pd
In [3]:
pd.get_option('max_rows')
Out[3]:
60
In [4]:
df = pd.read_csv('city.csv', sep=';')
df
Out[4]:
ID Name CountryCode District Population
0 1 Kabul AFG Kabol 1780000
1 2 Qandahar AFG Qandahar 237500
2 3 Herat AFG Herat 186800
3 4 Mazar-e-Sharif AFG Balkh 127800
4 5 Amsterdam NLD Noord-Holland 731200
... ... ... ... ... ...
4074 4075 Khan Yunis PSE Khan Yunis 123175
4075 4076 Hebron PSE Hebron 119401
4076 4077 Jabaliya PSE North Gaza 113901
4077 4078 Nablus PSE Nablus 100231
4078 4079 Rafah PSE Rafah 92020

4079 rows × 5 columns

In [9]:
pd.set_option('max_rows', 100)
In [13]:
df.head(100)
Out[13]:
ID Name CountryCode District Population
0 1 Kabul AFG Kabol 1780000
1 2 Qandahar AFG Qandahar 237500
2 3 Herat AFG Herat 186800
3 4 Mazar-e-Sharif AFG Balkh 127800
4 5 Amsterdam NLD Noord-Holland 731200
5 6 Rotterdam NLD Zuid-Holland 593321
6 7 Haag NLD Zuid-Holland 440900
7 8 Utrecht NLD Utrecht 234323
8 9 Eindhoven NLD Noord-Brabant 201843
9 10 Tilburg NLD Noord-Brabant 193238
10 11 Groningen NLD Groningen 172701
11 12 Breda NLD Noord-Brabant 160398
12 13 Apeldoorn NLD Gelderland 153491
13 14 Nijmegen NLD Gelderland 152463
14 15 Enschede NLD Overijssel 149544
15 16 Haarlem NLD Noord-Holland 148772
16 17 Almere NLD Flevoland 142465
17 18 Arnhem NLD Gelderland 138020
18 19 Zaanstad NLD Noord-Holland 135621
19 20 ´s-Hertogenbosch NLD Noord-Brabant 129170
20 21 Amersfoort NLD Utrecht 126270
21 22 Maastricht NLD Limburg 122087
22 23 Dordrecht NLD Zuid-Holland 119811
23 24 Leiden NLD Zuid-Holland 117196
24 25 Haarlemmermeer NLD Noord-Holland 110722
25 26 Zoetermeer NLD Zuid-Holland 110214
26 27 Emmen NLD Drenthe 105853
27 28 Zwolle NLD Overijssel 105819
28 29 Ede NLD Gelderland 101574
29 30 Delft NLD Zuid-Holland 95268
30 31 Heerlen NLD Limburg 95052
31 32 Alkmaar NLD Noord-Holland 92713
32 33 Willemstad ANT Curaçao 2345
33 34 Tirana ALB Tirana 270000
34 35 Alger DZA Alger 2168000
35 36 Oran DZA Oran 609823
36 37 Constantine DZA Constantine 443727
37 38 Annaba DZA Annaba 222518
38 39 Batna DZA Batna 183377
39 40 Sétif DZA Sétif 179055
40 41 Sidi Bel Abbès DZA Sidi Bel Abbès 153106
41 42 Skikda DZA Skikda 128747
42 43 Biskra DZA Biskra 128281
43 44 Blida (el-Boulaida) DZA Blida 127284
44 45 Béjaïa DZA Béjaïa 117162
45 46 Mostaganem DZA Mostaganem 115212
46 47 Tébessa DZA Tébessa 112007
47 48 Tlemcen (Tilimsen) DZA Tlemcen 110242
48 49 Béchar DZA Béchar 107311
49 50 Tiaret DZA Tiaret 100118
50 51 Ech-Chleff (el-Asnam) DZA Chlef 96794
51 52 Ghardaïa DZA Ghardaïa 89415
52 53 Tafuna ASM Tutuila 5200
53 54 Fagatogo ASM Tutuila 2323
54 55 Andorra la Vella AND Andorra la Vella 21189
55 56 Luanda AGO Luanda 2022000
56 57 Huambo AGO Huambo 163100
57 58 Lobito AGO Benguela 130000
58 59 Benguela AGO Benguela 128300
59 60 Namibe AGO Namibe 118200
60 61 South Hill AIA 961
61 62 The Valley AIA 595
62 63 Saint John´s ATG St John 24000
63 64 Dubai ARE Dubai 669181
64 65 Abu Dhabi ARE Abu Dhabi 398695
65 66 Sharja ARE Sharja 320095
66 67 al-Ayn ARE Abu Dhabi 225970
67 68 Ajman ARE Ajman 114395
68 69 Buenos Aires ARG Distrito Federal 2982146
69 70 La Matanza ARG Buenos Aires 1266461
70 71 Córdoba ARG Córdoba 1157507
71 72 Rosario ARG Santa Fé 907718
72 73 Lomas de Zamora ARG Buenos Aires 622013
73 74 Quilmes ARG Buenos Aires 559249
74 75 Almirante Brown ARG Buenos Aires 538918
75 76 La Plata ARG Buenos Aires 521936
76 77 Mar del Plata ARG Buenos Aires 512880
77 78 San Miguel de Tucumán ARG Tucumán 470809
78 79 Lanús ARG Buenos Aires 469735
79 80 Merlo ARG Buenos Aires 463846
80 81 General San Martín ARG Buenos Aires 422542
81 82 Salta ARG Salta 367550
82 83 Moreno ARG Buenos Aires 356993
83 84 Santa Fé ARG Santa Fé 353063
84 85 Avellaneda ARG Buenos Aires 353046
85 86 Tres de Febrero ARG Buenos Aires 352311
86 87 Morón ARG Buenos Aires 349246
87 88 Florencio Varela ARG Buenos Aires 315432
88 89 San Isidro ARG Buenos Aires 306341
89 90 Tigre ARG Buenos Aires 296226
90 91 Malvinas Argentinas ARG Buenos Aires 290335
91 92 Vicente López ARG Buenos Aires 288341
92 93 Berazategui ARG Buenos Aires 276916
93 94 Corrientes ARG Corrientes 258103
94 95 San Miguel ARG Buenos Aires 248700
95 96 Bahía Blanca ARG Buenos Aires 239810
96 97 Esteban Echeverría ARG Buenos Aires 235760
97 98 Resistencia ARG Chaco 229212
98 99 José C. Paz ARG Buenos Aires 221754
99 100 Paraná ARG Entre Rios 207041
In [14]:
pd.get_option('min_rows')
Out[14]:
10
In [15]:
pd.set_option('min_rows', 20)
In [16]:
df
Out[16]:
ID Name CountryCode District Population
0 1 Kabul AFG Kabol 1780000
1 2 Qandahar AFG Qandahar 237500
2 3 Herat AFG Herat 186800
3 4 Mazar-e-Sharif AFG Balkh 127800
4 5 Amsterdam NLD Noord-Holland 731200
5 6 Rotterdam NLD Zuid-Holland 593321
6 7 Haag NLD Zuid-Holland 440900
7 8 Utrecht NLD Utrecht 234323
8 9 Eindhoven NLD Noord-Brabant 201843
9 10 Tilburg NLD Noord-Brabant 193238
... ... ... ... ... ...
4069 4070 Chitungwiza ZWE Harare 274912
4070 4071 Mount Darwin ZWE Harare 164362
4071 4072 Mutare ZWE Manicaland 131367
4072 4073 Gweru ZWE Midlands 128037
4073 4074 Gaza PSE Gaza 353632
4074 4075 Khan Yunis PSE Khan Yunis 123175
4075 4076 Hebron PSE Hebron 119401
4076 4077 Jabaliya PSE North Gaza 113901
4077 4078 Nablus PSE Nablus 100231
4078 4079 Rafah PSE Rafah 92020

4079 rows × 5 columns

In [18]:
pd.reset_option('min_rows')
In [19]:
df
Out[19]:
ID Name CountryCode District Population
0 1 Kabul AFG Kabol 1780000
1 2 Qandahar AFG Qandahar 237500
2 3 Herat AFG Herat 186800
3 4 Mazar-e-Sharif AFG Balkh 127800
4 5 Amsterdam NLD Noord-Holland 731200
... ... ... ... ... ...
4074 4075 Khan Yunis PSE Khan Yunis 123175
4075 4076 Hebron PSE Hebron 119401
4076 4077 Jabaliya PSE North Gaza 113901
4077 4078 Nablus PSE Nablus 100231
4078 4079 Rafah PSE Rafah 92020

4079 rows × 5 columns

In [20]:
pd.reset_option('all')
: boolean
    use_inf_as_null had been deprecated and will be removed in a future
    version. Use `use_inf_as_na` instead.

C:\anaconda3\lib\site-packages\pandas\_config\config.py:620: FutureWarning: 
: boolean
    use_inf_as_null had been deprecated and will be removed in a future
    version. Use `use_inf_as_na` instead.

  warnings.warn(d.msg, FutureWarning)
In [21]:
pd.get_option('max_rows')
Out[21]:
60
In [26]:
df_goods = pd.read_csv('price.csv', sep=';')
df_goods
Out[26]:
id title price
0 1 Ноутбук Acer Aspire 5 A515-54G-502N (NX.HVGEU.006) Pure Silver 10.000000
1 2 Ноутбук Asus ROG Strix G15 G512LI-HN057 (90NR0381-M01640) Black NaN
2 3 Ноутбук HP Pavilion Gaming 15-bc504ur (7DT87EA) Black Суперцена!!! 7.123457
3 4 Ноутбук HP Pavilion Notebook 15-cw1011ua (8RW14EA) Mineral Silver 25.000000
4 5 Ноутбук Acer Aspire 7 A715-41G-R7MZ (NH.Q8LEU.004) Charcoal Black 35.000000
5 6 Ноутбук Dell Inspiron 3582 (I3582C54H5NIL-BK) Black 5.000000
6 7 Ноутбук Apple MacBook Air 13" 256GB 2020 Space Gray (MWTJ2) 11.000000
7 8 Ноутбук Asus ROG Strix G15 G512LI-HN094 (90NR0381-M01620) Black 16.000000
8 9 Ноутбук HP Pavilion Notebook 15-cw1002ua (7KE54EA) Mineral Silver Суперцена!!! 15.000000
9 10 Ноутбук HP Pavilion Notebook 15-cw1005ua (7ZF75EA) Mineral Silver Суперцена!!! NaN
10 11 Ноутбук Lenovo IdeaPad L340-15IRH Gaming (81LK01HCRA) Granite Black 10.000000
In [23]:
pd.get_option('max_colwidth')
Out[23]:
50
In [24]:
pd.set_option('max_colwidth', 100)
In [27]:
df_goods
Out[27]:
id title price
0 1 Ноутбук Acer Aspire 5 A515-54G-502N (NX.HVGEU.006) Pure Silver 10.000000
1 2 Ноутбук Asus ROG Strix G15 G512LI-HN057 (90NR0381-M01640) Black NaN
2 3 Ноутбук HP Pavilion Gaming 15-bc504ur (7DT87EA) Black Суперцена!!! 7.123457
3 4 Ноутбук HP Pavilion Notebook 15-cw1011ua (8RW14EA) Mineral Silver 25.000000
4 5 Ноутбук Acer Aspire 7 A715-41G-R7MZ (NH.Q8LEU.004) Charcoal Black 35.000000
5 6 Ноутбук Dell Inspiron 3582 (I3582C54H5NIL-BK) Black 5.000000
6 7 Ноутбук Apple MacBook Air 13" 256GB 2020 Space Gray (MWTJ2) 11.000000
7 8 Ноутбук Asus ROG Strix G15 G512LI-HN094 (90NR0381-M01620) Black 16.000000
8 9 Ноутбук HP Pavilion Notebook 15-cw1002ua (7KE54EA) Mineral Silver Суперцена!!! 15.000000
9 10 Ноутбук HP Pavilion Notebook 15-cw1005ua (7ZF75EA) Mineral Silver Суперцена!!! NaN
10 11 Ноутбук Lenovo IdeaPad L340-15IRH Gaming (81LK01HCRA) Granite Black 10.000000
In [28]:
pd.get_option('precision')
Out[28]:
6
In [29]:
pd.set_option('precision', 2)
In [33]:
df_goods = pd.read_csv('price.csv', sep=';')
df_goods
Out[33]:
id title price
0 1 Ноутбук Acer Aspire 5 A515-54G-502N (NX.HVGEU.006) Pure Silver 10.0
1 2 Ноутбук Asus ROG Strix G15 G512LI-HN057 (90NR0381-M01640) Black NaN
2 3 Ноутбук HP Pavilion Gaming 15-bc504ur (7DT87EA) Black Суперцена!!! 8.0
3 4 Ноутбук HP Pavilion Notebook 15-cw1011ua (8RW14EA) Mineral Silver 25.0
4 5 Ноутбук Acer Aspire 7 A715-41G-R7MZ (NH.Q8LEU.004) Charcoal Black 35.0
5 6 Ноутбук Dell Inspiron 3582 (I3582C54H5NIL-BK) Black 5.0
6 7 Ноутбук Apple MacBook Air 13" 256GB 2020 Space Gray (MWTJ2) 11.0
7 8 Ноутбук Asus ROG Strix G15 G512LI-HN094 (90NR0381-M01620) Black 16.0
8 9 Ноутбук HP Pavilion Notebook 15-cw1002ua (7KE54EA) Mineral Silver Суперцена!!! 15.0
9 10 Ноутбук HP Pavilion Notebook 15-cw1005ua (7ZF75EA) Mineral Silver Суперцена!!! NaN
10 11 Ноутбук Lenovo IdeaPad L340-15IRH Gaming (81LK01HCRA) Granite Black 10.0
In [34]:
pd.get_option('max_columns')
Out[34]:
20
In [35]:
my_dict = {}
for i in range(1, 31):
    my_dict[f'column {i}'] = [n for n in range(6)]
    
my_dict
Out[35]:
{'column 1': [0, 1, 2, 3, 4, 5],
 'column 2': [0, 1, 2, 3, 4, 5],
 'column 3': [0, 1, 2, 3, 4, 5],
 'column 4': [0, 1, 2, 3, 4, 5],
 'column 5': [0, 1, 2, 3, 4, 5],
 'column 6': [0, 1, 2, 3, 4, 5],
 'column 7': [0, 1, 2, 3, 4, 5],
 'column 8': [0, 1, 2, 3, 4, 5],
 'column 9': [0, 1, 2, 3, 4, 5],
 'column 10': [0, 1, 2, 3, 4, 5],
 'column 11': [0, 1, 2, 3, 4, 5],
 'column 12': [0, 1, 2, 3, 4, 5],
 'column 13': [0, 1, 2, 3, 4, 5],
 'column 14': [0, 1, 2, 3, 4, 5],
 'column 15': [0, 1, 2, 3, 4, 5],
 'column 16': [0, 1, 2, 3, 4, 5],
 'column 17': [0, 1, 2, 3, 4, 5],
 'column 18': [0, 1, 2, 3, 4, 5],
 'column 19': [0, 1, 2, 3, 4, 5],
 'column 20': [0, 1, 2, 3, 4, 5],
 'column 21': [0, 1, 2, 3, 4, 5],
 'column 22': [0, 1, 2, 3, 4, 5],
 'column 23': [0, 1, 2, 3, 4, 5],
 'column 24': [0, 1, 2, 3, 4, 5],
 'column 25': [0, 1, 2, 3, 4, 5],
 'column 26': [0, 1, 2, 3, 4, 5],
 'column 27': [0, 1, 2, 3, 4, 5],
 'column 28': [0, 1, 2, 3, 4, 5],
 'column 29': [0, 1, 2, 3, 4, 5],
 'column 30': [0, 1, 2, 3, 4, 5]}
In [36]:
test = pd.DataFrame(my_dict)
test
Out[36]:
column 1 column 2 column 3 column 4 column 5 column 6 column 7 column 8 column 9 column 10 ... column 21 column 22 column 23 column 24 column 25 column 26 column 27 column 28 column 29 column 30
0 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1 1 1 1 ... 1 1 1 1 1 1 1 1 1 1
2 2 2 2 2 2 2 2 2 2 2 ... 2 2 2 2 2 2 2 2 2 2
3 3 3 3 3 3 3 3 3 3 3 ... 3 3 3 3 3 3 3 3 3 3
4 4 4 4 4 4 4 4 4 4 4 ... 4 4 4 4 4 4 4 4 4 4
5 5 5 5 5 5 5 5 5 5 5 ... 5 5 5 5 5 5 5 5 5 5

6 rows × 30 columns

In [37]:
pd.set_option('max_columns', 30)
In [38]:
test
Out[38]:
column 1 column 2 column 3 column 4 column 5 column 6 column 7 column 8 column 9 column 10 column 11 column 12 column 13 column 14 column 15 column 16 column 17 column 18 column 19 column 20 column 21 column 22 column 23 column 24 column 25 column 26 column 27 column 28 column 29 column 30
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
In [40]:
pd.get_dummies(list(range(11)), prefix='column')
Out[40]:
column_0 column_1 column_2 column_3 column_4 column_5 column_6 column_7 column_8 column_9 column_10
0 1 0 0 0 0 0 0 0 0 0 0
1 0 1 0 0 0 0 0 0 0 0 0
2 0 0 1 0 0 0 0 0 0 0 0
3 0 0 0 1 0 0 0 0 0 0 0
4 0 0 0 0 1 0 0 0 0 0 0
5 0 0 0 0 0 1 0 0 0 0 0
6 0 0 0 0 0 0 1 0 0 0 0
7 0 0 0 0 0 0 0 1 0 0 0
8 0 0 0 0 0 0 0 0 1 0 0
9 0 0 0 0 0 0 0 0 0 1 0
10 0 0 0 0 0 0 0 0 0 0 1
In [ ]: