嗨我对时区的疑问很少:
我搜索了维基百科和许多相关网站,但没有找到相关的解释
嗨,我需要以下面的格式创建一个JSON对象.怎么去吧
{"user2_proximity": 3, "Wifi_1": -80, "Wifi_2": -40, "Wifi_3": -40,
"thermostat": 18, "light": 0, "hour_of_day": 0, "user3_proximity": 3,
"user1_proximity": 1, "day_of_week": 1, "security": 0, "minute_of_hour": 9,
"Act_1": 1, "Act_2": 0, "Act_3": 0}
Run Code Online (Sandbox Code Playgroud) 我正在对客户服务数据进行语音情感分析。我有一个音频文件,其中客户服务官员提出了问题并且客户给出了他的评论。
我需要分割这个音频,只得到客户的评论部分来做情绪分析,不管客户是高兴、悲伤还是中立。
请让我知道,如何拆分音频文件以仅获取客户的音频。音频格式为“.aac”
到目前为止,这是我所做的:
from os import path
AUDIO_FILE = path.join(path.dirname(path.realpath('C:\\Users\\anagha\\Documents\\Python Scripts')),"Python Scripts\\audioa.aac")
halfway_point = len(AUDIO_FILE) / 2
Run Code Online (Sandbox Code Playgroud) 我的数据框包含年,月,日,小时,分钟,秒,Daily_KWH列.我需要使用神经网络来预测每日KWH.请让我知道如何去做
Daily_KWH_System year month day hour minute second
0 4136.900384 2016 9 7 0 0 0
1 3061.657187 2016 9 8 0 0 0
2 4099.614033 2016 9 9 0 0 0
3 3922.490275 2016 9 10 0 0 0
4 3957.128982 2016 9 11 0 0 0
Run Code Online (Sandbox Code Playgroud)
当我适应模型时,我得到了价值错误.
代码到目前为止:
X = df[['year','month','day','hour','minute','second']]
y = df['Daily_KWH_System']
from sklearn.cross_validation import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y)
from sklearn.preprocessing import StandardScaler
scaler = StandardScaler()
# Fit only to the training …Run Code Online (Sandbox Code Playgroud) classification neural-network model-fitting python-3.x valueerror
我无法可视化或编写决策树。我该怎么办呢?
Python版本3.5,Anaconda 3,我什至设置了环境变量
from sklearn import tree
model = tree.DecisionTreeClassifier(criterion='gini')
model=tree.DecisionTreeClassifier()
model.fit(trainData,trainLabel)
model.score(trainData,trainLabel)
predicted= model.predict(testData)
from sklearn.externals.six import StringIO
import pydot
import pydotplus
dot_data = StringIO()
tree.export_graphviz(model, out_file=dot_data)
graph = pydotplus.graph_from_dot_data(dot_data.getvalue())
print(graph)
graph.write_pdf("C:\\Users\\anagha\\Desktop\\SynehackData\\DATA\\DATA\\graph.pdf")
Run Code Online (Sandbox Code Playgroud)
错误 :
InvocationException: GraphViz's executables not found
Run Code Online (Sandbox Code Playgroud) 我在同一个文件夹中有 2 个 python 文件,utils.py并且preprocessing.py.
我在utils.py文件中定义了两个函数:preprocess_text, text2seq_generator
我需要functions在preprocessing.py. 但我无法导入并警告说从第 19 行重新定义了未使用的 preprocess_text
代码:
实用程序.py
from __future__ import print_function
from collections import defaultdict
from collections import Counter
from string import punctuation
#import pdb
def filter_text(text):
return ''.join([c for c in text if c not in punctuation]).lower()
def preprocess_text(file_path_src, file_path_tar, max_feats):
f_src = open(file_path_src)
f_tar = open(file_path_tar)
vocab = defaultdict(int)
freq_src = defaultdict(int)
freq_tar = defaultdict(int)
sents_src = [line.rstrip() for line in …Run Code Online (Sandbox Code Playgroud) import pandas as pd
from sklearn import svm
### Read the CSV ###
df = pd.read_csv('C:/Users/anagha/Documents/Python Scripts/sampleData.csv')
df
from sklearn.cross_validation import train_test_split
train, test = train_test_split(df, train_size = 0.8)
train
test
x_column=['Userid','day_of_week','hour_of_day','minute_of_hour']
y_column = ['thermostat']
svc = svm.SVC()
model = svm.svc(kernel='linear', c=1, gamma=1)
Run Code Online (Sandbox Code Playgroud)
我收到错误AttributeError:'module'对象没有属性'svc'.尝试了很多技术,但没有一个是有效的.我是python的新手,非常感谢他们的帮助
我需要在B列中重复的值,直到A列发生变化.
这是输入
Column A Column B
18 1
18 0
18 0
18 0
24 2
24 0
18 3
18 0
18 0
18 0
Run Code Online (Sandbox Code Playgroud)
预期产出
Column A Column B
18 1
18 1
18 1
18 1
24 2
24 2
18 3
18 3
18 3
18 3
Run Code Online (Sandbox Code Playgroud) 日期/时间格式如下:
Date/Time
02-05-2018 07:45
02-05-2018 07:50
1/17/2018 2:15
1/17/2018 2:30
1/17/2018 2:45
Run Code Online (Sandbox Code Playgroud)
上面的“02-05-2018”假设是 2 月 5 日,但它是 5 月 2 日。
基本上格式如下:
02-05-2018 07:45 - dd-mm-yyyy hh:mm,实际值为 43222.32292,我相信这是一种文本格式
现在我需要将所有这些条目转换为正常的日期/时间格式:mm-dd-yyyy hh:mm
请让我知道,尝试了几种方法但没有运气
我是python的新手并且有一个查询.我需要在B列中重复的值,直到A列发生变化.
这是示例数据:
A B
18 1
18 0
18 0
24 2
24 0
24 0
24 0
10 3
10 0
10 0
Run Code Online (Sandbox Code Playgroud)
我多么想要我的输出
Column A Column B
18 1
18 1
18 1
18 1
24 2
24 2
10 3
10 3
10 3
10 3
Run Code Online (Sandbox Code Playgroud)
请通过这个帮助我.谢谢
python ×5
python-3.x ×4
python-2.7 ×3
datetime ×2
pandas ×2
aac ×1
audio ×1
csv ×1
cumsum ×1
date ×1
excel ×1
gmt ×1
group-by ×1
importerror ×1
json ×1
keras ×1
pydub ×1
pygraphviz ×1
svm ×1
timezone ×1
utc ×1
valueerror ×1