I have the following in my emacs.d/init.el :
(setq importmagic-configuration-style-alist '((multiline . backslash)
(max_columns . 180000)))
And the following in my setup.cfg
[importmagic]
multiline = 'backslash'
max_columns = 1000
indent_with_tabs = 0
And when when I run C-c C-l, my imports change from:
import datetime
from XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX import YYYYYYYYYYYYYYYYYYYYYYYY
from XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX import ZZZZZZZZZZZZZZZZZZZZZZZZ
from XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX import WWWWWWWWWWWWWWWWWWWWWWWW, AAAAAAAAAAAAAAAAAAAAAAAAAA
to
import datetime
from XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX import (,
YYYYYYYYYYYYYYYYYYYYYYYY)
from XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX import ZZZZZZZZZZZZZZZZZZZZZZZZ
from XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX import (,
WWWWWWWWWWWWWWWWWWWWWWWW, AAAAAAAAAAAAAAAAAAAAAAAAAA)
Which is invalid and actually breaks my code.
How can I make importmagic use backslash instead of parens as my settings clearly say to do?
What's worse is if you now do a /second/ import-magic run, they get chopped up completely:
import datetime
from XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX import (,
from XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX import ZZZZZZZZZZZZZZZZZZZZZZZZ
from XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
importmagic's README is wrong. According to the source the the alist you want is importmagic-style-configuration-alist.
Related
I cannot get any NSE Symbol data from the AlphaVantage, they return always empty array.
Query:
https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol=NSE:TITAN&apikey=Q134IXR7RVWU5AQL&outputsize=full&interval=1min
Response:
{}
A month back the same query was returning data.
Looks something has changed on the AlphaVantage server end recently.
Your help is much appreciated in advance!
Try this
import pandas as pd
import json
import requests
import datetime
from pandas import DataFrame
from datetime import datetime as dt
from alpha_vantage.timeseries import TimeSeries
stock_ticker = 'SPY'
api_key = 'Q134IXR7RVWU5AQL'
ts = TimeSeries (key=api_key, output_format = "pandas")
data_daily, meta_data = ts.get_intraday(symbol=stock_ticker, interval ='1min', outputsize ='full')
print(data_daily)
The output for me looks like this
I added a chart in docx, and I hope I can edit the data to change histogram bins length.
How can I do it?
#scanny This is the code I tried, and show me error is
chart.replace_data(chart_data) AttributeError: 'module' object has no
attribute 'replace_data'
import docx
import os
import sys
import csv
import datetime
import time
import pptx
from pptx import chart
from pptx.chart import data
from pptx.chart.data import CategoryChartData
CURRENT_DIR = os.path.dirname(os.path.abspath(sys.argv[0]))
docxFilePath = os.path.join(CURRENT_DIR,'sample.docx')
chart_data = CategoryChartData()
chart_data.categories = ['East', 'West', 'Midwest']
chart_data.add_series('Series 1', (19.2, 21.4, 16.7))
chart.replace_data(chart_data)
filename ='test.docx'
filepath = os.path.join(r'C:\Users\Administrator\Desktop\python test\update_test', filename)
doc.save(filepath)
Charts in python-pptx are updated by populating a new ChartData object and passing it to chart.replace_data:
from pptx.chart.data import CategoryChartData
chart_data = CategoryChartData()
chart_data.categories = ['East', 'West', 'Midwest']
chart_data.add_series('Series 1', (19.2, 21.4, 16.7))
chart.replace_data(chart_data)
Hi I'm trying to use Brill Tagger to tag a set of sentences. But when running the following ,
=======================
Training a Brill Tagger
>>> default_tagger = DefaultTagger('NN')
>>> initial_tagger = backoff_tagger(train_sents, [UnigramTagger, BigramTagger, TrigramTagger], backoff=default_tagger)
>>> initial_tagger.evaluate(test_sents)
0.8806820634578028
>>> from tag_util import train_brill_tagger
>>> brill_tagger = train_brill_tagger(initial_tagger, train_sents)
>>> brill_tagger.evaluate(test_sents)
0.8827541549751781
I'm getting the following error.
NameError: name 'backoff_tagger' is not defined
what are the causes for this. Do I need to import something
I think you need to import the following:
from tag_util import backoff_tagger
I have written this code in Matlab to link weka with matlab so that i can implement Genetic Algorithm
enter code here
import java.util.*
import java.util.Enumeration
import java.lang.String
import weka.classifiers.*
import weka.classifiers.Evaluation
import weka.classifiers.trees.J48
import java.io.FileReader
import weka.core.Instances
import weka.core.Utils
import weka.core.Attribute
import java.lang.System
javaaddpath('C:\Users\sagnik\Documents\MATLAB\GA\weka.jar');
clear all
clc
v1 = java.lang.String('-t');
v2 = java.lang.String('C:\Users\sagnik\Documents\MATLAB\GA\generateTrainDiv.csv');
v3 = java.lang.String('-T');
v4 = java.lang.String('C:\Users\sagnik\Documents\MATLAB\GA\generateTestDiv.csv');
prm = cat(1,v1,v2,v3,v4);
classifier = javaObject('weka.classifiers.functions.MultilayerPerceptron');
weka.classifiers.Evaluation.evaluateModel(classifier,prm);
But this is giving error in the last line as:
Java exception occurred:
java.lang.Exception:
Weka exception: Can't open file null.
at weka.classifiers.Evaluation.evaluateModel(Evaluation.java:1080)
Please somenone help me,how to fix this! How is the filename 'null' here..I have already provided the 2 filenames..
Does anyone have an example on how to properly integrate banana-rdf into a project?
Based on the example on how to use a SPARQL engine, I have tried to set up something for my project, but I get an error that I don't know how to resolve.
import java.net.URL
import org.w3.banana.jena.JenaModule
import org.w3.banana.{SparqlHttpModule, SparqlOpsModule, RDFOpsModule, RDFModule}
object SparqlService extends RDFModule with RDFOpsModule with SparqlOpsModule
with SparqlHttpModule with JenaModule
import SparqlService._
import SparqlService.sparqlOps
import SparqlService.sparqlOps._
import SparqlService.sparqlHttp.sparqlEngineSyntax._
import SparqlService.ops._
val endpoint = new URL("http://dbpedia.org/sparql/")
val query = parseSelect("""
PREFIX ont: <http://dbpedia.org/ontology/>
SELECT DISTINCT ?language WHERE {
?language a ont:ProgrammingLanguage .
?language ont:influencedBy ?other .
?other ont:influencedBy ?language .
} LIMIT 100
""").get
val answers: Rdf#Solutions = endpoint.executeSelect(query).get
val languages: Iterator[Rdf#URI] = answers.iterator map { row =>
row("language").get.as[Rdf#URI].get
}
println(languages.to[List])
Unfortunately, I get the following error and I don't get why.
Error:(27, 26) could not find implicit value for parameter fromPG:
org.w3.banana.binder.FromPG[org.w3.banana.jena.Jena,com.hp.hpl.jena.graph.Node_URI]
row("language").get.as[Rdf#URI].get
Any idea?