Untitled

pandas excel as an object
 avatar
calendula
plain_text
3 years ago
1.6 kB
2
Indexable
Never
import pandas as pd
 
class Table:

    def __init__(self):
        "self.workbook = "Airport.xlsx"

        self.table = []
        self.info = []
        self.data_list_of_sets=[]
        self.namedflight=[]
        self.x=[]

        self.no=0
        self.date = "1.4.2022"
        self.flight_type='NN'
        self.flight_sub_type='NN'
        self.flight='NN'
        self.destination='NN'
        self.ttl_guests=0
        self.inf=0
        self.transfer=0
        self.id00=0
        self.dhc=0
        self.ttl_pax_for_charge=0
        self.registration='NN'
        self.ac_type='NN'
        self.umnr=0
        self.loc=0

    def ucitajTabelu(self):

        # Read and store contentof an excel file

        read_file = pd.read_excel (input('Unesi naziv xlsx tabele: ')) #ovo radi ali da ne bih stalno unosila ime 
        #bolje je ovo ispod:
        #read_file = pd.read_excel ("Airport.xlsx")  
        # Write the dataframe/df object - called "table"
        # into csv file
        read_file.to_csv ("Airport.csv", 
                          index = None,
                          header=True)

        # read csv file and convert into a dataframe object
        table = pd.DataFrame(pd.read_csv("Airport.csv"))

        # show the dataframe
        #df
        return table

#*********************************
table=Table()
print(table)
table.ucitajTabelu()

"""
print("uneta prva tabela")
table2=Table()
print(table2)
table2.ucitajTabelu()
print("uneta druga tabela")
"""