2

let us suppose that we have following table :

      Kakheti      Tbilisi  Shida Kartli  Kvemo Kartli Samtskhe-Javakheti  \
1    447.773080   695.168755    575.344860    492.989720                  …   
2    368.175479   680.922659    449.687764    428.683988                  …   
3     94.253356   381.434387    147.149448    219.399642                  …   
4     38.283124    77.261457     39.516685     29.104063                  …   
5     71.281052     0.720206     74.027796     49.294079                  …   
6      1.463107    15.452695      2.457914      0.000000                  …   

as you see one column contains ... symbol, i have tried following code :

import pandas as pd
data =pd.read_excel("https://geostat.ge/media/45425/106_Distribution-of-average-monthly-incomes-per-household-by-regions.xls",
                    skiprows=[0])
data.drop(["Unnamed: 0","Other regions**","Georgia"],axis=1,inplace=True)
data.dropna(axis=0,how='all',inplace=True)
data.dropna(axis=1,how='all',inplace=True)
for column in data.columns:
    if data[column].dtype=="object":
        data[column] =data[column].str.strip()
data = data[data.columns.drop(list(data.filter(regex='…')))]
pd.set_option('display.max_columns', None)
pd.set_option('display.max_rows', 165)
print(data.head(100))

special attention is dedicated to given line

data = data[data.columns.drop(list(data.filter(regex='…')))]

dropna also does not work,so what might be optimal variant?

Edited: come on guys(whoever closed this question) , it is not about display all columns, it is about showing specific columns, here is what i found :

data =data._get_numeric_data()

result is :
    Kakheti      Tbilisi  Shida Kartli  Kvemo Kartli  Adjara A.R.  \
1    447.773080   695.168755    575.344860    492.989720   656.011810   
2    368.175479   680.922659    449.687764    428.683988   576.822184   
3     94.253356   381.434387    147.149448    219.399642   289.083094   
4     38.283124    77.261457     39.516685     29.104063   112.680109   
5     71.281052     0.720206     74.027796     49.294079    17.850210   
6      1.463107    15.452695      2.457914      0.000000     4.489037   
data science
  • 215
  • 9
  • Your issue is likely due to displaying only a subset of the columns. Using `pd.set_option('display.max_columns', None)` will tell pandas to guess an optimal number, which is not what you want. Try `pd.set_option('display.max_columns', 1000)` – mozway May 22 '23 at 08:09
  • @mozway no no it was about deleting columns that does not contain numeric data – data science May 22 '23 at 08:10
  • Then that would be [this](https://stackoverflow.com/questions/25039626/how-do-i-find-numeric-columns-in-pandas)? – mozway May 22 '23 at 08:11
  • yes just i forgot and that is – data science May 22 '23 at 08:12

0 Answers0