[Tutor] Questions

2019-04-07 Thread Diana Katz
1) Can you use python from excel? Or just export to excel?
2) I am trying to see if there's a way using python to automate all of this
work that I need to do. I have to collect quarterly segment data for
hundreds of public companies and go back at least 12-16 quarters. We use an
aggregator like factset and they actually don't have this option available
in an automated way. So I'm trying to see if there's a way to build this.
Basically, I get my data from sec.gov and they have interactive data - they
even have the data in excel (though it's a messy file and hard to read). I
attached some of the steps and the data that i'd want to see.
Basically i'd want the excel to look like:
old to new quarters - going back 12 to 16 quarters (more if possible but
not if it will stop the project).
 Columns: 3/31/2017, 6/30/2017, 9/30/17, 12/31/17, 3/313/2018...
Rows:
Sales for segment A
Sales for Segment b
Sales for SEgment C
…(for as many segments as they have)

Earnings for Segment A
.Earnings for Segment B

Depreciation for Segment A
Depreciation for Segment B
Depreciation for Segment C...

I included where I get the data in the attached document.

All the best,

Diana Katz
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] Problem with Saved File

2019-04-07 Thread Stephen P. Molnar
I am using Spyder v-3.3.3 on Debian Stretch and have written a script to 
process data from another application.  I am having a problem saving the 
resulting file [A] as a column vector.


The vector is saved by  np.savetxt(name_s,[A]).

When I open the file in Spyder it is a column vector, but when I import 
the saved file into QtiPlot it is a line vector.


What am I missing in the savetxt statement?

Thanks in advance

--
Stephen P. Molnar, Ph.D.  Life is a fuzzy set
www.molecular-modeling.netStochastic and multivariate
(614)312-7528(c)
Skype:  smolnar1

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] Interoperating with Excel, was Re: Questions

2019-04-07 Thread Peter Otten
Diana Katz wrote:

> 1) Can you use python from excel? Or just export to excel?
> 2) I am trying to see if there's a way using python to automate all of
> this work that I need to do. I have to collect quarterly segment data for
> hundreds of public companies and go back at least 12-16 quarters. We use
> an aggregator like factset and they actually don't have this option
> available in an automated way. So I'm trying to see if there's a way to
> build this. Basically, I get my data from sec.gov and they have
> interactive data - they even have the data in excel (though it's a messy
> file and hard to read). I attached some of the steps and the data that i'd
> want to see. Basically i'd want the excel to look like:
> old to new quarters - going back 12 to 16 quarters (more if possible but
> not if it will stop the project).
>  Columns: 3/31/2017, 6/30/2017, 9/30/17, 12/31/17, 3/313/2018...
> Rows:
> Sales for segment A
> Sales for Segment b
> Sales for SEgment C
> …(for as many segments as they have)
> 
> Earnings for Segment A
> .Earnings for Segment B
> 
> Depreciation for Segment A
> Depreciation for Segment B
> Depreciation for Segment C...

These look like "pivot tables" which are well supported by Excel.
I expect that this is easy to automate with a little bit of Basic.

Of course you can build these tables with a Python script if you feel more 
comfortable in Python. Then either write them into csv files ("comma 
separated value", supported by the standard library) 

https://docs.python.org/3/library/csv.html

which can be read by Excel -- or use a dedicated library. Google came up 
with

https://xlsxwriter.readthedocs.io/

> I included where I get the data in the attached document.

Attachments don't make it to the list. You have to provide a link or (if 
they're small and text-only) paste your data and scripts into the message 
body.


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor