python-3.4

Function printGreater()

与世无争的帅哥 提交于 2020-01-06 20:17:25
问题 I am trying to implement a function printGreater() that takes a list of numbers and a numeric value as parameter. It prints the numbers in the list that are greater than the value, all on one line with a space between them. If an empty list is provided as the first parameter, the function doesn't print anything. This is what I have so far: def printGreater(nums, value): lstN = (int[nums],value) if nums > value: print(nums, end=", ") 回答1: def printGreater(nums, value): #First create an empty

Unicode Tagging in Python NLTK

≡放荡痞女 提交于 2020-01-06 13:55:04
问题 I am working on a python NLTK tagging program. My input file is Hindi text containing several lines. On tokenizing the text and using pos_tag the output I get is with NN tag only. but with English sentence as input it does proper tagging. Kindly Help. Version - Python 3.4.1, from NLTK 3.0 documentation Kindly help! here is what I tried. word_to_be_tagged = u"ताजो स्वास आनी चकचकीत दांत तुमचें व्यक्तीमत्व परजळायतात." from nltk.corpus import indian train_data = indian.tagged_sents('hindi.pos')[

Unicode Tagging in Python NLTK

烈酒焚心 提交于 2020-01-06 13:54:21
问题 I am working on a python NLTK tagging program. My input file is Hindi text containing several lines. On tokenizing the text and using pos_tag the output I get is with NN tag only. but with English sentence as input it does proper tagging. Kindly Help. Version - Python 3.4.1, from NLTK 3.0 documentation Kindly help! here is what I tried. word_to_be_tagged = u"ताजो स्वास आनी चकचकीत दांत तुमचें व्यक्तीमत्व परजळायतात." from nltk.corpus import indian train_data = indian.tagged_sents('hindi.pos')[

Looping through .xlsx files using pandas, only does first file

我的未来我决定 提交于 2020-01-06 03:39:48
问题 My ultimate goal is to merge the contents of a folder full of .xlsx files into one big file. I thought the below code would suffice, but it only does the first file, and I can't figure out why it stops there. The files are small (~6 KB), so it shouldn't be a matter of waiting. If I print f_list, it shows the complete list of files. So, where am I going wrong? To be clear, there is no error returned, it just does not do the entire for loop. I feel like there should be a simple fix, but being

Installing Rpy2 on Mac OSX with Anaconda Python 3.4 and R 3.1 installed via Macports

时间秒杀一切 提交于 2020-01-05 12:12:30
问题 pip install rpy2 yields the error: /usr/bin/clang -bundle -undefined dynamic_lookup -L/Users/jeff/anaconda3/lib -arch x86_64 build/temp.macosx-10.5-x86_64-3.4/./rpy/rinterface/_rinterface.o -L/Users/jeff/anaconda3/lib -L/opt/local/Library/Frameworks/R.framework/Resources/lib -lR -lRlapack -licui18n -lRblas -o build/lib.macosx-10.5-x86_64-3.4/rpy2/rinterface/_rinterface.so ld: library not found for -licui18n clang: error: linker command failed with exit code 1 (use -v to see invocation) error:

Python 3.4 - Formatting String Input into Title format

故事扮演 提交于 2020-01-05 08:11:19
问题 I'm a bit of a python amateur and I'm creating an extremely basic program. I need it to format a user's input into title format like so: Input: hello Output: Hello This is what I have so far: firstNameInput = input("Hello! What is your first name? \n") firstName = firstNameInput.title When I come to print firstName I get no error, however instead of printing firstName it prints: <built-in method title of str object at 0x0000000003EA60D8> Thanks for any help in advance! :) 回答1: firstNameInput

Update Matplotlib 3D Graph Based on Real Time User Input

醉酒当歌 提交于 2020-01-05 05:45:09
问题 I am trying to get matplotlib to create a dynamic 3d graph based on user input - but I can't get the graph to update. If I use the exact same code but without the "projection='3d'" setting, the program works correctly - but as soon as the graph is changed to display in 3d - it doesn't work. Any help would be greatly appreciated. 3D Graph Code (graph doesn't update) import numpy as np import matplotlib.pyplot as plt from matplotlib.widgets import Slider from mpl_toolkits.mplot3d import Axes3D

Visual C++ 10.0 issue when installing Python module; cl.exe failed with exit status 2 (h5py)

前提是你 提交于 2020-01-05 05:36:17
问题 I've been at this for the last 5 hours or so. I've reinstalled a bunch, but essentially I'm trying to install the Python module h5py on a Windows 8.1 machine running Python 3.4.1. The stack is as follows: Collecting h5py Using cached h5py-2.6.0.tar.gz Requirement already satisfied (use --upgrade to upgrade): numpy>=1.6.1 in c:\python34\lib\site-packages (from h5py) Requirement already satisfied (use --upgrade to upgrade): six in c:\python34\lib\site-packages (from h5py) Building wheels for

Unable to POST to Grafana using Python3 module requests

倖福魔咒の 提交于 2020-01-04 14:17:40
问题 I'm trying to create a dashboard on Grafana using their backend API. I first test that my API token is set up by using GET and successfully get a return code of 200(shown below). I then try to use POST to create a simple dashboard but I keep getting a return code of 400. I'm pretty sure it has something to do with the payload I'm trying to send, but I have been unable to figure it out. Here is the link to the example page I'm using for their JSON format. http://docs.grafana.org/reference/http

Python/pandas: data frame from series of dict: optimization

跟風遠走 提交于 2020-01-04 08:12:28
问题 I have a pandas Series of dictionnaries, and I want to convert it to a data frame with the same index. The only way I found is to pass through the to_dict method of the series, which is not very efficient because it goes back to pure python mode instead of numpy/pandas/cython. Do you have suggestions for a better approach? Thanks a lot. >>> import pandas as pd >>> flagInfoSeries = pd.Series(({'a': 1, 'b': 2}, {'a': 10, 'b': 20})) >>> flagInfoSeries 0 {'a': 1, 'b': 2} 1 {'a': 10, 'b': 20}