python


Output Issues with pandas, Python


Begin Code
import pandas as pd
df = pd.read_csv('C:/Users/lhicks/Documents/Corporate/test.csv', 'r')
saved_column = df.FirstName
saved_column2 = df.LastName
saved_column3 = df.Email
print saved_column
print saved_column2
print saved_column3
Itemlist = []
Itemlist.append(saved_column)
print Itemlist
End of Code
The objective is to select specific columns from a specified xls sheet, grab all the rows from the specified columns, and then print that data out.
The current issue is the data is grabbed correctly, but after 29-30 rows, it prints/stores a "...", and then jumps to line item 880s, and finishes out from there.
The additional issue is that it also stores this as the value, making it worthless due to not providing the full dataset.
The eventual process is to add the selected columns to a new xls sheet to clean up the old data, and then add the rows to a templated document to generate an advertisement letter.
The first question is how to I have all the fields populate? The second is what is the best approach for this? Please provide additional links as well if possible, this is a practical learning experience for me.
Pandas tries to shorten your data when printing it.
NOTE: all the data is still there (print(df.shape) - to check it, print the shape of your DataFrame), it's just a convenient way not to flood your screen with tons of data rows/columns
Try this:
fn = 'C:/Users/lhicks/Documents/Corporate/test.csv'
cols = ['FirstName','LastName','Email']
df = pd.read_csv(fn, usecols=cols)
df.to_excel('/path/to/excel.xlsx', index=False)
This will parse only ['FirstName','LastName','Email'] columns from a CSV file and will export them to Excel file
UPDATE:
if you want to control how many rows should Pandas print:
with pd.option_context("display.max_rows",200):
print(df)

Related Links

Django admin site not opening while running from pydev in eclipse
WebdriverWait is showing TimeoutException, if i use sleep.time it works ok
Python: Create Array from Indexed List
Overlaying n (user generated) points over a graph
How to get django model object in save method
How to pass file pointer in dll routines using ctypes in python
unable insert jpeg into filemaker db with pyodbc : HY011 ODBC Error
How to pass parameter as pointer in Python [duplicate]
Combine text files into key/value
Python modules not found over terminal but on python shell, Linux
Can PyCharm automatically generate __init__(), __eq__() and __hash__() implementations?
Create multi-level index pandas dataframe from delimited string column
Cross referencing decorators
Best way to speed up the process of creating dictionaries when dealing with a large amount of netflow data in a .json file in Python?
OpenCV Python - No module named cv2 (again)
How to find isolated vertices?

Categories

HOME
python
tensorflow
sas
payment-gateway
oauth
freepascal
google-tag-manager
facebook-graph-api
jasmine
decorator
laravel-5.2
zend-framework2
wampserver
javamail
orientation
simpy
internet-explorer-11
actionscript-2
goutte
xamarin-studio
rfid
jboss7.x
wysiwyg
finite-group-theory
simple-injector
postmessage
cross-platform
quartus
aptana
prestodb
android-fragmentactivity
backpropagation
marathon
fop
samsung-mobile
jenkins-job-dsl
codelite
cell-array
pdflatex
m2e
rhino
lego
oscommerce
npm-publish
forecasting
discord.net
axis-labels
mongoexport
active-model-serializers
intellilock
stereo-3d
upsert
rich-text-editor
apiary
gd
azureportal
google-maps-ios
rpostgresql
static-code-analysis
emoticons
communication-protocol
redux-router
hspec
com-interop
listadapter
financial
proxygen
fill
eml
portfolio
loose-typing
sonarqube5.3
jenkins-scriptler
hyperthreading
mysqldumpslow
subresource-integrity
shift-jis
hg-git
named-ranges
candidate-key
qtestlib
ember-components
suffix-array
coin-flipping
cppdepend
vmware-server
visual-studio-2003
justgage
apache2.2
graph-coloring
usn
cadisplaylink
expression-evaluation
supersized
nintendo
v4l
querystringparameter
handwriting
adsl
post-redirect-get
exitstatus
mvccontrib-grid
hibernate3-maven-plugin
sitemappath
trampolines
asp.net-mvc-controller
plinq
openwysiwyg
outlook-form
divx
dotproject

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App