I am having difficulty importing a CSV File into Stata. I have tried using the import delimited feature. Stata does not recognize the semi-colon separated data as separate data points. I also have access to a plain text file but I haven't had success with that either. Any suggestions?
I see that you've figured out a solution already, but did you specify "delimiters(";")" when you were using "import delimited"? Otherwise, Stata assumes the delimiters are commas.
Related
I am trying to get my first dashboard with python dash running.
The whole thing is very similar to this https://github.com/dkrizman/dash-manufacture-spc-dashboard.
At the beginning a Dataframe is read in from a csv. My problem seems to be quite easy to solve but somehow I am not succeeding:
I want to create a initial window that allows the user to select (from e.g. dropdown) the csv file (or accordingly the path) that is read in. All the .csv files look the same but just have different values.
When using the modal components I get problems with the install of bootstrap and I thought there must be an easier way?
Thanks for your help!
Best,
Nik
I'm using the following code to add a Macro to Excel. I notice that the data / other WorkSheets from the original Excel had dropped completely but the Macro is showing.
This is the code that I am using:
import xlsxwriter
workbooks = xlsxwriter.Workbook('C:\\Users\\user\Desktop\\test.xlsm')
workbooks.add_vba_project('C:\\Users\\user\\Desktop\\vbaProject.bin')
workbooks.close()
I used the link http://xlsxwriter.readthedocs.io/example_macros.html and it seems to be the same from another page https://redoakstrategic.com/pythonexcelmacro/
I wondered if there is another library that I should use for this?
I tried the following link Use Python to Inject Macros into Spreadsheets it seems that here again the data from the original file is overwritten. Not sure if this is a duplicate or not, or if I missed something rather obvious ?
Thanks
Unfortunately, xlsxwriter can't load information from already existing Excel workbooks; it is only used for making new ones. You are overwriting your old workbook with a blank one that has your macros.
If you need to load information, look into openpyxl. It can be used for creating .xlsm files.
One way around it is to create the macro you want in another Excel so we can execute it to affect the other Excel. Then using win32.com it runs the VBA.
enter code here
#import win32com.client
#xl=win32com.client.Dispatch("Excel.Application")
#xl.Workbooks.Open(Filename="C:\\macro.xlsm",ReadOnly=1)
#xl.Application.Run("macro")
#xl = 0
I am curious and have not been able to find the answer to this question.
Is there a way to use a wildcard in a filename in Stata when using the insheet command?
For example, I have a .do file that I will use once a month. The name of the file will change every month(will include a date) but will have one part that will stay consistent(mmddyyyy_data.csv / data.csv stays consistent).
I haven't had any luck using insheet using "./*data.csv" Is there another way to achieve this?
Thanks!
I think this will not work because insheet only wants one dataset and the wildcard would allow you to return more than one.
If you're certain that there will only be one file of this type maybe you can use something like this:
local file : dir . files "*data.csv"
insheet using `file'
When I tried to open Twitter.csv in Weka, I get an error that the "attribute names are not unique".
Does anyone know how to fix it?
The problem seems to be of unique name of the attributes. Please, remove prohibited characters.
Also please refer
Weka csv to arff special characters caue error
For Invoking a CSVLoader to open CSV File In the WEKA Workbench:
Open File > Open > Select 'invoke options dialog' > Select the file and Open > Opens weka.gui.GenericObjectEditor with weka.core.converters.CSVLoader
Fill-up required options for attributes like numeric, nominal, string, missing values, date etc. Which should work.
However, if still problem persists you need to check any errors in the lines in CSV using NotePad++ or Excel rectify errors in delimiters, attribute type, etc.
manually with lot of care. This should rectify the problems.
If not check the validity of CSV file with available online or desktop tools.
We are in a class on introductory econometrics and need to export data from Gretl so that Stata users can import it.
Seems that there is a tool to make it (Stat/Transfer), but it's not free.
Has anyone a tested method to do this?
Use gretl.export(vars) to export to a csv file in gretl's temp directory, which can be read into Stata with import delimited.
Gretl will happily write is Stata format. You can either use the graphical user interface for this (File>Export) or the store command, as in
store mydata.dta