Results 1 to 8 of 8

Thread: Lianja Python and Pandas

  1. #1
    Member
    Join Date
    Oct 2012
    Location
    México city
    Posts
    33

    Question Lianja Python and Pandas

    Hello I instal pandas in my Lianja python directory it works fine I use in console :

    import pandas as pd

    and read my xlsx file :

    df = pd.read_excel(r'C:\lianja\apps\administracion_de_s urtidos\Maestro de Productos Alpura.xlsx')

    Now. How can I get the data in my 'df' Objetc?

    Thanks for the help

  2. #2
    Senior Member
    Join Date
    Feb 2012
    Posts
    1,205
    Hi Gontran,

    I think you would be much better off reading the excel file directly into your lianja table.
    You can use and specify the file name and type.

    That said, if there was something that you specifically needed python for, like in my case of reading individual pixel values using the opencv package, you could use Lianja.execute() to pull that data into a lianja table.

    In my case, I am using numpy, but pandas should work the same way.

    Here is a screenshot on how to do that.Name:  fromnumpy.jpg
Views: 47
Size:  53.6 KB

  3. #3
    Member
    Join Date
    Oct 2012
    Location
    México city
    Posts
    33
    Hello so nice, but now my excel files dont have images, I try to use pandas in python to open the xlsx files from excel my users use many especial characters in the excel cels, I cant convert this xlsx to cvs files this make many errors, the better idea is to read the xlsx files.
    I can use the append from with xlsx files?

    Or whats the best way to do this?

    Thanks for the time and the advices.

  4. #4
    Senior Member
    Join Date
    Feb 2012
    Posts
    1,205
    Hi Gontran,

    Can you send a sample of the xlsx file? It would be easier to troubleshoot an actual file.

    Herb

  5. #5
    Member
    Join Date
    Oct 2012
    Location
    México city
    Posts
    33

    pandas python

    Hello yes here are 3 simple examples , but many times this files have too many columns and rows.

    Thanks again.

    ATPRO ALPURA.zip

  6. #6
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    1,924
    Hi Gontran,

    1) what does "too many columns and rows" mean?

    2) what is meant by "special characters"?

    3) what is meant by "now my excel files don't have images"? If you mean cells that have images, and you want to extract the images, here's an article that shows two ways of doing that: https://www.excelhowto.com/how-to-quickly-extract-pictures-from-an-excel-file.

    hth,

    Hank
    Last edited by HankFay; 2019-08-07 at 21:15.

  7. #7
    Member
    Join Date
    Oct 2012
    Location
    México city
    Posts
    33
    Hi Hank , ok I think you mix 2 topics. I have two questions in phyton one for extracting pictures from excel files.

    and other is how I can use the pandas lib for get xlsx files in native format xlsx.

    the special character are comas, Ñ, ü, and accents, I dont whant to use cvs files.

    Thas the reason because I use :

    import pandas as pd
    df = pd.read_excel(r'C:\lianja\apps\administracion_de_s urtidos\Maestro de Productos Alpura.xlsx')

    then how I can take all data in "df" and create a tempo table?


    Thanks for the help

  8. #8
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    1,924
    Hi Gontran,

    Oh... It's a good idea to start a new thread for each question.

    re: using Pandas -- that's not a Lianja issue, of course. Check out pandas.pydata.org for documentation. E.g., https://pandas.pydata.org/pandas-doc...ead_excel.html That shows how to get your data out of the DataFrame object, and also how to filter out special characters, comments, etc.

    re: creating a cursor -- given you have mentioned large numbers of records, I would likely a) work at figuring out how to import directly into a cursor and only after exhausting all possibilities look at b) creating a table with the required fields. How you proceed from there depends on the context where this will be running and the dev language you want to use.

    hth,

    Hank

Tags for this Thread

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us