StartAndSelect
u/StartAndSelect
I have been learning python for data analytics for quite some time, but I am having some trouble understanding the business application potential that comes with analyzing data with python as opposed to some sort of BI Tool.
A few of the questions I had were:
-
How can/do you share your analysis with your fellow co-workers?
-
What are the benefits of using python analytics over a BI Tool?
-
How do you build a scalable analytics solution with python?
-
What would be some good reading sources for how to implement python analytics in the business space?
I appreciate any insight you all may have
I want to learn how to do A/B testing but want a solid data set to work on. Anyone have a source like that?
I have a dataframe column df['Time'] it is a dtype O (I think that means it's an object) column (i.e. 41:23:00) and I just want to grab everything that comes before the first colon.
I have had a lot of trouble turning this dtype into a string to use for a split and the regex re.search(r'^[^:]+:\s*', df['Time']) is not getting me what I need .
Any help would be appreciated
Edit: using re.search(r'^[^:]+(?=:)' ,df['Time'].str) I get the error TypeError: expected string or bytes-like object
Hello,
I need to find a way to pull attachments from emails being sent to me from a specific sender. I get these files daily, and would later aggregate them and store them in a database.
I need assistance on writing a python script that could search through my gmail account and download attachments from this specific sender. Anyone know where or how to get started on this?
Thanks
Hello, I have been using python 3.5 on Jupyter notebook for some time, but I recently needed to install Python 2 for another task. When I went back to jupyter I noticed that when I click the New dropdown on the Jupyter homepage I only see Python 2 under my notebook options.
I was originally using Conda Root but now I do not have this as an option. How can I fix this?
Thanks
I was having trouble doing a pip install of scikit so I downloaded jupyter which allowed me to pip install whatever I've needed without any problems. However when I go back to idle it doesn't register any of the libraries that I can access on Jupyter.
Can someone explain to me how I can setup a path for idle to access the same libraries as Jupyter?
Hello I am new to python and I am attempting to group a dataframe to give me the mean by position.
Below is my code
import pandas as pd
#create df
nba = pd.read_csv('NBAStats.csv', index_col='Rk')
#create subset of df
nba = nba.iloc[:,[1,17]]
#find mean of USG field by Position field
nba = nba.iloc[:,[1]].mean().groupby(nba.iloc[:,[0]])
print(nba)
My expected output should be something like this:
PG 24.35
SG 17.24
SF 24.14
Now I have a few questions.
-
What am I doing wrong
-
Why do I need to use iloc instead of simply saying nba[1,17]?
-
I get an error when I try to select fields from my dataframe by name, and am forced to call them by column
Hello I am trying to pip install the scipy package and continue to get this error:
Command "c:\users\NAME\appdata\local\programs\python\python35-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\NAME\\AppData\\Local\\Temp\\pip-build- zevsr19w\\scipy\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\NAME\AppData\Local\Temp\pip-fnndfqsq-record\install-record.txt --single-version-externally- managed --compile" failed with error code 1 in C:\Users\NAME\AppData\Local\Temp\pip-build- zevsr19w\scipy\
I am not really sure what this error
Hello I am new to python and I am attempting to connect to a localhost sql server database.
# Parameters
server = "MyServer"
DB = "NFL"
# Create the connection
conn = pyodbc.connect('DRIVER={SQL Server};SERVER=' + DB['servername'] + ';DATABASE=' + DB['database'] + ';Trusted_Connection=yes')
# query db
sql = """
SELECT TD FROM Stats
"""
df = pd.sql.read_sql(sql, conn)
df.head()
But I get this error when I run my code
conn = pyodbc.connect('DRIVER={SQL Server};SERVER=' + DB['servername'] + ';DATABASE=' + DB['database'] + ';Trusted_Connection=yes')
TypeError: string indices must be integers
Why would I be gettin
Hi, I'm new to python and attempting to aggregate some data to display in some bar charts
I have a dataframe that I extract from a csv:
Age RushAtt PassTgt
0 21.0 109 10.0
1 30.0 106 3.0
2 22.0 105 16.0
3 25.0 101 17.0
4 25.0 95 14.0
5 31.0 93 19.0
6 28.0 93 27.0
7 25.0 91 27.0
8 23.0 89 18.0
9 28.0 85 21.0
10 25.0 84 19.0
11 24.0 78 17.0
12 33.0 78 20.0
13 23.0 74 11.0
14 23.0 73 8.0
I am attempting to bin the RushAtt and PassAtt within bins of t
The goal of my script is to ask for your name, rate, and hours and do a calculation of your pay including overtime. My code continuously captures my input for the yourHours function in the except instead of the try. However for the yourRate function it seems to be working fine. What am I missing?
def yourHours():
print('How many hours will you be working?')
hours=input()
try:
hrs=float(hours)
hours
if hours > 40:
overtime_pay = 0
overtime_rate = 1.5
overtime = hours-40
overtime_pay = overtime * (rate * overtime_rate)
print(name, 'you will
I am attempting to plot a bar chart that using 3 columns of dataframe i have. Column 0 is a string field with Player names while column 2 and 7 have numeric values as seen below. I am having trouble using the xticks to make my string field populate on the x=axis while the other 2 values are grouped under them. Any help is appreciated.
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
df = pd.read_csv('TestRB.csv',
delimiter=',',
usecols=(0,2,7),
index_col=None)
a = df['PLAYER']
b = df['PLAYS']
c = df['RYD']
df.plot(kind='bar', xticks=a)
plt.s
$200 per person, 12 people 1ppr. Any rookie mistakes I should avoid?
Hello all, I have a json file which I have reached a list with multiple dictionaries.
[{'code': '32',
'date': '25 Jul 2016',
'day': 'Mon',
'high': '98',
'low': '56',
'text': 'Sunny'},
{'code': '32',
'date': '02 Aug 2016',
'day': 'Tue',
'high': '94',
'low': '58',
'text': 'Sunny'},
{'code': '32',
'date': '03 Aug 2016',
'day': 'Wed',
'high': '98',
'low': '58',
'text': 'Sunny'}]
I wish to write a loop that will get me an output like so:
code: 32
date: 25 Jul 2016
day: Mon
etc.
for item in d:
for key in item:
print(key)
The loop above gets me the key