dbf

Way to convert dbf to csv in python?

青春壹個敷衍的年華 提交于 2019-12-20 03:14:18
问题 I have a folder with a bunch of dbf files I would like to convert to csv. I have tried using a code to just change the extension from .dbf to .csv, and these files open fine when I use Excel, but when I open them in pandas they look like this: s\t� 0 NaN 1 1 176 1.58400000000e+005-3.385... This is not what I want, and those characters don't appear in the real file. How should I read in the dbf file correctly? 回答1: Looking online, there's a few options: https://gist.github.com/ryanhill29

How to modify dbf files in Python

☆樱花仙子☆ 提交于 2019-12-19 03:40:37
问题 Suppose I have different number of dbf files in some folders under the root directory, d:\myfolder . The content of a dbf file looks like the following: Field1 11110481123 12150480021 ... I want to add a field (say, Field1 ) that contains only the last 4 digits of the values in Field2 . Field1 Field2 11110481123 1123 12150480021 0021 ... ... Then, I want to delete Field1 . How can I do the job for all the dbf files that are scattered across different folders in Python? 回答1: You would need the

Read/Write xBASE (DBASE 3-5 /DBF) files [closed]

烈酒焚心 提交于 2019-12-18 03:43:26
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . Is there any good library for reading / writing DBF files in java or any other language ? 回答1: You might give this library a try: http://dans-dbf-lib.sourceforge.net/ It is open source (GPL) and pure Java. 回答2: Its easy to get to via OleDB provider, such as via .Net, Visual Foxpro would obviously be able to read

How to create a DBF file from scratch in C#?

瘦欲@ 提交于 2019-12-18 03:35:18
问题 I am trying to write a DBF file from scratch in my program. I want to create it, add some columns, and then add data to the columns X amount of times. My program will not need to read it in again, but other programs will. I've looked around for a solution to this, but all seem to assume an existing DBF file, whereas I want to make a new one. The purpose of this is to make the DBF part of an ESRI ShapeFile. Does anyone know how to do this? 回答1: Download Microsoft OLE DB Provider for Visual

Convert .csv file into .dbf using Python?

北战南征 提交于 2019-12-17 18:07:26
问题 How can I convert a .csv file into .dbf file using a python script? I found this piece of code online but I'm not certain how reliable it is. Are there any modules out there that have this functionality? 回答1: You won't find anything on the net that reads a CSV file and writes a DBF file such that you can just invoke it and supply 2 file-paths. For each DBF field you need to specify the type, size, and (if relevant) number of decimal places. Some questions: What software is going to consume

How to import a DBF file in SQL Server

做~自己de王妃 提交于 2019-12-17 06:42:42
问题 How can you import a foxpro DBF file in SQL Server? 回答1: Use a linked server or use openrowset, example SELECT * into SomeTable FROM OPENROWSET('MSDASQL', 'Driver=Microsoft Visual FoxPro Driver; SourceDB=\\SomeServer\SomePath\; SourceType=DBF', 'SELECT * FROM SomeDBF') 回答2: I was able to use the answer from jnovation but since there was something wrong with my fields, I simply selected specific fields instead of all, like: select * into CERTDATA from openrowset('VFPOLEDB','C:\SomePath

How to import a DBF file in SQL Server

▼魔方 西西 提交于 2019-12-17 06:42:03
问题 How can you import a foxpro DBF file in SQL Server? 回答1: Use a linked server or use openrowset, example SELECT * into SomeTable FROM OPENROWSET('MSDASQL', 'Driver=Microsoft Visual FoxPro Driver; SourceDB=\\SomeServer\SomePath\; SourceType=DBF', 'SELECT * FROM SomeDBF') 回答2: I was able to use the answer from jnovation but since there was something wrong with my fields, I simply selected specific fields instead of all, like: select * into CERTDATA from openrowset('VFPOLEDB','C:\SomePath

Using Python to write dbf table with fpt memos

久未见 提交于 2019-12-14 03:12:24
问题 I have a legacy application that uses .dbf and .fpt files. I am looking to read and write those files, I have figured out a way to write these files but not using fpt memos. I am using python 2.7.2 and dbf module 0.95.02. When I try to use the dbf module I get an error when trying to use FpTable. >>> import dbf >>> table = dbf.FpTable('test','name C(25); age N(3,0); qualified M') >>> table Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/doctor/.virtualenvs

Create .DBF in C# code that is readable from Excel (VFP or not)

穿精又带淫゛_ 提交于 2019-12-13 16:20:49
问题 LANGUAGE: C#, System: Windows7, Excel 2007 I want to create a .DBF from some data, and i want to open it from Excel 2007. It can be either dBase or foxpro. I am currently doing in FoxPro9 (btw this code is from the internet): OleDbConnection con = new OleDbConnection("Provider=VFPOLEDB.1;Data Source=C:\\Temp\\;"); con.Open(); OleDbCommand cmd1 = new OleDbCommand("Create Table TestDBF (Field1 I, Field2 C(10))", con); OleDbCommand cmd2 = new OleDbCommand("Insert Into TestDBF Values (1, 'Hello')

Which header format can be assumed by reading an initial .DBF byte?

痞子三分冷 提交于 2019-12-13 14:56:46
问题 Regarding the first byte of a .DBF file and how to detect the version of xbase used (ie, the format of the rest of the file), the most comprehensive list I can compile is: Byte 0 ----------- x xxx x 001 = 0x?1 not used 0 000 0 010 = 0x02 FoxBASE 0 000 0 011 = 0x03 FoxBASE+/dBASE III PLUS, no memo x xxx x 100 = 0x?4 dBASE 7 0 000 0 101 = 0x05 dBASE 5, no memo 0 011 0 000 = 0x30 Visual FoxPro 0 011 0 001 = 0x31 Visual FoxPro, autoincrement enabled 0 011 0 010 = 0x32 Visual FoxPro, Varchar,